Skip to contentSkip to conversation

sparse multiple address spaces?

DISCUSSION Randy Dunlap 2 participants 4 messages Aug 19, 2020 Sparse checker

lore
Share & tools
lore
#0 lore raw

On Linux kernel tree v5.9-rc1, with sparse v0.6.2-180-g49f7e13a, I see this sparse warning which I don't grok:

../include/uapi/asm-generic/signal-defs.h:19:29: CK: error: multiple address spaces given

for this source code:

typedef void __signalfn_t(int);
typedef __signalfn_t __user *__sighandler_t; <<<<< line 19

Are there multiple address spaces there? What are they?

or: is the warning related to the other nearby warnings? (e.g.:)

../kernel/signal.c:541:53: CK: warning: incorrect type in initializer (different address spaces)
../kernel/signal.c:541:53: CK: expected struct k_sigaction *ka
../kernel/signal.c:541:53: CK: got struct k_sigaction [noderef] __rcu *
../include/uapi/asm-generic/signal-defs.h:19:29: CK: error: multiple address spaces given ../kernel/signal.c:694:33: CK: warning: incorrect type in argument 1 (different address spaces)
../kernel/signal.c:694:33: CK: expected struct spinlock [usertype] *lock
../kernel/signal.c:694:33: CK: got struct spinlock [noderef] __rcu *

thanks.

Signature · 1 line
~Randy
#1 lore raw
Quoted 16 lines · Randy Dunlap

On Linux kernel tree v5.9-rc1, with sparse v0.6.2-180-g49f7e13a, I see this sparse warning which I don't grok:

../include/uapi/asm-generic/signal-defs.h:19:29: CK: error: multiple address spaces given

for this source code:

typedef void __signalfn_t(int);
typedef __signalfn_t __user *__sighandler_t; <<<<< line 19

Are there multiple address spaces there? What are they?

or: is the warning related to the other nearby warnings? (e.g.:)

Quoted 7 lines

../kernel/signal.c:541:53: CK: warning: incorrect type in initializer (different address spaces)
../kernel/signal.c:541:53: CK: expected struct k_sigaction *ka
../kernel/signal.c:541:53: CK: got struct k_sigaction [noderef] __rcu *
../include/uapi/asm-generic/signal-defs.h:19:29: CK: error: multiple address spaces given ../kernel/signal.c:694:33: CK: warning: incorrect type in argument 1 (different address spaces)
../kernel/signal.c:694:33: CK: expected struct spinlock [usertype] *lock
../kernel/signal.c:694:33: CK: got struct spinlock [noderef] __rcu *

I would guess that this __sighandler_t is used somewhere in a struct which is itself accessed via a __rcu pointer. But that would not explain the level of dereference.

I'll need to check this one.

-- Luc

#2 lore raw
Quoted 25 lines · Luc Van Oostenryck
Quoted 16 lines · Randy Dunlap

On Linux kernel tree v5.9-rc1, with sparse v0.6.2-180-g49f7e13a, I see this sparse warning which I don't grok:

../include/uapi/asm-generic/signal-defs.h:19:29: CK: error: multiple address spaces given

for this source code:

typedef void __signalfn_t(int);
typedef __signalfn_t __user *__sighandler_t; <<<<< line 19

Are there multiple address spaces there? What are they?

or: is the warning related to the other nearby warnings? (e.g.:)

Quoted 7 lines

../kernel/signal.c:541:53: CK: warning: incorrect type in initializer (different address spaces)
../kernel/signal.c:541:53: CK: expected struct k_sigaction *ka
../kernel/signal.c:541:53: CK: got struct k_sigaction [noderef] __rcu *
../include/uapi/asm-generic/signal-defs.h:19:29: CK: error: multiple address spaces given ../kernel/signal.c:694:33: CK: warning: incorrect type in argument 1 (different address spaces)
../kernel/signal.c:694:33: CK: expected struct spinlock [usertype] *lock
../kernel/signal.c:694:33: CK: got struct spinlock [noderef] __rcu *

Quoted 5 lines

I would guess that this __sighandler_t is used somewhere in a struct which is itself accessed via a __rcu pointer. But that would not explain the level of dereference.

I'll need to check this one.

The location of the warning should be the assignment in kernel/signal.c:69

	static void __user *sig_handler(struct task_struct *t, int sig) 
	{
		return t->sighand->action[sig - 1].sa.sa_handler;
	}

There is a lot of type abuses in this file, between 'void __user *' and __sighandler_t, but the root cause of the warning is the '__rcu' in

	struct task_struct {
		...
		struct sighand_struct __rcu *sighand;
		...
	}

Best regards,
-- Luc

#3 lore raw
Quoted 39 lines · Luc Van Oostenryck
Quoted 25 lines · Luc Van Oostenryck
Quoted 16 lines · Randy Dunlap

On Linux kernel tree v5.9-rc1, with sparse v0.6.2-180-g49f7e13a, I see this sparse warning which I don't grok:

../include/uapi/asm-generic/signal-defs.h:19:29: CK: error: multiple address spaces given

for this source code:

typedef void __signalfn_t(int);
typedef __signalfn_t __user *__sighandler_t; <<<<< line 19

Are there multiple address spaces there? What are they?

or: is the warning related to the other nearby warnings? (e.g.:)

Quoted 7 lines

../kernel/signal.c:541:53: CK: warning: incorrect type in initializer (different address spaces)
../kernel/signal.c:541:53: CK: expected struct k_sigaction *ka
../kernel/signal.c:541:53: CK: got struct k_sigaction [noderef] __rcu *
../include/uapi/asm-generic/signal-defs.h:19:29: CK: error: multiple address spaces given ../kernel/signal.c:694:33: CK: warning: incorrect type in argument 1 (different address spaces)
../kernel/signal.c:694:33: CK: expected struct spinlock [usertype] *lock
../kernel/signal.c:694:33: CK: got struct spinlock [noderef] __rcu *

Quoted 5 lines

I would guess that this __sighandler_t is used somewhere in a struct which is itself accessed via a __rcu pointer. But that would not explain the level of dereference.

I'll need to check this one.

The location of the warning should be the assignment in kernel/signal.c:69

	static void __user *sig_handler(struct task_struct *t, int sig) 
	{
		return t->sighand->action[sig - 1].sa.sa_handler;
	}
Quoted 8 lines

There is a lot of type abuses in this file, between 'void __user *' and __sighandler_t, but the root cause of the warning is the '__rcu' in

	struct task_struct {
		...
		struct sighand_struct __rcu *sighand;
		...
	}

OK, thanks for all of your excavation work. :)

Signature · 1 line
~Randy