mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Kees Cook <keescook@chromium.org>
Cc: linux-kernel@vger.kernel.org, Al Viro <viro@zeniv.linux.org.uk>,
	Eric Paris <eparis@redhat.com>
Subject: Re: [PATCH] audit: catch possible NULL audit buffers
Date: Mon, 19 Nov 2012 14:14:58 -0800	[thread overview]
Message-ID: <20121119141458.883e6535.akpm@linux-foundation.org> (raw)
In-Reply-To: <20121119220051.GA16851@www.outflux.net>

On Mon, 19 Nov 2012 14:00:51 -0800
Kees Cook <keescook@chromium.org> wrote:

> It's possible for audit_log_start() to return NULL. Handle it in the
> various callers.
> 
> ...
>
> --- a/kernel/audit.c
> +++ b/kernel/audit.c
> @@ -272,6 +272,8 @@ static int audit_log_config_change(char *function_name, int new, int old,
>  	int rc = 0;
>  
>  	ab = audit_log_start(NULL, GFP_KERNEL, AUDIT_CONFIG_CHANGE);
> +	if (unlikely(!ab))
> +		return rc;

Returning success here looks suspicious.  audit_do_config_change() will
fail to take its wtf-just-happened action (which
audit_log_config_change() duplicates, btw).

Meanwhile audit_receive_msg() is off living in a happy land where
nothing ever goes wrong.

>  	audit_log_format(ab, "%s=%d old=%d auid=%u ses=%u", function_name, new,
>  			 old, from_kuid(&init_user_ns, loginuid), sessionid);
>  	if (sid) {
> @@ -619,6 +621,8 @@ static int audit_log_common_recv_msg(struct audit_buffer **ab, u16 msg_type,
>  	}
>  
>  	*ab = audit_log_start(NULL, GFP_KERNEL, msg_type);
> +	if (unlikely(!*ab))
> +		return rc;

Also looks fishy.

>  	audit_log_format(*ab, "pid=%d uid=%u auid=%u ses=%u",
>  			 task_tgid_vnr(current),
>  			 from_kuid(&init_user_ns, current_uid()),
>
> ...
>

  reply	other threads:[~2012-11-19 22:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-19 22:00 Kees Cook
2012-11-19 22:14 ` Andrew Morton [this message]
2012-11-19 22:26   ` Kees Cook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20121119141458.883e6535.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=eparis@redhat.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®