Linux-Integrity Archive on lore.kernel.org
 help / color / Atom feed
From: Lakshmi Ramasubramanian <nramas@linux.microsoft.com>
To: Dmitry Vyukov <dvyukov@google.com>, Mimi Zohar <zohar@linux.ibm.com>
Cc: syzbot <syzbot+a4a503d7f37292ae1664@syzkaller.appspotmail.com>,
	Dmitry Kasatkin <dmitry.kasatkin@gmail.com>,
	James Morris <jmorris@namei.org>,
	linux-integrity@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>,
	linux-security-module <linux-security-module@vger.kernel.org>,
	"Serge E. Hallyn" <serge@hallyn.com>,
	syzkaller-bugs <syzkaller-bugs@googlegroups.com>
Subject: Re: inconsistent lock state in ima_process_queued_keys
Date: Tue, 14 Jan 2020 08:54:32 -0800
Message-ID: <c98a54b7-ffc1-2ea5-5527-b0c7e381b613@linux.microsoft.com> (raw)
In-Reply-To: <CACT4Y+bgQVmibpeJgpwb_JTKW6jx3dzv0M-NGVat8qvJTo4X7A@mail.gmail.com>

I am investigating this.

thanks,
  -lakshmi

On 1/14/2020 7:21 AM, Dmitry Vyukov wrote:
> On Tue, Jan 14, 2020 at 3:57 PM Mimi Zohar <zohar@linux.ibm.com> wrote:
>>
>> On Tue, 2020-01-14 at 14:58 +0100, Dmitry Vyukov wrote:
>>> On Tue, Jan 14, 2020 at 2:56 PM syzbot
>>> <syzbot+a4a503d7f37292ae1664@syzkaller.appspotmail.com> wrote:
>>>>
>>>> Hello,
>>>>
>>>> syzbot found the following crash on:
>>>>
>>>> HEAD commit:    1b851f98 Add linux-next specific files for 20200114
>>>> git tree:       linux-next
>>>> console output: https://syzkaller.appspot.com/x/log.txt?x=12bcbb25e00000
>>>> kernel config:  https://syzkaller.appspot.com/x/.config?x=3e7d9cf7ebfa08ad
>>>> dashboard link: https://syzkaller.appspot.com/bug?extid=a4a503d7f37292ae1664
>>>> compiler:       gcc (GCC) 9.0.0 20181231 (experimental)
>>>>
>>>> Unfortunately, I don't have any reproducer for this crash yet.
>>>>
>>>> IMPORTANT: if you fix the bug, please add the following tag to the commit:
>>>> Reported-by: syzbot+a4a503d7f37292ae1664@syzkaller.appspotmail.com
>>>
>>> +Lakshmi, you seem to have submitted a number of changes to this file recently.
>>>
>>> This completely breaks linux-next testing for us, every kernel crashes
>>> a few minutes after boot.
>>>
>>> 2020/01/14 14:45:00 vm-26: crash: inconsistent lock state in
>>> ima_process_queued_keys
>>
>> Yikes!  Are you running with an IMA policy?
> 
> I don't know.
> 
>>   I assume this is being
>> caused by commit 8f5d2d06f217 ("IMA: Defined timer to free queued
>> keys".  Does reverting it prevent this from happening?
> 
> The following seems to help, but don't know if it's the right fix or not.
> 
> diff --git a/security/integrity/ima/ima_asymmetric_keys.c
> b/security/integrity/ima/ima_asymmetric_keys.c
> index 61e478f9e8199..49d559501fe62 100644
> --- a/security/integrity/ima/ima_asymmetric_keys.c
> +++ b/security/integrity/ima/ima_asymmetric_keys.c
> @@ -103,17 +103,18 @@ static bool ima_queue_key(struct key *keyring,
> const void *payload,
>   {
>          bool queued = false;
>          struct ima_key_entry *entry;
> +       unsigned long flags;
> 
>          entry = ima_alloc_key_entry(keyring, payload, payload_len);
>          if (!entry)
>                  return false;
> 
> -       spin_lock(&ima_keys_lock);
> +       spin_lock_irqsave(&ima_keys_lock, flags);
>          if (!ima_process_keys) {
>                  list_add_tail(&entry->list, &ima_keys);
>                  queued = true;
>          }
> -       spin_unlock(&ima_keys_lock);
> +       spin_unlock_irqrestore(&ima_keys_lock, flags);
> 
>          if (!queued)
>                  ima_free_key_entry(entry);
> 

  reply index

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-14 13:56 syzbot
2020-01-14 13:58 ` Dmitry Vyukov
2020-01-14 14:56   ` Mimi Zohar
2020-01-14 15:21     ` Dmitry Vyukov
2020-01-14 16:54       ` Lakshmi Ramasubramanian [this message]
2020-01-14 17:19       ` Lakshmi Ramasubramanian
2020-01-18  3:14 ` syzbot
2020-01-18  5:22   ` Lakshmi Ramasubramanian

Reply instructions:

You may reply publically 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=c98a54b7-ffc1-2ea5-5527-b0c7e381b613@linux.microsoft.com \
    --to=nramas@linux.microsoft.com \
    --cc=dmitry.kasatkin@gmail.com \
    --cc=dvyukov@google.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=serge@hallyn.com \
    --cc=syzbot+a4a503d7f37292ae1664@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.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

Linux-Integrity Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-integrity/0 linux-integrity/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-integrity linux-integrity/ https://lore.kernel.org/linux-integrity \
		linux-integrity@vger.kernel.org
	public-inbox-index linux-integrity

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-integrity


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git