All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: Mimi Zohar <zohar@linux.ibm.com>
Cc: Prakhar Srivastava <prsriva02@gmail.com>,
	linux-integrity@vger.kernel.org,
	linux-secuirty-module@vger.kernel.org,
	linux-kernel@vger.kernel.org, ebiederm@xmission.com,
	vgoyal@redhat.com, nayna@linux.ibm.com
Subject: Re: [PATCH v3 3/4] add kexec_cmdline used to ima
Date: Thu, 2 May 2019 17:58:36 +0100	[thread overview]
Message-ID: <20190502165836.GX23075@ZenIV.linux.org.uk> (raw)
In-Reply-To: <1556815955.4134.78.camel@linux.ibm.com>

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.

  reply	other threads:[~2019-05-02 16:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-29 21:47 [PATCH v3 0/4] Add a new ima_hook buffer_check to measure buffers critical for attestation Prakhar Srivastava
2019-04-29 21:47 ` [PATCH v3 1/4] added a new ima policy func buffer_check, and ima hook to measure the buffer hash into ima Prakhar Srivastava
2019-05-02 16:52   ` Mimi Zohar
2019-04-29 21:47 ` [PATCH v3 2/4] add the buffer to the xattr Prakhar Srivastava
2019-05-02 16:52   ` Mimi Zohar
2019-04-29 21:47 ` [PATCH v3 3/4] add kexec_cmdline used to ima Prakhar Srivastava
2019-05-02 16:52   ` Mimi Zohar
2019-05-02 16:58     ` Al Viro [this message]
2019-04-29 21:47 ` [PATCH v3 4/4] added LSM hook to call ima_buffer_check Prakhar Srivastava
2019-05-02 16:52   ` Mimi Zohar

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=20190502165836.GX23075@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=ebiederm@xmission.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-secuirty-module@vger.kernel.org \
    --cc=nayna@linux.ibm.com \
    --cc=prsriva02@gmail.com \
    --cc=vgoyal@redhat.com \
    --cc=zohar@linux.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.