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

From: Kees Cook
Date: Fri Dec 11 2015 - 17:23:31 EST


On Thu, Dec 10, 2015 at 5:04 PM, Colin King <colin.king@xxxxxxxxxxxxx> wrote:
> From: Colin Ian King <colin.king@xxxxxxxxxxxxx>
>
> 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@xxxxxxxxxxxxxxx> [v4.3+]
> Signed-off-by: Colin Ian King <colin.king@xxxxxxxxxxxxx>

Thanks for catching that!

Acked-by: Kees Cook <keescook@xxxxxxxxxxxx>

-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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/