Re: [patch 1/4] add basic task isolation prctl interface

From: kernel test robot
Date: Sat Jul 31 2021 - 03:47:29 EST


Hi Marcelo,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v5.14-rc3]
[cannot apply to hnaz-linux-mm/master linux/master tip/sched/core tip/core/entry next-20210730]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/0day-ci/linux/commits/Marcelo-Tosatti/extensible-prctl-task-isolation-interface-and-vmstat-sync-v2/20210731-042348
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 4669e13cd67f8532be12815ed3d37e775a9bdc16
config: s390-randconfig-r012-20210730 (attached as .config)
compiler: s390-linux-gcc (GCC) 10.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/c4a772b2c4f14959c65758feac89b3cd0e00a915
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Marcelo-Tosatti/extensible-prctl-task-isolation-interface-and-vmstat-sync-v2/20210731-042348
git checkout c4a772b2c4f14959c65758feac89b3cd0e00a915
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross O=build_dir ARCH=s390 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

kernel/sys.c: In function '__do_sys_prctl':
>> kernel/sys.c:2571:2: error: duplicate case value
2571 | case PR_ISOL_FEAT:
| ^~~~
kernel/sys.c:2567:2: note: previously used here
2567 | case PR_SCHED_CORE:
| ^~~~


vim +2571 kernel/sys.c

2301
2302 SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3,
2303 unsigned long, arg4, unsigned long, arg5)
2304 {
2305 struct task_struct *me = current;
2306 unsigned char comm[sizeof(me->comm)];
2307 long error;
2308
2309 error = security_task_prctl(option, arg2, arg3, arg4, arg5);
2310 if (error != -ENOSYS)
2311 return error;
2312
2313 error = 0;
2314 switch (option) {
2315 case PR_SET_PDEATHSIG:
2316 if (!valid_signal(arg2)) {
2317 error = -EINVAL;
2318 break;
2319 }
2320 me->pdeath_signal = arg2;
2321 break;
2322 case PR_GET_PDEATHSIG:
2323 error = put_user(me->pdeath_signal, (int __user *)arg2);
2324 break;
2325 case PR_GET_DUMPABLE:
2326 error = get_dumpable(me->mm);
2327 break;
2328 case PR_SET_DUMPABLE:
2329 if (arg2 != SUID_DUMP_DISABLE && arg2 != SUID_DUMP_USER) {
2330 error = -EINVAL;
2331 break;
2332 }
2333 set_dumpable(me->mm, arg2);
2334 break;
2335
2336 case PR_SET_UNALIGN:
2337 error = SET_UNALIGN_CTL(me, arg2);
2338 break;
2339 case PR_GET_UNALIGN:
2340 error = GET_UNALIGN_CTL(me, arg2);
2341 break;
2342 case PR_SET_FPEMU:
2343 error = SET_FPEMU_CTL(me, arg2);
2344 break;
2345 case PR_GET_FPEMU:
2346 error = GET_FPEMU_CTL(me, arg2);
2347 break;
2348 case PR_SET_FPEXC:
2349 error = SET_FPEXC_CTL(me, arg2);
2350 break;
2351 case PR_GET_FPEXC:
2352 error = GET_FPEXC_CTL(me, arg2);
2353 break;
2354 case PR_GET_TIMING:
2355 error = PR_TIMING_STATISTICAL;
2356 break;
2357 case PR_SET_TIMING:
2358 if (arg2 != PR_TIMING_STATISTICAL)
2359 error = -EINVAL;
2360 break;
2361 case PR_SET_NAME:
2362 comm[sizeof(me->comm) - 1] = 0;
2363 if (strncpy_from_user(comm, (char __user *)arg2,
2364 sizeof(me->comm) - 1) < 0)
2365 return -EFAULT;
2366 set_task_comm(me, comm);
2367 proc_comm_connector(me);
2368 break;
2369 case PR_GET_NAME:
2370 get_task_comm(comm, me);
2371 if (copy_to_user((char __user *)arg2, comm, sizeof(comm)))
2372 return -EFAULT;
2373 break;
2374 case PR_GET_ENDIAN:
2375 error = GET_ENDIAN(me, arg2);
2376 break;
2377 case PR_SET_ENDIAN:
2378 error = SET_ENDIAN(me, arg2);
2379 break;
2380 case PR_GET_SECCOMP:
2381 error = prctl_get_seccomp();
2382 break;
2383 case PR_SET_SECCOMP:
2384 error = prctl_set_seccomp(arg2, (char __user *)arg3);
2385 break;
2386 case PR_GET_TSC:
2387 error = GET_TSC_CTL(arg2);
2388 break;
2389 case PR_SET_TSC:
2390 error = SET_TSC_CTL(arg2);
2391 break;
2392 case PR_TASK_PERF_EVENTS_DISABLE:
2393 error = perf_event_task_disable();
2394 break;
2395 case PR_TASK_PERF_EVENTS_ENABLE:
2396 error = perf_event_task_enable();
2397 break;
2398 case PR_GET_TIMERSLACK:
2399 if (current->timer_slack_ns > ULONG_MAX)
2400 error = ULONG_MAX;
2401 else
2402 error = current->timer_slack_ns;
2403 break;
2404 case PR_SET_TIMERSLACK:
2405 if (arg2 <= 0)
2406 current->timer_slack_ns =
2407 current->default_timer_slack_ns;
2408 else
2409 current->timer_slack_ns = arg2;
2410 break;
2411 case PR_MCE_KILL:
2412 if (arg4 | arg5)
2413 return -EINVAL;
2414 switch (arg2) {
2415 case PR_MCE_KILL_CLEAR:
2416 if (arg3 != 0)
2417 return -EINVAL;
2418 current->flags &= ~PF_MCE_PROCESS;
2419 break;
2420 case PR_MCE_KILL_SET:
2421 current->flags |= PF_MCE_PROCESS;
2422 if (arg3 == PR_MCE_KILL_EARLY)
2423 current->flags |= PF_MCE_EARLY;
2424 else if (arg3 == PR_MCE_KILL_LATE)
2425 current->flags &= ~PF_MCE_EARLY;
2426 else if (arg3 == PR_MCE_KILL_DEFAULT)
2427 current->flags &=
2428 ~(PF_MCE_EARLY|PF_MCE_PROCESS);
2429 else
2430 return -EINVAL;
2431 break;
2432 default:
2433 return -EINVAL;
2434 }
2435 break;
2436 case PR_MCE_KILL_GET:
2437 if (arg2 | arg3 | arg4 | arg5)
2438 return -EINVAL;
2439 if (current->flags & PF_MCE_PROCESS)
2440 error = (current->flags & PF_MCE_EARLY) ?
2441 PR_MCE_KILL_EARLY : PR_MCE_KILL_LATE;
2442 else
2443 error = PR_MCE_KILL_DEFAULT;
2444 break;
2445 case PR_SET_MM:
2446 error = prctl_set_mm(arg2, arg3, arg4, arg5);
2447 break;
2448 case PR_GET_TID_ADDRESS:
2449 error = prctl_get_tid_address(me, (int __user * __user *)arg2);
2450 break;
2451 case PR_SET_CHILD_SUBREAPER:
2452 me->signal->is_child_subreaper = !!arg2;
2453 if (!arg2)
2454 break;
2455
2456 walk_process_tree(me, propagate_has_child_subreaper, NULL);
2457 break;
2458 case PR_GET_CHILD_SUBREAPER:
2459 error = put_user(me->signal->is_child_subreaper,
2460 (int __user *)arg2);
2461 break;
2462 case PR_SET_NO_NEW_PRIVS:
2463 if (arg2 != 1 || arg3 || arg4 || arg5)
2464 return -EINVAL;
2465
2466 task_set_no_new_privs(current);
2467 break;
2468 case PR_GET_NO_NEW_PRIVS:
2469 if (arg2 || arg3 || arg4 || arg5)
2470 return -EINVAL;
2471 return task_no_new_privs(current) ? 1 : 0;
2472 case PR_GET_THP_DISABLE:
2473 if (arg2 || arg3 || arg4 || arg5)
2474 return -EINVAL;
2475 error = !!test_bit(MMF_DISABLE_THP, &me->mm->flags);
2476 break;
2477 case PR_SET_THP_DISABLE:
2478 if (arg3 || arg4 || arg5)
2479 return -EINVAL;
2480 if (mmap_write_lock_killable(me->mm))
2481 return -EINTR;
2482 if (arg2)
2483 set_bit(MMF_DISABLE_THP, &me->mm->flags);
2484 else
2485 clear_bit(MMF_DISABLE_THP, &me->mm->flags);
2486 mmap_write_unlock(me->mm);
2487 break;
2488 case PR_MPX_ENABLE_MANAGEMENT:
2489 case PR_MPX_DISABLE_MANAGEMENT:
2490 /* No longer implemented: */
2491 return -EINVAL;
2492 case PR_SET_FP_MODE:
2493 error = SET_FP_MODE(me, arg2);
2494 break;
2495 case PR_GET_FP_MODE:
2496 error = GET_FP_MODE(me);
2497 break;
2498 case PR_SVE_SET_VL:
2499 error = SVE_SET_VL(arg2);
2500 break;
2501 case PR_SVE_GET_VL:
2502 error = SVE_GET_VL();
2503 break;
2504 case PR_GET_SPECULATION_CTRL:
2505 if (arg3 || arg4 || arg5)
2506 return -EINVAL;
2507 error = arch_prctl_spec_ctrl_get(me, arg2);
2508 break;
2509 case PR_SET_SPECULATION_CTRL:
2510 if (arg4 || arg5)
2511 return -EINVAL;
2512 error = arch_prctl_spec_ctrl_set(me, arg2, arg3);
2513 break;
2514 case PR_PAC_RESET_KEYS:
2515 if (arg3 || arg4 || arg5)
2516 return -EINVAL;
2517 error = PAC_RESET_KEYS(me, arg2);
2518 break;
2519 case PR_PAC_SET_ENABLED_KEYS:
2520 if (arg4 || arg5)
2521 return -EINVAL;
2522 error = PAC_SET_ENABLED_KEYS(me, arg2, arg3);
2523 break;
2524 case PR_PAC_GET_ENABLED_KEYS:
2525 if (arg2 || arg3 || arg4 || arg5)
2526 return -EINVAL;
2527 error = PAC_GET_ENABLED_KEYS(me);
2528 break;
2529 case PR_SET_TAGGED_ADDR_CTRL:
2530 if (arg3 || arg4 || arg5)
2531 return -EINVAL;
2532 error = SET_TAGGED_ADDR_CTRL(arg2);
2533 break;
2534 case PR_GET_TAGGED_ADDR_CTRL:
2535 if (arg2 || arg3 || arg4 || arg5)
2536 return -EINVAL;
2537 error = GET_TAGGED_ADDR_CTRL();
2538 break;
2539 case PR_SET_IO_FLUSHER:
2540 if (!capable(CAP_SYS_RESOURCE))
2541 return -EPERM;
2542
2543 if (arg3 || arg4 || arg5)
2544 return -EINVAL;
2545
2546 if (arg2 == 1)
2547 current->flags |= PR_IO_FLUSHER;
2548 else if (!arg2)
2549 current->flags &= ~PR_IO_FLUSHER;
2550 else
2551 return -EINVAL;
2552 break;
2553 case PR_GET_IO_FLUSHER:
2554 if (!capable(CAP_SYS_RESOURCE))
2555 return -EPERM;
2556
2557 if (arg2 || arg3 || arg4 || arg5)
2558 return -EINVAL;
2559
2560 error = (current->flags & PR_IO_FLUSHER) == PR_IO_FLUSHER;
2561 break;
2562 case PR_SET_SYSCALL_USER_DISPATCH:
2563 error = set_syscall_user_dispatch(arg2, arg3, arg4,
2564 (char __user *) arg5);
2565 break;
2566 #ifdef CONFIG_SCHED_CORE
2567 case PR_SCHED_CORE:
2568 error = sched_core_share_pid(arg2, arg3, arg4, arg5);
2569 break;
2570 #endif
> 2571 case PR_ISOL_FEAT:
2572 error = prctl_task_isolation_feat(arg2, arg3, arg4, arg5);
2573 break;
2574 case PR_ISOL_GET:
2575 error = prctl_task_isolation_get(arg2, arg3, arg4, arg5);
2576 break;
2577 case PR_ISOL_SET:
2578 error = prctl_task_isolation_set(arg2, arg3, arg4, arg5);
2579 break;
2580 case PR_ISOL_CTRL_GET:
2581 error = prctl_task_isolation_ctrl_get(arg2, arg3, arg4, arg5);
2582 break;
2583 case PR_ISOL_CTRL_SET:
2584 error = prctl_task_isolation_ctrl_set(arg2, arg3, arg4, arg5);
2585 break;
2586 default:
2587 error = -EINVAL;
2588 break;
2589 }
2590 return error;
2591 }
2592

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip