<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/samples/check-exec/inc.c, branch v6.18.21</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.18.21</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.18.21'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2025-01-27T19:37:18+00:00</updated>
<entry>
<title>selftests: Handle old glibc without execveat(2)</title>
<updated>2025-01-27T19:37:18+00:00</updated>
<author>
<name>Mickaël Salaün</name>
<email>mic@digikod.net</email>
</author>
<published>2025-01-15T14:47:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=38567b972a22706e9a1a52b2c4bc9ea4b5ed00ed'/>
<id>urn:sha1:38567b972a22706e9a1a52b2c4bc9ea4b5ed00ed</id>
<content type='text'>
Add an execveat(2) wrapper because glibc &lt; 2.34 does not have one.  This
fixes the check-exec tests and samples.

Cc: Günther Noack &lt;gnoack@google.com&gt;
Cc: Jeff Xu &lt;jeffxu@chromium.org&gt;
Cc: Kees Cook &lt;kees@kernel.org&gt;
Cc: Mimi Zohar &lt;zohar@linux.ibm.com&gt;
Cc: Paul Moore &lt;paul@paul-moore.com&gt;
Cc: Roberto Sassu &lt;roberto.sassu@huawei.com&gt;
Cc: Serge Hallyn &lt;serge@hallyn.com&gt;
Cc: Stefan Berger &lt;stefanb@linux.ibm.com&gt;
Cc: Stephen Rothwell &lt;sfr@canb.auug.org.au&gt;
Reported-by: Nathan Chancellor &lt;nathan@kernel.org&gt;
Closes: https://lore.kernel.org/r/20250114205645.GA2825031@ax162
Signed-off-by: Mickaël Salaün &lt;mic@digikod.net&gt;
Reviewed-by: Günther Noack &lt;gnoack3000@gmail.com&gt;
Link: https://lore.kernel.org/r/20250115144753.311152-1-mic@digikod.net
Signed-off-by: Kees Cook &lt;kees@kernel.org&gt;
</content>
</entry>
<entry>
<title>samples/check-exec: Add an enlighten "inc" interpreter and 28 tests</title>
<updated>2024-12-19T01:00:29+00:00</updated>
<author>
<name>Mickaël Salaün</name>
<email>mic@digikod.net</email>
</author>
<published>2024-12-12T17:42:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2a69962be4a7e97ab347e05826480a3352c6fbc8'/>
<id>urn:sha1:2a69962be4a7e97ab347e05826480a3352c6fbc8</id>
<content type='text'>
Add a very simple script interpreter called "inc" that can evaluate two
different commands (one per line):
- "?" to initialize a counter from user's input;
- "+" to increment the counter (which is set to 0 by default).

It is enlighten to only interpret executable files according to
AT_EXECVE_CHECK and the related securebits:

  # Executing a script with RESTRICT_FILE is only allowed if the script
  # is executable:
  ./set-exec -f -- ./inc script-exec.inc # Allowed
  ./set-exec -f -- ./inc script-noexec.inc # Denied

  # Executing stdin with DENY_INTERACTIVE is only allowed if stdin is an
  # executable regular file:
  ./set-exec -i -- ./inc -i &lt; script-exec.inc # Allowed
  ./set-exec -i -- ./inc -i &lt; script-noexec.inc # Denied

  # However, a pipe is not executable and it is then denied:
  cat script-noexec.inc | ./set-exec -i -- ./inc -i # Denied

  # Executing raw data (e.g. command argument) with DENY_INTERACTIVE is
  # always denied.
  ./set-exec -i -- ./inc -c "+" # Denied
  ./inc -c "$(&lt;script-ask.inc)" # Allowed

  # To directly execute a script, we can update $PATH (used by `env`):
  PATH="${PATH}:." ./script-exec.inc

  # To execute several commands passed as argument:

Add a complete test suite to check the script interpreter against all
possible execution cases:

  make TARGETS=exec kselftest-install
  ./tools/testing/selftests/kselftest_install/run_kselftest.sh

Cc: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
Cc: Christian Brauner &lt;brauner@kernel.org&gt;
Cc: Kees Cook &lt;keescook@chromium.org&gt;
Cc: Paul Moore &lt;paul@paul-moore.com&gt;
Cc: Serge Hallyn &lt;serge@hallyn.com&gt;
Signed-off-by: Mickaël Salaün &lt;mic@digikod.net&gt;
Link: https://lore.kernel.org/r/20241212174223.389435-8-mic@digikod.net
Signed-off-by: Kees Cook &lt;kees@kernel.org&gt;
</content>
</entry>
</feed>
