kernel/livepatch/transition.c:372:44: sparse: sparse: incorrect type in argument 1 (different address spaces)

From: kernel test robot
Date: Sat Jul 25 2020 - 17:35:47 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 23ee3e4e5bd27bdbc0f1785eef7209ce872794c7
commit: 670d0a4b10704667765f7d18f7592993d02783aa sparse: use identifiers to define address spaces
date: 5 weeks ago
config: x86_64-randconfig-s021-20200726 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-14) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.2-93-g4c6cbe55-dirty
git checkout 670d0a4b10704667765f7d18f7592993d02783aa
# 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@xxxxxxxxx>


sparse warnings: (new ones prefixed by >>)

>> kernel/livepatch/transition.c:372:44: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@
kernel/livepatch/transition.c:372:44: sparse: expected struct spinlock [usertype] *lock
>> kernel/livepatch/transition.c:372:44: sparse: got struct spinlock [noderef] __rcu *
kernel/livepatch/transition.c:374:46: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@
kernel/livepatch/transition.c:374:46: sparse: expected struct spinlock [usertype] *lock
kernel/livepatch/transition.c:374:46: sparse: got struct spinlock [noderef] __rcu *
--
drivers/dma/idxd/submit.c: note: in included file (through include/linux/io.h, include/linux/pci.h):
>> arch/x86/include/asm/io.h:425:48: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected struct <noident> volatile *dst @@ got void [noderef] __iomem *__dst @@
arch/x86/include/asm/io.h:425:48: sparse: expected struct <noident> volatile *dst
>> arch/x86/include/asm/io.h:425:48: sparse: got void [noderef] __iomem *__dst

vim +372 kernel/livepatch/transition.c

d83a7cb375eec2 Josh Poimboeuf 2017-02-13 338
0b3d52790e1cfd Miroslav Benes 2019-01-15 339 /*
0b3d52790e1cfd Miroslav Benes 2019-01-15 340 * Sends a fake signal to all non-kthread tasks with TIF_PATCH_PENDING set.
0b3d52790e1cfd Miroslav Benes 2019-01-15 341 * Kthreads with TIF_PATCH_PENDING set are woken up.
0b3d52790e1cfd Miroslav Benes 2019-01-15 342 */
0b3d52790e1cfd Miroslav Benes 2019-01-15 343 static void klp_send_signals(void)
0b3d52790e1cfd Miroslav Benes 2019-01-15 344 {
0b3d52790e1cfd Miroslav Benes 2019-01-15 345 struct task_struct *g, *task;
0b3d52790e1cfd Miroslav Benes 2019-01-15 346
0b3d52790e1cfd Miroslav Benes 2019-01-15 347 if (klp_signals_cnt == SIGNALS_TIMEOUT)
0b3d52790e1cfd Miroslav Benes 2019-01-15 348 pr_notice("signaling remaining tasks\n");
0b3d52790e1cfd Miroslav Benes 2019-01-15 349
0b3d52790e1cfd Miroslav Benes 2019-01-15 350 read_lock(&tasklist_lock);
0b3d52790e1cfd Miroslav Benes 2019-01-15 351 for_each_process_thread(g, task) {
0b3d52790e1cfd Miroslav Benes 2019-01-15 352 if (!klp_patch_pending(task))
0b3d52790e1cfd Miroslav Benes 2019-01-15 353 continue;
0b3d52790e1cfd Miroslav Benes 2019-01-15 354
0b3d52790e1cfd Miroslav Benes 2019-01-15 355 /*
0b3d52790e1cfd Miroslav Benes 2019-01-15 356 * There is a small race here. We could see TIF_PATCH_PENDING
0b3d52790e1cfd Miroslav Benes 2019-01-15 357 * set and decide to wake up a kthread or send a fake signal.
0b3d52790e1cfd Miroslav Benes 2019-01-15 358 * Meanwhile the task could migrate itself and the action
0b3d52790e1cfd Miroslav Benes 2019-01-15 359 * would be meaningless. It is not serious though.
0b3d52790e1cfd Miroslav Benes 2019-01-15 360 */
0b3d52790e1cfd Miroslav Benes 2019-01-15 361 if (task->flags & PF_KTHREAD) {
0b3d52790e1cfd Miroslav Benes 2019-01-15 362 /*
0b3d52790e1cfd Miroslav Benes 2019-01-15 363 * Wake up a kthread which sleeps interruptedly and
0b3d52790e1cfd Miroslav Benes 2019-01-15 364 * still has not been migrated.
0b3d52790e1cfd Miroslav Benes 2019-01-15 365 */
0b3d52790e1cfd Miroslav Benes 2019-01-15 366 wake_up_state(task, TASK_INTERRUPTIBLE);
0b3d52790e1cfd Miroslav Benes 2019-01-15 367 } else {
0b3d52790e1cfd Miroslav Benes 2019-01-15 368 /*
0b3d52790e1cfd Miroslav Benes 2019-01-15 369 * Send fake signal to all non-kthread tasks which are
0b3d52790e1cfd Miroslav Benes 2019-01-15 370 * still not migrated.
0b3d52790e1cfd Miroslav Benes 2019-01-15 371 */
0b3d52790e1cfd Miroslav Benes 2019-01-15 @372 spin_lock_irq(&task->sighand->siglock);
0b3d52790e1cfd Miroslav Benes 2019-01-15 373 signal_wake_up(task, 0);
0b3d52790e1cfd Miroslav Benes 2019-01-15 374 spin_unlock_irq(&task->sighand->siglock);
0b3d52790e1cfd Miroslav Benes 2019-01-15 375 }
0b3d52790e1cfd Miroslav Benes 2019-01-15 376 }
0b3d52790e1cfd Miroslav Benes 2019-01-15 377 read_unlock(&tasklist_lock);
0b3d52790e1cfd Miroslav Benes 2019-01-15 378 }
0b3d52790e1cfd Miroslav Benes 2019-01-15 379

:::::: The code at line 372 was first introduced by commit
:::::: 0b3d52790e1cfd6b80b826a245d24859e89632f7 livepatch: Remove signal sysfs attribute

:::::: TO: Miroslav Benes <mbenes@xxxxxxx>
:::::: CC: Jiri Kosina <jkosina@xxxxxxx>

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

Attachment: .config.gz
Description: application/gzip