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 <[email protected]>

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

Reply via email to