2022-10-05 14:34:29

by Yujie Liu

[permalink] [raw]
Subject: [sysctl] 7608b6a72e: kernel-selftests.mqueue.mq_open_tests.fail

Greeting,

FYI, we noticed the following commit (built with gcc-11):

commit: 7608b6a72ed04607cc832248cbd52fb5e68bd42c ("sysctl: Allow to change limits for posix messages queues")
https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git master

in testcase: kernel-selftests
version: kernel-selftests-x86_64-700a8991-1_20220823
with following parameters:

group: group-02

test-description: The kernel contains a set of "self tests" under the tools/testing/selftests/ directory. These are intended to be small unit tests to exercise individual code paths in the kernel.
test-url: https://www.kernel.org/doc/Documentation/kselftest.txt

on test machine: 4 threads Intel(R) Xeon(R) CPU E3-1225 v5 @ 3.30GHz (Skylake) with 16G memory

caused below changes (please refer to attached dmesg/kmsg for entire log/backtrace):


2022-10-04 04:47:26 make -C mqueue
make: Entering directory '/usr/src/perf_selftests-x86_64-rhel-8.3-kselftests-7608b6a72ed04607cc832248cbd52fb5e68bd42c/tools/testing/selftests/mqueue'
gcc -O2 mq_open_tests.c -lrt -lpthread -lpopt -o /usr/src/perf_selftests-x86_64-rhel-8.3-kselftests-7608b6a72ed04607cc832248cbd52fb5e68bd42c/tools/testing/selftests/mqueue/mq_open_tests
gcc -O2 mq_perf_tests.c -lrt -lpthread -lpopt -o /usr/src/perf_selftests-x86_64-rhel-8.3-kselftests-7608b6a72ed04607cc832248cbd52fb5e68bd42c/tools/testing/selftests/mqueue/mq_perf_tests
make: Leaving directory '/usr/src/perf_selftests-x86_64-rhel-8.3-kselftests-7608b6a72ed04607cc832248cbd52fb5e68bd42c/tools/testing/selftests/mqueue'
2022-10-04 04:47:27 make quicktest=1 run_tests -C mqueue
make: Entering directory '/usr/src/perf_selftests-x86_64-rhel-8.3-kselftests-7608b6a72ed04607cc832248cbd52fb5e68bd42c/tools/testing/selftests/mqueue'
TAP version 13
1..2
# selftests: mqueue: mq_open_tests
# Using Default queue path - /test1
# ./mq_open_tests: Failed to open msg_max at 279: No such file or directory
not ok 1 selftests: mqueue: mq_open_tests # exit=2
# selftests: mqueue: mq_perf_tests
# ./mq_perf_tests: Failed to open msg_max at 643: Permission denied
not ok 2 selftests: mqueue: mq_perf_tests # exit=2


If you fix the issue, kindly add following tag
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/r/[email protected]


To reproduce:

git clone https://github.com/intel/lkp-tests.git
cd lkp-tests
sudo bin/lkp install job.yaml # job file is attached in this email
bin/lkp split-job --compatible job.yaml # generate the yaml file for lkp run
sudo bin/lkp run generated-yaml-file

# if come across any failure that blocks the test,
# please remove ~/.lkp and /lkp dir to run from a clean state.


--
0-DAY CI Kernel Test Service
https://01.org/lkp


Attachments:
(No filename) (2.79 kB)
config-6.0.0-rc7-00003-g7608b6a72ed0 (170.76 kB)
job-script (7.07 kB)
dmesg.xz (59.27 kB)
kernel-selftests (68.35 kB)
job.yaml (5.82 kB)
reproduce (1.30 kB)
Download all attachments

2022-10-05 17:46:27

by Alexey Gladkov

[permalink] [raw]
Subject: [PATCH] sysctl: Fix mq permission check

The kernel test robot found a typo that causes mq_permissions() to return a
useless value.

Reported-by: kernel test robot <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Fixes: 7608b6a72ed0 ("sysctl: Allow to change limits for posix messages queues")
Signed-off-by: Alexey Gladkov <[email protected]>
---
ipc/mq_sysctl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ipc/mq_sysctl.c b/ipc/mq_sysctl.c
index ff1054fbbacc..ce03930aced5 100644
--- a/ipc/mq_sysctl.c
+++ b/ipc/mq_sysctl.c
@@ -102,7 +102,7 @@ static int mq_permissions(struct ctl_table_header *head, struct ctl_table *table
if (uid_eq(current_euid(), ns_root_uid))
mode >>= 6;

- if (in_egroup_p(ns_root_gid))
+ else if (in_egroup_p(ns_root_gid))
mode >>= 3;

mode &= 7;
--
2.33.4