Hi "André,
[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on tip/locking/core]
[also build test WARNING on tip/x86/asm arm64/for-next/core tip/perf/core linus/master
v5.11]
[cannot apply to next-20210215]
[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/Andr-Almeida/Add-futex2-syscalls...
base:
https://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git
3765d01bab73bdb920ef711203978f02cd26e4da
config: x86_64-randconfig-s022-20210215 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.3-215-g0fb77bb6-dirty
#
https://github.com/0day-ci/linux/commit/d1b45b031c4017655fa7507e130260a54...
git remote add linux-review
https://github.com/0day-ci/linux
git fetch --no-tags linux-review Andr-Almeida/Add-futex2-syscalls/20210215-233004
git checkout d1b45b031c4017655fa7507e130260a5419e791b
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
"sparse warnings: (new ones prefixed by >>)"
kernel/futex2.c:107:21: sparse: sparse: symbol 'futex_table' was not declared.
Should it be static?
kernel/futex2.c:108:14: sparse: sparse: symbol 'futex2_hashsize' was not
declared. Should it be static?
kernel/futex2.c:354:13: sparse: sparse: incorrect type in argument 1 (different base
types) @@ expected void const volatile [noderef] __user *ptr @@ got unsigned long
[usertype] address @@
kernel/futex2.c:354:13: sparse: expected void const volatile [noderef] __user *ptr
kernel/futex2.c:354:13: sparse: got unsigned long [usertype] address
> kernel/futex2.c:513:51: sparse: sparse: incorrect type in
argument 1 (different address spaces) @@ expected void [noderef] __user *uaddr @@
got void * @@
kernel/futex2.c:513:51: sparse: expected void [noderef] __user
*uaddr
kernel/futex2.c:513:51: sparse: got void *
kernel/futex2.c:528:45: sparse: sparse: incorrect type in argument 2 (different address
spaces) @@ expected unsigned int [noderef] [usertype] __user *uaddr @@ got
unsigned int [usertype] *[assigned] uaddr @@
kernel/futex2.c:528:45: sparse: expected unsigned int [noderef] [usertype] __user
*uaddr
kernel/futex2.c:528:45: sparse: got unsigned int [usertype] *[assigned] uaddr
kernel/futex2.c:537:29: sparse: sparse: incorrect type in argument 1 (different address
spaces) @@ expected void const volatile [noderef] __user *ptr @@ got unsigned int
[usertype] *[assigned] uaddr @@
kernel/futex2.c:537:29: sparse: expected void const volatile [noderef] __user *ptr
kernel/futex2.c:537:29: sparse: got unsigned int [usertype] *[assigned] uaddr
vim +513 kernel/futex2.c
456
457 /**
458 * futex_enqueue - Check the value and enqueue a futex on a wait list
459 *
460 * @futexv: List of futexes
461 * @nr_futexes: Number of futexes in the list
462 * @awakened: If a futex was awakened during enqueueing, store the index here
463 *
464 * Get the value from the userspace address and compares with the expected one.
465 *
466 * Getting the value from user futex address:
467 *
468 * Since we are in a hurry, we use a spin lock and we can't sleep.
469 * Try to get the value with page fault disabled (when enable, we might
470 * sleep).
471 *
472 * If we fail, we aren't sure if the address is invalid or is just a
473 * page fault. Then, release the lock (so we can sleep) and try to get
474 * the value with page fault enabled. In order to trigger a page fault
475 * handling, we just call __get_user() again. If we sleep with enqueued
476 * futexes, we might miss a wake, so dequeue everything before sleeping.
477 *
478 * If get_user succeeds, this mean that the address is valid and we do
479 * the work again. Since we just handled the page fault, the page is
480 * likely pinned in memory and we should be luckier this time and be
481 * able to get the value. If we fail anyway, we will try again.
482 *
483 * If even with page faults enabled we get and error, this means that
484 * the address is not valid and we return from the syscall.
485 *
486 * If we got an unexpected value or need to treat a page fault and realized that
487 * a futex was awakened, we can priority this and return success.
488 *
489 * In success, enqueue the futex in the correct bucket
490 *
491 * Return:
492 * * 1 - We were awake in the process and nothing is enqueued
493 * * 0 - Everything is enqueued and we are ready to sleep
494 * * 0< - Something went wrong, nothing is enqueued, return error code
495 */
496 static int futex_enqueue(struct futexv_head *futexv, unsigned int nr_futexes,
497 int *awakened)
498 {
499 int i, ret;
500 bool retry = false;
501 u32 uval, *uaddr, val;
502 struct futex_bucket *bucket;
503
504 retry:
505 set_current_state(TASK_INTERRUPTIBLE);
506
507 for (i = 0; i < nr_futexes; i++) {
508 uaddr = (u32 * __user)futexv->objects[i].uaddr;
509 val = (u32)futexv->objects[i].val;
510
511 if (is_object_shared && retry) {
512 struct futex_bucket *tmp =
513 futex_get_bucket((void *)uaddr,
514
&futexv->objects[i].key, true);
515 if (IS_ERR(tmp)) {
516 __set_current_state(TASK_RUNNING);
517 futex_dequeue_multiple(futexv, i);
518 return PTR_ERR(tmp);
519 }
520 futexv->objects[i].bucket = tmp;
521 }
522
523 bucket = futexv->objects[i].bucket;
524
525 bucket_inc_waiters(bucket);
526 spin_lock(&bucket->lock);
527
528 ret = futex_get_user(&uval, uaddr);
529
530 if (unlikely(ret)) {
531 spin_unlock(&bucket->lock);
532
533 bucket_dec_waiters(bucket);
534 __set_current_state(TASK_RUNNING);
535 *awakened = futex_dequeue_multiple(futexv, i);
536
537 if (__get_user(uval, uaddr))
538 return -EFAULT;
539
540 if (*awakened >= 0)
541 return 1;
542
543 retry = true;
544 goto retry;
545 }
546
547 if (uval != val) {
548 spin_unlock(&bucket->lock);
549
550 bucket_dec_waiters(bucket);
551 __set_current_state(TASK_RUNNING);
552 *awakened = futex_dequeue_multiple(futexv, i);
553
554 if (*awakened >= 0)
555 return 1;
556
557 return -EAGAIN;
558 }
559
560 list_add_tail(&futexv->objects[i].list, &bucket->list);
561 spin_unlock(&bucket->lock);
562 }
563
564 return 0;
565 }
566
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org