From 43e3d29b9700a5d84c3d16d265849b011a267c12 Mon Sep 17 00:00:00 2001 From: Nicolas Lacasse Date: Wed, 4 Aug 2021 18:09:35 -0700 Subject: Implement PR_SET_CHILD_SUBREAPER when the calling task is PID 1. In this case, the task is already a subreaper, so setting this bit is a noop. Updates #2323 PiperOrigin-RevId: 388828034 --- test/syscalls/linux/prctl.cc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test/syscalls/linux') diff --git a/test/syscalls/linux/prctl.cc b/test/syscalls/linux/prctl.cc index 25b0e63d4..286b3d168 100644 --- a/test/syscalls/linux/prctl.cc +++ b/test/syscalls/linux/prctl.cc @@ -214,6 +214,12 @@ TEST(PrctlTest, RootDumpability) { SyscallFailsWithErrno(EINVAL)); } +TEST(PrctlTest, SetGetSubreaper) { + // Setting subreaper on PID 1 works vacuously because PID 1 is always a + // subreaper. + EXPECT_THAT(prctl(PR_SET_CHILD_SUBREAPER, 1), SyscallSucceeds()); +} + } // namespace } // namespace testing -- cgit v1.2.3