linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: William Roberts <bill.c.roberts@gmail.com>
To: Mateusz Guzik <mguzik@redhat.com>
Cc: "linux-audit@redhat.com" <linux-audit@redhat.com>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Richard Guy Briggs <rgb@redhat.com>,
	"viro@zeniv.linux.org.uk" <viro@zeniv.linux.org.uk>,
	akpm@linux-foundation.org, Stephen Smalley <sds@tycho.nsa.gov>,
	William Roberts <wroberts@tresys.com>
Subject: Re: [RFC][PATCH 3/3] audit: Audit proc cmdline value
Date: Mon, 6 Jan 2014 09:30:31 -0800	[thread overview]
Message-ID: <CAFftDdpoV9S5VO6Ozt3nOF+bnJDeomeOR5k8ri8eRBm3JrkXGQ@mail.gmail.com> (raw)
In-Reply-To: <20140106170855.GA1828@mguzik.redhat.com>

On Mon, Jan 6, 2014 at 9:08 AM, Mateusz Guzik <mguzik@redhat.com> wrote:
> I can't comment on the concept, but have one nit.

FYI: The concept is something that has been in the works and at least ackd on
by the current maintainer of audit:
http://marc.info/?l=linux-kernel&m=138660320704580&w=2

>
> 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).
>

Yeah that's not a nit, that's a serious issue and I will correct. 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



-- 
Respectfully,

William C Roberts

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2014-01-06 17:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-06 15:30 [RFC][PATCH 1/3] mm: Create utility function for accessing a tasks commandline value William Roberts
2014-01-06 15:30 ` [RFC][PATCH 2/3] proc: Update get proc_pid_cmdline() to use mm.h helpers William Roberts
2014-01-06 15:30 ` [RFC][PATCH 3/3] audit: Audit proc cmdline value William Roberts
2014-01-06 17:08   ` Mateusz Guzik
2014-01-06 17:26     ` William Roberts
2014-01-06 17:30     ` William Roberts [this message]
2014-01-14 22:45   ` Richard Guy Briggs
2014-01-15  0:50     ` William Roberts
2014-01-15  0:56       ` William Roberts
2014-01-15  3:44       ` Richard Guy Briggs
2014-01-15 12:40   ` Paul Davies C
  -- strict thread matches above, loose matches on Subject: below --
2013-12-23 21:01 [RFC][PATCH 1/3] mm: Create utility function for accessing a tasks commandline value William Roberts
2013-12-23 21:01 ` [RFC][PATCH 3/3] audit: Audit proc cmdline value William Roberts

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=CAFftDdpoV9S5VO6Ozt3nOF+bnJDeomeOR5k8ri8eRBm3JrkXGQ@mail.gmail.com \
    --to=bill.c.roberts@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-audit@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mguzik@redhat.com \
    --cc=rgb@redhat.com \
    --cc=sds@tycho.nsa.gov \
    --cc=viro@zeniv.linux.org.uk \
    --cc=wroberts@tresys.com \
    /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