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

2020-07-25 Thread kernel test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   23ee3e4e5bd27bdbc0f1785eef7209ce872794c7
commit: 913292c97d750fe4188b4f5aa770e5e0ca1e5a91 sched.h: Annotate 
sighand_struct with __rcu
date:   6 months 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 913292c97d750fe4188b4f5aa770e5e0ca1e5a91
# 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 


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]  * @@
>> kernel/livepatch/transition.c:372:44: sparse: expected struct spinlock 
>> [usertype] *lock
>> kernel/livepatch/transition.c:372:44: sparse: got struct spinlock 
>> [noderef]  *
   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]  * @@
   kernel/livepatch/transition.c:374:46: sparse: expected struct spinlock 
[usertype] *lock
   kernel/livepatch/transition.c:374:46: sparse: got struct spinlock 
[noderef]  *

vim +372 kernel/livepatch/transition.c

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

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

2020-07-25 Thread kernel test robot
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 


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  
>> volatile *dst @@ got void [noderef] __iomem *__dst @@
   arch/x86/include/asm/io.h:425:48: sparse: expected struct  
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(_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-1

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

2020-05-28 Thread kbuild test robot
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   b0c3ba31be3e45a130e13b278cf3b90f69bda6f6
commit: 913292c97d750fe4188b4f5aa770e5e0ca1e5a91 sched.h: Annotate 
sighand_struct with __rcu
date:   4 months ago
config: x86_64-randconfig-s022-20200528 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-240-gf0fe1cd9-dirty
git checkout 913292c97d750fe4188b4f5aa770e5e0ca1e5a91
# save the attached .config to linux build tree
make W=1 C=1 ARCH=x86_64 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot 


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]  * @@
   kernel/livepatch/transition.c:372:44: sparse: expected struct spinlock 
[usertype] *lock
   kernel/livepatch/transition.c:372:44: sparse: got struct spinlock 
[noderef]  *
   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]  * @@
   kernel/livepatch/transition.c:374:46: sparse: expected struct spinlock 
[usertype] *lock
   kernel/livepatch/transition.c:374:46: sparse: got struct spinlock 
[noderef]  *

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(_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(>sighand->siglock);
0b3d52790e1cfd Miroslav Benes 2019-01-15  373   
signal_wake_up(task, 0);
0b3d52790e1cfd Miroslav Benes 2019-01-15  374   
spin_unlock_irq(>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(_lock);
0b3d52790e1cfd Miroslav Benes 2019-01-15  378  }
0b3d52790e1cfd Miroslav Benes 2019-01-15  379  

: