linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roberto Sassu <roberto.sassu@huaweicloud.com>
To: Jann Horn <jannh@google.com>,
	Christian Brauner <brauner@kernel.org>,
	 Mimi Zohar <zohar@linux.ibm.com>,
	Roberto Sassu <roberto.sassu@huawei.com>,
	Dmitry Kasatkin <dmitry.kasatkin@gmail.com>,
	Eric Snowberg <eric.snowberg@oracle.com>
Cc: Josef Bacik <josef@toxicpanda.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	amir73il@gmail.com,  linux-fsdevel@vger.kernel.org,
	viro@zeniv.linux.org.uk, jack@suse.cz,  david@fromorbit.com,
	hch@lst.de, linux-integrity@vger.kernel.org
Subject: Re: [PATCH] fs: don't block i_writecount during exec
Date: Thu, 05 Sep 2024 09:38:19 +0200	[thread overview]
Message-ID: <88d5a92379755413e1ec3c981d9a04e6796da110.camel@huaweicloud.com> (raw)
In-Reply-To: <CAG48ez2Vv8Z8nmn=mRwQ3_5azksszwoc+8UJgo3nh2uk-VwYXQ@mail.gmail.com>

On Wed, 2024-09-04 at 19:04 +0200, Jann Horn wrote:
> [necrothreading...]
> [+IMA folks]
> 
> On Fri, May 31, 2024 at 3:01 PM Christian Brauner <brauner@kernel.org> wrote:
> > Back in 2021 we already discussed removing deny_write_access() for
> > executables. Back then I was hesistant because I thought that this might
> > cause issues in userspace. But even back then I had started taking some
> > notes on what could potentially depend on this and I didn't come up with
> > a lot so I've changed my mind and I would like to try this.
> [snip]
> > Yes, someone in userspace could potentially be relying on this. It's not
> > completely out of the realm of possibility but let's find out if that's
> > actually the case and not guess.
> 
> FYI, ima_bprm_check() still has a comment that claims that executables
> use deny_write_access():
> 
> /**
>  * ima_bprm_check - based on policy, collect/store measurement.
>  * @bprm: contains the linux_binprm structure
>  *
>  * The OS protects against an executable file, already open for write,
>  * from being executed in deny_write_access() and an executable file,
>  * already open for execute, from being modified in get_write_access().
>  * So we can be certain that what we verify and measure here is actually
>  * what is being executed.
>  *
>  * On success return 0.  On integrity appraisal error, assuming the file
>  * is in policy and IMA-appraisal is in enforcing mode, return -EACCES.
>  */
> 
> But what actually happens in there is not so different from what
> happens in ima_file_mmap(), so I think probably the only change
> required here is to fix up the comment...

We need to do the violation check for the BPRM_CHECK IMA hook too:

	violation_check = ((func == FILE_CHECK || func == MMAP_CHECK
||
			    func == MMAP_CHECK_REQPROT) &&
			   (ima_policy_flag & IMA_MEASURE));

Roberto


  reply	other threads:[~2024-09-05  7:38 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-29 20:41 [PATCH][RFC] fs: add levels to inode write access Josef Bacik
2024-05-29 22:00 ` Jeff Layton
2024-05-30  1:14 ` Matthew Wilcox
2024-05-30 10:32 ` Christian Brauner
2024-05-30 12:57   ` Amir Goldstein
2024-05-30 14:58   ` Josef Bacik
2024-05-30 15:23   ` Christian Brauner
2024-05-30 15:49   ` Linus Torvalds
2024-05-31 10:02     ` Christian Brauner
2024-05-31 12:32       ` Christian Brauner
2024-05-31 13:01         ` [PATCH] fs: don't block i_writecount during exec Christian Brauner
2024-05-31 15:40           ` Linus Torvalds
2024-05-31 18:08             ` Jeff Layton
2024-05-31 22:08           ` Josef Bacik
2024-06-03 13:52           ` (subset) " Christian Brauner
2024-06-06 12:45           ` Aishwarya TCV
2024-06-06 15:37             ` Mark Brown
2024-06-06 16:53               ` Josef Bacik
2024-06-06 17:33                 ` Mark Brown
2024-06-06 17:49                   ` Mark Brown
2024-08-07  9:59                     ` Tudor Ambarus
2024-09-04 17:04           ` Jann Horn
2024-09-05  7:38             ` Roberto Sassu [this message]
2024-05-31 13:09         ` [PATCH][RFC] fs: add levels to inode write access Amir Goldstein
2024-05-31 14:50           ` Christian Brauner
2024-05-31 15:47             ` Matthew Wilcox
2024-05-31 22:14               ` Matthew Wilcox

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=88d5a92379755413e1ec3c981d9a04e6796da110.camel@huaweicloud.com \
    --to=roberto.sassu@huaweicloud.com \
    --cc=amir73il@gmail.com \
    --cc=brauner@kernel.org \
    --cc=david@fromorbit.com \
    --cc=dmitry.kasatkin@gmail.com \
    --cc=eric.snowberg@oracle.com \
    --cc=hch@lst.de \
    --cc=jack@suse.cz \
    --cc=jannh@google.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-integrity@vger.kernel.org \
    --cc=roberto.sassu@huawei.com \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).