All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] proc: fix -ESRCH error when writing to /proc/$pid/coredump_filter
@ 2015-12-11  1:04 Colin King
  2015-12-11 22:23 ` Kees Cook
  0 siblings, 1 reply; 2+ messages in thread
From: Colin King @ 2015-12-11  1:04 UTC (permalink / raw)
  To: Andrew Morton, Al Viro, Alexey Dobriyan, Kees Cook, Ingo Molnar,
	David Howells, Joe Perches, Eric W . Biederman, Calvin Owens
  Cc: linux-kernel

From: Colin Ian King <colin.king@canonical.com>

echo 0 > /proc/self/coredump_filter
bash: echo: write error: No such process

Writing to /proc/$pid/coredump_filter always returns -ESRCH because
commit 774636e19ed51 ("proc: convert to kstrto*()/kstrto*_from_user()")
removed the setting of ret after the get_proc_task call and incorrectly 
left it as -ESRCH.  Instead, return 0 when successful.

Fixes: 774636e19ed51 ("proc: convert to kstrto*()/kstrto*_from_user()")
Cc: <stable@vger.kernel.org> [v4.3+]
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 fs/proc/base.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/proc/base.c b/fs/proc/base.c
index bd3e9e6..4bd5d31 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -2494,6 +2494,7 @@ static ssize_t proc_coredump_filter_write(struct file *file,
 	mm = get_task_mm(task);
 	if (!mm)
 		goto out_no_mm;
+	ret = 0;
 
 	for (i = 0, mask = 1; i < MMF_DUMP_FILTER_BITS; i++, mask <<= 1) {
 		if (val & mask)
-- 
2.6.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] proc: fix -ESRCH error when writing to /proc/$pid/coredump_filter
  2015-12-11  1:04 [PATCH] proc: fix -ESRCH error when writing to /proc/$pid/coredump_filter Colin King
@ 2015-12-11 22:23 ` Kees Cook
  0 siblings, 0 replies; 2+ messages in thread
From: Kees Cook @ 2015-12-11 22:23 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Colin King, Alexey Dobriyan, Al Viro, Ingo Molnar, David Howells,
	Joe Perches, Eric W . Biederman, Calvin Owens, LKML

On Thu, Dec 10, 2015 at 5:04 PM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> echo 0 > /proc/self/coredump_filter
> bash: echo: write error: No such process
>
> Writing to /proc/$pid/coredump_filter always returns -ESRCH because
> commit 774636e19ed51 ("proc: convert to kstrto*()/kstrto*_from_user()")
> removed the setting of ret after the get_proc_task call and incorrectly
> left it as -ESRCH.  Instead, return 0 when successful.
>
> Fixes: 774636e19ed51 ("proc: convert to kstrto*()/kstrto*_from_user()")
> Cc: <stable@vger.kernel.org> [v4.3+]
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Thanks for catching that!

Acked-by: Kees Cook <keescook@chromium.org>

-Kees

> ---
>  fs/proc/base.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/fs/proc/base.c b/fs/proc/base.c
> index bd3e9e6..4bd5d31 100644
> --- a/fs/proc/base.c
> +++ b/fs/proc/base.c
> @@ -2494,6 +2494,7 @@ static ssize_t proc_coredump_filter_write(struct file *file,
>         mm = get_task_mm(task);
>         if (!mm)
>                 goto out_no_mm;
> +       ret = 0;
>
>         for (i = 0, mask = 1; i < MMF_DUMP_FILTER_BITS; i++, mask <<= 1) {
>                 if (val & mask)
> --
> 2.6.3
>



-- 
Kees Cook
Chrome OS & Brillo Security

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-12-11 22:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-11  1:04 [PATCH] proc: fix -ESRCH error when writing to /proc/$pid/coredump_filter Colin King
2015-12-11 22:23 ` Kees Cook

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.