Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1289037 > unrolled thread

[PATCH] proc: fix -ESRCH error when writing to /proc/$pid/coredump_filter

Started byColin King <colin.king@canonical.com>
First post2015-12-11 02:10 +0100
Last post2015-12-11 23:30 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] proc: fix -ESRCH error when writing to /proc/$pid/coredump_filter Colin King <colin.king@canonical.com> - 2015-12-11 02:10 +0100
    Re: [PATCH] proc: fix -ESRCH error when writing to /proc/$pid/coredump_filter Kees Cook <keescook@chromium.org> - 2015-12-11 23:30 +0100

#1289037 — [PATCH] proc: fix -ESRCH error when writing to /proc/$pid/coredump_filter

FromColin King <colin.king@canonical.com>
Date2015-12-11 02:10 +0100
Subject[PATCH] proc: fix -ESRCH error when writing to /proc/$pid/coredump_filter
Message-ID<qEknE-5Bz-9@gated-at.bofh.it>
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1289962

FromKees Cook <keescook@chromium.org>
Date2015-12-11 23:30 +0100
Message-ID<qEEmm-21X-19@gated-at.bofh.it>
In reply to#1289037
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web