Re: [PATCH] Revert: audit: Fix check of return value of strnlen_user()

From: Steven Rostedt
Date: Wed Jul 08 2015 - 12:00:01 EST


On Wed, 8 Jul 2015 08:53:34 -0700
Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:

> Anyway, to make a long rant more on-point, does this alternative
> version work for you?

I'll test it again, even though I already did (see below).

>
> diff --git a/kernel/auditsc.c b/kernel/auditsc.c
> index 09c65640cad6..e85bdfd15fed 100644
> --- a/kernel/auditsc.c
> +++ b/kernel/auditsc.c
> @@ -1021,8 +1021,7 @@ static int audit_log_single_execve_arg(
> * for strings that are too long, we should not have created
> * any.
> */
> - if (unlikely((len == 0) || len > MAX_ARG_STRLEN - 1)) {
> - WARN_ON(1);
> + if (WARN_ON_ONCE(len < 0 || len > MAX_ARG_STRLEN - 1)) {
> send_sig(SIGKILL, current, 0);
> return -1;
> }
>
> because that really looks better to me.
>

That was what I originally did ;-) But then I figured I would just
revert the patch with a simple:

git show 0b08c5e59441d | patch -p1 -R

and submit that.

-- Steve
--
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/