From: Roberto Sassu <roberto.sassu@huaweicloud.com>
To: Paul Moore <paul@paul-moore.com>
Cc: zohar@linux.ibm.com, dmitry.kasatkin@gmail.com,
eric.snowberg@oracle.com, jmorris@namei.org, serge@hallyn.com,
linux-integrity@vger.kernel.org,
linux-security-module@vger.kernel.org,
linux-kernel@vger.kernel.org, bpf@vger.kernel.org,
ebpqwerty472123@gmail.com,
Roberto Sassu <roberto.sassu@huawei.com>
Subject: Re: [PATCH 1/3] ima: Remove inode lock
Date: Wed, 09 Oct 2024 18:25:45 +0200 [thread overview]
Message-ID: <7358f12d852964d9209492e337d33b8880234b74.camel@huaweicloud.com> (raw)
In-Reply-To: <CAHC9VhQR2JbB7ni2yX_U8TWE0PcQQkm_pBCuG3nYN7qO15nNjg@mail.gmail.com>
On Wed, 2024-10-09 at 11:37 -0400, Paul Moore wrote:
> On Wed, Oct 9, 2024 at 11:36 AM Paul Moore <paul@paul-moore.com> wrote:
> > On Tue, Oct 8, 2024 at 12:57 PM Roberto Sassu
> > <roberto.sassu@huaweicloud.com> wrote:
> > >
> > > From: Roberto Sassu <roberto.sassu@huawei.com>
> > >
> > > Move out the mutex in the ima_iint_cache structure to a new structure
> > > called ima_iint_cache_lock, so that a lock can be taken regardless of
> > > whether or not inode integrity metadata are stored in the inode.
> > >
> > > Introduce ima_inode_security() to simplify accessing the new structure in
> > > the inode security blob.
> > >
> > > Move the mutex initialization and annotation in the new function
> > > ima_inode_alloc_security() and introduce ima_iint_lock() and
> > > ima_iint_unlock() to respectively lock and unlock the mutex.
> > >
> > > Finally, expand the critical region in process_measurement() guarded by
> > > iint->mutex up to where the inode was locked, use only one iint lock in
> > > __ima_inode_hash(), since the mutex is now in the inode security blob, and
> > > replace the inode_lock()/inode_unlock() calls in ima_check_last_writer().
> > >
> > > Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
> > > ---
> > > security/integrity/ima/ima.h | 26 ++++++++---
> > > security/integrity/ima/ima_api.c | 4 +-
> > > security/integrity/ima/ima_iint.c | 77 ++++++++++++++++++++++++++-----
> > > security/integrity/ima/ima_main.c | 39 +++++++---------
> > > 4 files changed, 104 insertions(+), 42 deletions(-)
> >
> > I'm not an IMA expert, but it looks reasonable to me, although
> > shouldn't this carry a stable CC in the patch metadata?
> >
> > Reviewed-by: Paul Moore <paul@paul-moore.com>
>
> Sorry, one more thing ... did you verify this patchset resolves the
> syzbot problem? I saw at least one reproducer.
Uhm, could not reproduce the deadlock with the reproducer. However,
without the patch I have a lockdep warning, and with I don't.
I asked syzbot to try the patches. Let's see.
Thanks
Roberto
next prev parent reply other threads:[~2024-10-09 16:25 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-08 16:57 [PATCH 1/3] ima: Remove inode lock Roberto Sassu
2024-10-08 16:57 ` [PATCH 2/3] ima: Ensure lock is held when setting iint pointer in inode security blob Roberto Sassu
2024-10-09 15:41 ` Paul Moore
2024-10-09 15:43 ` Roberto Sassu
2024-10-11 19:30 ` Mimi Zohar
2024-10-14 11:45 ` Roberto Sassu
2024-10-16 13:08 ` Roberto Sassu
2024-10-08 16:57 ` [PATCH 3/3] ima: Mark concurrent accesses to the iint pointer in the " Roberto Sassu
2024-10-09 15:36 ` [PATCH 1/3] ima: Remove inode lock Paul Moore
2024-10-09 15:37 ` Paul Moore
2024-10-09 16:25 ` Roberto Sassu [this message]
2024-10-09 16:32 ` Roberto Sassu
2024-10-09 16:43 ` Roberto Sassu
2024-10-11 13:30 ` Roberto Sassu
2024-10-16 9:59 ` Roberto Sassu
2024-10-18 9:24 ` Roberto Sassu
2024-10-18 10:49 ` Kirill A. Shutemov
2024-10-18 10:52 ` Kirill A. Shutemov
2024-10-18 10:55 ` Kirill A. Shutemov
2024-10-18 11:00 ` Lorenzo Stoakes
2024-10-18 11:05 ` Kirill A. Shutemov
2024-10-18 11:22 ` Roberto Sassu
2024-10-18 11:54 ` Kirill A. Shutemov
2024-10-18 11:56 ` Roberto Sassu
2024-10-18 13:29 ` Roberto Sassu
2024-10-18 14:36 ` Jann Horn
2024-10-18 14:48 ` Lorenzo Stoakes
2024-10-09 16:24 ` Roberto Sassu
2024-10-09 15:59 ` Shu Han
2024-11-27 15:57 ` Roberto Sassu
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=7358f12d852964d9209492e337d33b8880234b74.camel@huaweicloud.com \
--to=roberto.sassu@huaweicloud.com \
--cc=bpf@vger.kernel.org \
--cc=dmitry.kasatkin@gmail.com \
--cc=ebpqwerty472123@gmail.com \
--cc=eric.snowberg@oracle.com \
--cc=jmorris@namei.org \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=paul@paul-moore.com \
--cc=roberto.sassu@huawei.com \
--cc=serge@hallyn.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 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).