Re: [RFC][PATCH 3/3] audit: Audit proc cmdline value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 6, 2014 at 9:08 AM, Mateusz Guzik <mguzik@xxxxxxxxxx> 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@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]