lkml.org 
[lkml]   [2019]   [May]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 3/4] add kexec_cmdline used to ima
On Thu, May 02, 2019 at 12:52:35PM -0400, Mimi Zohar wrote:
> On Mon, 2019-04-29 at 14:47 -0700, Prakhar Srivastava wrote:
> > From: Prakhar Srivastava <prsriva02@gmail.com>

> kexec doesn't really know or care about IMA.  Other than the IMA call,
> itself, nothing should be added to kexec files.  As mentioned in 1/4,
> the IMA hook would be named something like ima_kexec_cmdline().

> > + f = fdget(kernel_fd);
> > + if (!f.file)
> > + goto out;
> > +
> > + size = (f.file->f_path.dentry->d_name.len + cmdline_len - 1+
> > + ARRAY_SIZE(delimiter)) - 1;
> > +
> > + buf = kzalloc(size, GFP_KERNEL);
> > + if (!buf)
> > + goto out;
> > +
> > + memcpy(buf, f.file->f_path.dentry->d_name.name,
> > + f.file->f_path.dentry->d_name.len);
> > + memcpy(buf + f.file->f_path.dentry->d_name.len,
> > + delimiter, ARRAY_SIZE(delimiter) - 1);
> > + memcpy(buf + f.file->f_path.dentry->d_name.len +
> > + ARRAY_SIZE(delimiter) - 1,
> > + cmdline_ptr, cmdline_len - 1);

Another thing is that it's so obviously racy, it's not even funny.
Consider what rename(2) in parallel will do to that.

\
 
 \ /
  Last update: 2019-05-02 18:59    [W:0.853 / U:1.288 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site