Commit 249c62c8 authored by Isaac J. Manjarres's avatar Isaac J. Manjarres Committed by Android Build Cherrypicker Worker
Browse files

FROMGIT: selftests/memfd: run sysctl tests when PID namespace support is enabled

The sysctl tests for vm.memfd_noexec rely on the kernel to support PID
namespaces (i.e.  the kernel is built with CONFIG_PID_NS=y).  If the
kernel the test runs on does not support PID namespaces, the first sysctl
test will fail when attempting to spawn a new thread in a new PID
namespace, abort the test, preventing the remaining tests from being run.

This is not desirable, as not all kernels need PID namespaces, but can
still use the other features provided by memfd.  Therefore, only run the
sysctl tests if the kernel supports PID namespaces.  Otherwise, skip those
tests and emit an informative message to let the user know why the sysctl
tests are not being run.

Link: https://lkml.kernel.org/r/20241205192943.3228757-1-isaacmanjarres@google.com


Fixes: 11f75a01 ("selftests/memfd: add tests for MFD_NOEXEC_SEAL MFD_EXEC")
Signed-off-by: default avatarIsaac J. Manjarres <isaacmanjarres@google.com>
Reviewed-by: default avatarJeff Xu <jeffxu@google.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Kalesh Singh <kaleshsingh@google.com>
Cc: <stable@vger.kernel.org>	[6.6+]
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Bug: 382547417
(cherry picked from commit e6b9e2406b35a2d6ecfe6ceebf802852f61d009e
 https://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm.git

 mm-unstable)
Signed-off-by: default avatarIsaac J. Manjarres <isaacmanjarres@google.com>
(cherry picked from https://android-review.googlesource.com/q/commit:40f47bcbcfa2178e66852127ae5a886fde6e3c9d)
Merged-In: I47df75be139a3e3270058f897da85789fb85e522
Change-Id: I47df75be139a3e3270058f897da85789fb85e522
parent 2e4c58e0
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment