* [linux-next:master 10218/10296] vdso_test_getrandom.c:281:40: warning: | has lower precedence than ==; == will be evaluated first
@ 2024-09-08 2:20 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2024-09-08 2:20 UTC (permalink / raw)
To: Jason A. Donenfeld; +Cc: oe-kbuild-all, Linux Memory Management List
tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 9aaeb87ce1e966169a57f53a02ba05b30880ffb8
commit: 212857cd099510461127f40ae7dc21092d0c0dd1 [10218/10296] selftests: vDSO: ensure vgetrandom works in a time namespace
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240908/202409080600.YI5mIBVR-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/r/202409080600.YI5mIBVR-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> vdso_test_getrandom.c:281:40: warning: | has lower precedence than ==; == will be evaluated first [-Wparentheses]
281 | else if (WSTOPSIG(status) == SIGTRAP | 0x80) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
vdso_test_getrandom.c:281:40: note: place parentheses around the '==' expression to silence this warning
281 | else if (WSTOPSIG(status) == SIGTRAP | 0x80) {
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
vdso_test_getrandom.c:281:40: note: place parentheses around the | expression to evaluate it first
281 | else if (WSTOPSIG(status) == SIGTRAP | 0x80) {
| ~~~~~~~~^~~~~~
1 warning generated.
vim +281 tools/testing/selftests/vDSO/vdso_test_getrandom.c
4920a2590e91bc Jason A. Donenfeld 2024-07-07 241
4920a2590e91bc Jason A. Donenfeld 2024-07-07 242 static void kselftest(void)
4920a2590e91bc Jason A. Donenfeld 2024-07-07 243 {
4920a2590e91bc Jason A. Donenfeld 2024-07-07 244 uint8_t weird_size[1263];
212857cd099510 Jason A. Donenfeld 2024-09-05 245 pid_t child;
4920a2590e91bc Jason A. Donenfeld 2024-07-07 246
4920a2590e91bc Jason A. Donenfeld 2024-07-07 247 ksft_print_header();
212857cd099510 Jason A. Donenfeld 2024-09-05 248 ksft_set_plan(2);
4920a2590e91bc Jason A. Donenfeld 2024-07-07 249
4920a2590e91bc Jason A. Donenfeld 2024-07-07 250 for (size_t i = 0; i < 1000; ++i) {
4920a2590e91bc Jason A. Donenfeld 2024-07-07 251 ssize_t ret = vgetrandom(weird_size, sizeof(weird_size), 0);
4920a2590e91bc Jason A. Donenfeld 2024-07-07 252 if (ret != sizeof(weird_size))
4920a2590e91bc Jason A. Donenfeld 2024-07-07 253 exit(KSFT_FAIL);
4920a2590e91bc Jason A. Donenfeld 2024-07-07 254 }
4920a2590e91bc Jason A. Donenfeld 2024-07-07 255
4920a2590e91bc Jason A. Donenfeld 2024-07-07 256 ksft_test_result_pass("getrandom: PASS\n");
212857cd099510 Jason A. Donenfeld 2024-09-05 257
212857cd099510 Jason A. Donenfeld 2024-09-05 258 assert(unshare(CLONE_NEWUSER | CLONE_NEWTIME) == 0);
212857cd099510 Jason A. Donenfeld 2024-09-05 259 child = fork();
212857cd099510 Jason A. Donenfeld 2024-09-05 260 assert(child >= 0);
212857cd099510 Jason A. Donenfeld 2024-09-05 261 if (!child) {
212857cd099510 Jason A. Donenfeld 2024-09-05 262 vgetrandom_init();
212857cd099510 Jason A. Donenfeld 2024-09-05 263 child = getpid();
212857cd099510 Jason A. Donenfeld 2024-09-05 264 assert(ptrace(PTRACE_TRACEME, 0, NULL, NULL) == 0);
212857cd099510 Jason A. Donenfeld 2024-09-05 265 assert(kill(child, SIGSTOP) == 0);
212857cd099510 Jason A. Donenfeld 2024-09-05 266 assert(vgetrandom(weird_size, sizeof(weird_size), 0) == sizeof(weird_size));
212857cd099510 Jason A. Donenfeld 2024-09-05 267 _exit(0);
212857cd099510 Jason A. Donenfeld 2024-09-05 268 }
212857cd099510 Jason A. Donenfeld 2024-09-05 269 for (;;) {
212857cd099510 Jason A. Donenfeld 2024-09-05 270 struct ptrace_syscall_info info = { 0 };
212857cd099510 Jason A. Donenfeld 2024-09-05 271 int status, ret;
212857cd099510 Jason A. Donenfeld 2024-09-05 272 assert(waitpid(child, &status, 0) >= 0);
212857cd099510 Jason A. Donenfeld 2024-09-05 273 if (WIFEXITED(status)) {
212857cd099510 Jason A. Donenfeld 2024-09-05 274 if (WEXITSTATUS(status) != 0)
212857cd099510 Jason A. Donenfeld 2024-09-05 275 exit(KSFT_FAIL);
212857cd099510 Jason A. Donenfeld 2024-09-05 276 break;
212857cd099510 Jason A. Donenfeld 2024-09-05 277 }
212857cd099510 Jason A. Donenfeld 2024-09-05 278 assert(WIFSTOPPED(status));
212857cd099510 Jason A. Donenfeld 2024-09-05 279 if (WSTOPSIG(status) == SIGSTOP)
212857cd099510 Jason A. Donenfeld 2024-09-05 280 assert(ptrace(PTRACE_SETOPTIONS, child, 0, PTRACE_O_TRACESYSGOOD) == 0);
212857cd099510 Jason A. Donenfeld 2024-09-05 @281 else if (WSTOPSIG(status) == SIGTRAP | 0x80) {
212857cd099510 Jason A. Donenfeld 2024-09-05 282 assert(ptrace(PTRACE_GET_SYSCALL_INFO, child, sizeof(info), &info) > 0);
212857cd099510 Jason A. Donenfeld 2024-09-05 283 if (info.entry.nr == __NR_getrandom &&
212857cd099510 Jason A. Donenfeld 2024-09-05 284 (info.entry.args[0] == (uintptr_t)weird_size && info.entry.args[1] == sizeof(weird_size)))
212857cd099510 Jason A. Donenfeld 2024-09-05 285 exit(KSFT_FAIL);
212857cd099510 Jason A. Donenfeld 2024-09-05 286 }
212857cd099510 Jason A. Donenfeld 2024-09-05 287 assert(ptrace(PTRACE_SYSCALL, child, 0, 0) == 0);
212857cd099510 Jason A. Donenfeld 2024-09-05 288 }
212857cd099510 Jason A. Donenfeld 2024-09-05 289
212857cd099510 Jason A. Donenfeld 2024-09-05 290 ksft_test_result_pass("getrandom timens: PASS\n");
212857cd099510 Jason A. Donenfeld 2024-09-05 291
4920a2590e91bc Jason A. Donenfeld 2024-07-07 292 exit(KSFT_PASS);
4920a2590e91bc Jason A. Donenfeld 2024-07-07 293 }
4920a2590e91bc Jason A. Donenfeld 2024-07-07 294
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-09-08 2:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-08 2:20 [linux-next:master 10218/10296] vdso_test_getrandom.c:281:40: warning: | has lower precedence than ==; == will be evaluated first kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox