* [PATCH] seccomp: Remove bogus __user annotations
@ 2020-11-20 1:59 Jann Horn
2020-11-20 15:35 ` Tyler Hicks
0 siblings, 1 reply; 3+ messages in thread
From: Jann Horn @ 2020-11-20 1:59 UTC (permalink / raw)
To: Kees Cook; +Cc: Andy Lutomirski, Will Drewry, linux-kernel, Tyler Hicks
Buffers that are passed to read_actions_logged() and write_actions_logged()
are in kernel memory; the sysctl core takes care of copying from/to
userspace.
Fixes: 0ddec0fc8900 ("seccomp: Sysctl to configure actions that are allowed to be logged")
Signed-off-by: Jann Horn <jannh@google.com>
---
kernel/seccomp.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/seccomp.c b/kernel/seccomp.c
index 8ad7a293255a..c2bff3561846 100644
--- a/kernel/seccomp.c
+++ b/kernel/seccomp.c
@@ -1968,7 +1968,7 @@ static bool seccomp_actions_logged_from_names(u32 *actions_logged, char *names)
return true;
}
-static int read_actions_logged(struct ctl_table *ro_table, void __user *buffer,
+static int read_actions_logged(struct ctl_table *ro_table, void *buffer,
size_t *lenp, loff_t *ppos)
{
char names[sizeof(seccomp_actions_avail)];
@@ -1986,7 +1986,7 @@ static int read_actions_logged(struct ctl_table *ro_table, void __user *buffer,
return proc_dostring(&table, 0, buffer, lenp, ppos);
}
-static int write_actions_logged(struct ctl_table *ro_table, void __user *buffer,
+static int write_actions_logged(struct ctl_table *ro_table, void *buffer,
size_t *lenp, loff_t *ppos, u32 *actions_logged)
{
char names[sizeof(seccomp_actions_avail)];
base-commit: 4d02da974ea85a62074efedf354e82778f910d82
--
2.29.2.454.gaff20da3a2-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] seccomp: Remove bogus __user annotations
2020-11-20 1:59 [PATCH] seccomp: Remove bogus __user annotations Jann Horn
@ 2020-11-20 15:35 ` Tyler Hicks
2020-11-20 15:45 ` Jann Horn
0 siblings, 1 reply; 3+ messages in thread
From: Tyler Hicks @ 2020-11-20 15:35 UTC (permalink / raw)
To: Jann Horn; +Cc: Kees Cook, Andy Lutomirski, Will Drewry, linux-kernel
Hey Jann - Thanks for cleaning this up!
On 2020-11-20 02:59:13, Jann Horn wrote:
> Buffers that are passed to read_actions_logged() and write_actions_logged()
> are in kernel memory; the sysctl core takes care of copying from/to
> userspace.
>
> Fixes: 0ddec0fc8900 ("seccomp: Sysctl to configure actions that are allowed to be logged")
After tracing back through the code, I was struggling to understand why
I thought the __user annotation was needed back then. It turns out that
__user was correct when I wrote 0ddec0fc8900 and that the Fixes tag
should be changed to this:
Fixes: 32927393dc1c ("sysctl: pass kernel pointers to ->proc_handler")
If you agree, please adjust and resubmit with:
Reviewed-by: Tyler Hicks <code@tyhicks.com>
Thank you!
Tyler
> Signed-off-by: Jann Horn <jannh@google.com>
> ---
> kernel/seccomp.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/seccomp.c b/kernel/seccomp.c
> index 8ad7a293255a..c2bff3561846 100644
> --- a/kernel/seccomp.c
> +++ b/kernel/seccomp.c
> @@ -1968,7 +1968,7 @@ static bool seccomp_actions_logged_from_names(u32 *actions_logged, char *names)
> return true;
> }
>
> -static int read_actions_logged(struct ctl_table *ro_table, void __user *buffer,
> +static int read_actions_logged(struct ctl_table *ro_table, void *buffer,
> size_t *lenp, loff_t *ppos)
> {
> char names[sizeof(seccomp_actions_avail)];
> @@ -1986,7 +1986,7 @@ static int read_actions_logged(struct ctl_table *ro_table, void __user *buffer,
> return proc_dostring(&table, 0, buffer, lenp, ppos);
> }
>
> -static int write_actions_logged(struct ctl_table *ro_table, void __user *buffer,
> +static int write_actions_logged(struct ctl_table *ro_table, void *buffer,
> size_t *lenp, loff_t *ppos, u32 *actions_logged)
> {
> char names[sizeof(seccomp_actions_avail)];
>
> base-commit: 4d02da974ea85a62074efedf354e82778f910d82
> --
> 2.29.2.454.gaff20da3a2-goog
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] seccomp: Remove bogus __user annotations
2020-11-20 15:35 ` Tyler Hicks
@ 2020-11-20 15:45 ` Jann Horn
0 siblings, 0 replies; 3+ messages in thread
From: Jann Horn @ 2020-11-20 15:45 UTC (permalink / raw)
To: Tyler Hicks; +Cc: Kees Cook, Andy Lutomirski, Will Drewry, kernel list
On Fri, Nov 20, 2020 at 4:36 PM Tyler Hicks <code@tyhicks.com> wrote:
> Hey Jann - Thanks for cleaning this up!
>
> On 2020-11-20 02:59:13, Jann Horn wrote:
> > Buffers that are passed to read_actions_logged() and write_actions_logged()
> > are in kernel memory; the sysctl core takes care of copying from/to
> > userspace.
> >
> > Fixes: 0ddec0fc8900 ("seccomp: Sysctl to configure actions that are allowed to be logged")
>
> After tracing back through the code, I was struggling to understand why
> I thought the __user annotation was needed back then. It turns out that
> __user was correct when I wrote 0ddec0fc8900 and that the Fixes tag
> should be changed to this:
>
> Fixes: 32927393dc1c ("sysctl: pass kernel pointers to ->proc_handler")
>
> If you agree, please adjust and resubmit with:
>
> Reviewed-by: Tyler Hicks <code@tyhicks.com>
>
> Thank you!
Aaaah, that makes sense. Thanks, will do.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-11-20 15:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-20 1:59 [PATCH] seccomp: Remove bogus __user annotations Jann Horn
2020-11-20 15:35 ` Tyler Hicks
2020-11-20 15:45 ` Jann Horn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).