[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <A8856C6323EFE0459533E910625AB9303DC9C7@Exchange10.columbia.tresys.com>
Date: Mon, 6 Jan 2014 17:26:15 +0000
From: William Roberts <WRoberts@...sys.com>
To: Mateusz Guzik <mguzik@...hat.com>,
William Roberts <bill.c.roberts@...il.com>
CC: "linux-audit@...hat.com" <linux-audit@...hat.com>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"rgb@...hat.com" <rgb@...hat.com>,
"viro@...iv.linux.org.uk" <viro@...iv.linux.org.uk>,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"sds@...ho.nsa.gov" <sds@...ho.nsa.gov>
Subject: RE: [RFC][PATCH 3/3] audit: Audit proc cmdline value
-----Original Message-----
From: Mateusz Guzik [mailto:mguzik@...hat.com]
Sent: Monday, January 06, 2014 9:09 AM
To: William Roberts
Cc: linux-audit@...hat.com; linux-mm@...ck.org; linux-kernel@...r.kernel.org; rgb@...hat.com; viro@...iv.linux.org.uk; akpm@...ux-foundation.org; sds@...ho.nsa.gov; William Roberts
Subject: Re: [RFC][PATCH 3/3] audit: Audit proc cmdline value
I can't comment on the concept, but have one nit.
On Mon, Jan 06, 2014 at 07:30:30AM -0800, William Roberts wrote:
> +static void audit_log_cmdline(struct audit_buffer *ab, struct task_struct *tsk,
> + struct audit_context *context)
> +{
> + int res;
> + char *buf;
> + char *msg = "(null)";
> + audit_log_format(ab, " cmdline=");
> +
> + /* Not cached */
> + if (!context->cmdline) {
> + buf = kmalloc(PATH_MAX, GFP_KERNEL);
> + if (!buf)
> + goto out;
> + res = get_cmdline(tsk, buf, PATH_MAX);
> + /* Ensure NULL terminated */
> + if (buf[res-1] != '\0')
> + buf[res-1] = '\0';
This accesses memory below the buffer if get_cmdline returned 0, which I believe will be the case when someone jokingly unmaps the area (all maybe when it is swapped out but can't be swapped in due to I/O errors).
[William Roberts]
Sorry for the weird inline posting (Thanks MS Outlook of doom). Anyways, this isn’t a nit. This is a major issue that should be dealt with. Thanks.
Also since you are just putting 0 in there anyway I don't see much point in testing for it.
> + context->cmdline = buf;
> + }
> + msg = context->cmdline;
> +out:
> + audit_log_untrustedstring(ab, msg);
> +}
> +
--
Mateusz Guzik
Powered by blists - more mailing lists