linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Documentation/binfmt-misc.rst: Clarify "P" flag
@ 2026-04-19  4:11 Charlie Jenkins
  2026-04-19  4:11 ` [PATCH 1/2] Documentation/binfmt-misc.rst: Include AT_FLAGS info in "P" flag description Charlie Jenkins
  2026-04-19  4:11 ` [PATCH 2/2] Documenation/binfmt-misc.rst: Make "P" flag path desc more precise Charlie Jenkins
  0 siblings, 2 replies; 3+ messages in thread
From: Charlie Jenkins @ 2026-04-19  4:11 UTC (permalink / raw)
  To: Jonathan Corbet, Shuah Khan, Kees Cook
  Cc: linux-doc, linux-mm, linux-kernel, Charlie Jenkins

Improve the wording of the description of the "P" flag to explain that
the interpreter gets the path to the file provided by execve and not the
full path as well as documenting that AT_FLAGS can be read to see if the
"P" flag is set.

Signed-off-by: Charlie Jenkins <thecharlesjenkins@gmail.com>
---
Charlie Jenkins (2):
      Documentation/binfmt-misc.rst: Include AT_FLAGS info in "P" flag description
      Documenation/binfmt-misc.rst: Make "P" flag path desc more precise

 Documentation/admin-guide/binfmt-misc.rst | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
---
base-commit: 028ef9c96e96197026887c0f092424679298aae8
change-id: ${change-id}

- Charlie



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] Documentation/binfmt-misc.rst: Include AT_FLAGS info in "P" flag description
  2026-04-19  4:11 [PATCH 0/2] Documentation/binfmt-misc.rst: Clarify "P" flag Charlie Jenkins
@ 2026-04-19  4:11 ` Charlie Jenkins
  2026-04-19  4:11 ` [PATCH 2/2] Documenation/binfmt-misc.rst: Make "P" flag path desc more precise Charlie Jenkins
  1 sibling, 0 replies; 3+ messages in thread
From: Charlie Jenkins @ 2026-04-19  4:11 UTC (permalink / raw)
  To: Jonathan Corbet, Shuah Khan, Kees Cook
  Cc: linux-doc, linux-mm, linux-kernel, Charlie Jenkins

Commit 2347961b11d4 ("binfmt_misc: pass binfmt_misc flags to the
interpreter") added a bit to AT_FLAGS in the aux vector to notify an
interpreter that the 'P' flag was set in binfmt-misc. Clarify that the
interpreter is able to be aware of the 'P' flag by using this bit.

Signed-off-by: Charlie Jenkins <thecharlesjenkins@gmail.com>
---
 Documentation/admin-guide/binfmt-misc.rst | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/Documentation/admin-guide/binfmt-misc.rst b/Documentation/admin-guide/binfmt-misc.rst
index 59cd902e3549..2e2be2922ba6 100644
--- a/Documentation/admin-guide/binfmt-misc.rst
+++ b/Documentation/admin-guide/binfmt-misc.rst
@@ -61,9 +61,11 @@ Here is what the fields mean:
             vector for this purpose, thus preserving the original ``argv[0]``.
             e.g. If your interp is set to ``/bin/foo`` and you run ``blah``
             (which is in ``/usr/local/bin``), then the kernel will execute
-            ``/bin/foo`` with ``argv[]`` set to ``["/bin/foo", "/usr/local/bin/blah", "blah"]``.  The interp has to be aware of this so it can
-            execute ``/usr/local/bin/blah``
-            with ``argv[]`` set to ``["blah"]``.
+            ``/bin/foo`` with ``argv[]`` set to ``["/bin/foo",
+            "/usr/local/bin/blah", "blah"]``.  The interp can be aware of this
+            by checking if bit 0 in AT_FLAGS in the auxilary vector is set to 1
+            so it can execute ``/usr/local/bin/blah`` with ``argv[]`` set to
+            ``["blah"]``.
       ``O`` - open-binary
 	    Legacy behavior of binfmt_misc is to pass the full path
             of the binary to the interpreter as an argument. When this flag is

-- 
2.53.0



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] Documenation/binfmt-misc.rst: Make "P" flag path desc more precise
  2026-04-19  4:11 [PATCH 0/2] Documentation/binfmt-misc.rst: Clarify "P" flag Charlie Jenkins
  2026-04-19  4:11 ` [PATCH 1/2] Documentation/binfmt-misc.rst: Include AT_FLAGS info in "P" flag description Charlie Jenkins
@ 2026-04-19  4:11 ` Charlie Jenkins
  1 sibling, 0 replies; 3+ messages in thread
From: Charlie Jenkins @ 2026-04-19  4:11 UTC (permalink / raw)
  To: Jonathan Corbet, Shuah Khan, Kees Cook
  Cc: linux-doc, linux-mm, linux-kernel, Charlie Jenkins

The "full path" is not passed through to the interpreter, but rather
whatever path was passed to execve. The user's shell is the mechanism
that is converting the executable name "blah" into the full path name of
"/usr/local/bin/blah" instead of the kernel. Clarify this in the
documentation by noting that the path is found in execve and including
"shell" in the conversation for locating "blah".

Signed-off-by: Charlie Jenkins <thecharlesjenkins@gmail.com>
---
 Documentation/admin-guide/binfmt-misc.rst | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/Documentation/admin-guide/binfmt-misc.rst b/Documentation/admin-guide/binfmt-misc.rst
index 2e2be2922ba6..aabf6599ac49 100644
--- a/Documentation/admin-guide/binfmt-misc.rst
+++ b/Documentation/admin-guide/binfmt-misc.rst
@@ -56,16 +56,16 @@ Here is what the fields mean:
 
       ``P`` - preserve-argv[0]
             Legacy behavior of binfmt_misc is to overwrite
-            the original argv[0] with the full path to the binary. When this
-            flag is included, binfmt_misc will add an argument to the argument
-            vector for this purpose, thus preserving the original ``argv[0]``.
-            e.g. If your interp is set to ``/bin/foo`` and you run ``blah``
-            (which is in ``/usr/local/bin``), then the kernel will execute
-            ``/bin/foo`` with ``argv[]`` set to ``["/bin/foo",
-            "/usr/local/bin/blah", "blah"]``.  The interp can be aware of this
-            by checking if bit 0 in AT_FLAGS in the auxilary vector is set to 1
-            so it can execute ``/usr/local/bin/blah`` with ``argv[]`` set to
-            ``["blah"]``.
+            the original argv[0] with the path to the binary found in execve.
+            When this flag is included, binfmt_misc will add an argument to the
+            argument vector for this purpose, thus preserving the original
+            ``argv[0]``. e.g. If your interp is set to ``/bin/foo`` and you run
+            ``blah`` (which your shell finds in ``/usr/local/bin``), then the
+            kernel will execute ``/bin/foo`` with ``argv[]`` set to
+            ``["/bin/foo", "/usr/local/bin/blah", "blah"]``.  The interp can be
+            aware of this by checking if bit 0 in AT_FLAGS in the auxilary
+            vector is set to 1 so it can execute ``/usr/local/bin/blah`` with
+            ``argv[]`` set to ``["blah"]``.
       ``O`` - open-binary
 	    Legacy behavior of binfmt_misc is to pass the full path
             of the binary to the interpreter as an argument. When this flag is

-- 
2.53.0



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-04-19  4:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-04-19  4:11 [PATCH 0/2] Documentation/binfmt-misc.rst: Clarify "P" flag Charlie Jenkins
2026-04-19  4:11 ` [PATCH 1/2] Documentation/binfmt-misc.rst: Include AT_FLAGS info in "P" flag description Charlie Jenkins
2026-04-19  4:11 ` [PATCH 2/2] Documenation/binfmt-misc.rst: Make "P" flag path desc more precise Charlie Jenkins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox