Skip to contentSkip to conversation

signal: Add missing __user annotation to copy_siginfo_from_user_any

PATCH In review Jann Horn 2 participants 2 messages Dec 7, 2020

lore
Share & tools
lore

Jann Horn

author
#0 lore raw

PATCH 1/1 signal: Add missing __user annotation to copy_siginfo_from_user_any

copy_siginfo_from_user_any() takes a userspace pointer as second argument; annotate the parameter type accordingly.

---
I'm messing around with clang's version of __user annotation checking and it spotted this issue:

kernel/signal.c:3759:44: warning: casting to dereferenceable pointer removes 'noderef' attribute [-Wnoderef]

                ret = copy_siginfo_from_user_any(&kinfo, info);
                                                         ^~~~

Untracked cast to function pointer at kernel/signal.c:4294:26

Christian, since this is pidfd code, can you take this through your tree? Or should I send this to akpm (or someone else)?

 kernel/signal.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
kernel/signal.c +2 -1
index ef8f2a28d37c..4693191dc17c 100644
@@ -3685,7 +3685,8 @@ static bool access_pidfd_pidns(struct pid *pid)
 	return true;
 }
 
-static int copy_siginfo_from_user_any(kernel_siginfo_t *kinfo, siginfo_t *info)
+static int copy_siginfo_from_user_any(kernel_siginfo_t *kinfo,
+		siginfo_t __user *info)
 {
 #ifdef CONFIG_COMPAT
 	/*

base-commit: 0477e92881850d44910a7e94fc2c46f96faa131f

Signature · 1 line
2.29.2.576.ga3fc446d84-goog
#1 lore raw
Quoted 8 lines · Jann Horn

copy_siginfo_from_user_any() takes a userspace pointer as second argument; annotate the parameter type accordingly.

---
I'm messing around with clang's version of __user annotation checking and it spotted this issue:

Quoted 8 lines

kernel/signal.c:3759:44: warning: casting to dereferenceable pointer removes 'noderef' attribute [-Wnoderef]

                ret = copy_siginfo_from_user_any(&kinfo, info);
                                                         ^~~~

Untracked cast to function pointer at kernel/signal.c:4294:26

Christian, since this is pidfd code, can you take this through your tree? Or should I send this to akpm (or someone else)?

I'm picking it up now. :) Thanks!

Christian