Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp7756215ybl; Thu, 16 Jan 2020 05:12:21 -0800 (PST) X-Google-Smtp-Source: APXvYqyKsENhLL1nMDfds4Ibp9nlSoVraSWnC2HLv4KngYIWP7DT9YvnKyZ7xuCxuD2zDvDFemGs X-Received: by 2002:a05:6830:114f:: with SMTP id x15mr1819654otq.291.1579180341279; Thu, 16 Jan 2020 05:12:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579180341; cv=none; d=google.com; s=arc-20160816; b=YPf/SC3SfZDdDH5FyYScOb3uvsBkT5u3jyCeU3JSlvvU2vZPe3soWorX9om6H1BLGn Z3LVTWdR/Ir+NiaNT0AJ6ft2WJJv0bzwjX9UsaqcvXX6uuztU88qLg7UXQqI6HpQL5Q7 k2XIKv2s8qmaHeVcoXpCaQgaxHDXyHhsEIJXtDVTpR8G+yhiLhm7vndS8xTW+OInN4CY K6WRjWnmR0a6iufU/6LEbgO60nhzb0gMmCSuFpFWpm5uDMk7Iv6XfxE2OX4QVJI/D0OD ssJvDV1k8rOvx5TiaL4PckHvOrpOgWNYkYnyyhV1vSEsUnZ9DR1qkC4wQK2I89W73vCa /nGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:references:in-reply-to:date:cc:to:from:subject; bh=n1DKdqG8SUjazC+LJjTAx1VFHvHTJq9vegdp3DR1KE8=; b=rJYVzGJhT5MRnHGAmL4p+7Ytp4P2fa/66+hkbA/g/kB/UkAmoM9akLZjfsVPoUTW81 RuO/YCVl+/qVtybuDevP4MUsW6FfDbAXu4QHv4WyxtlXnaxswdlExTjh3VgPbHXESKre 0Cxm86hVcRTnUvKZmOlDIEd8IO0pr4yFU2xue9C0oTvPD4h1PQI4xWvKfHH6XlsZwLvg Uphs8DelC+Dw6Xb8Ha9KLine2YAkgL2EOSmv3nPJ1yWOlV9b/ZW/K9refCgURerNktVK oQ2FpLKf+NZpkT6hhltwsvyBB3rfJoKn3qOe8MwSBFta8wLIOqbhwCUQ4zSd9nlztuDK qFhw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r4si13247742otd.50.2020.01.16.05.12.08; Thu, 16 Jan 2020 05:12:21 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727029AbgAPNKm (ORCPT + 99 others); Thu, 16 Jan 2020 08:10:42 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:43522 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727012AbgAPNKm (ORCPT ); Thu, 16 Jan 2020 08:10:42 -0500 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 00GD73fM105048 for ; Thu, 16 Jan 2020 08:10:41 -0500 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2xhm35ns7e-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 16 Jan 2020 08:10:40 -0500 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 16 Jan 2020 13:10:38 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 16 Jan 2020 13:10:35 -0000 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 00GDAYc411272198 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Jan 2020 13:10:34 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6FDA9AE057; Thu, 16 Jan 2020 13:10:34 +0000 (GMT) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5C7BEAE06A; Thu, 16 Jan 2020 13:10:33 +0000 (GMT) Received: from localhost.localdomain (unknown [9.85.139.213]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 16 Jan 2020 13:10:33 +0000 (GMT) Subject: Re: [PATCH] IMA: inconsistent lock state in ima_process_queued_keys From: Mimi Zohar To: Lakshmi Ramasubramanian , dvyukov@google.com, James.Bottomley@HansenPartnership.com, arnd@arndb.de, linux-integrity@vger.kernel.org Cc: dhowells@redhat.com, sashal@kernel.org, linux-kernel@vger.kernel.org, keyrings@vger.kernel.org, linux-crypto@vger.kernel.org Date: Thu, 16 Jan 2020 08:10:32 -0500 In-Reply-To: <20200116031342.3418-1-nramas@linux.microsoft.com> References: <20200116031342.3418-1-nramas@linux.microsoft.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.20.5 (3.20.5-1.fc24) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 x-cbid: 20011613-0008-0000-0000-00000349E7B0 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20011613-0009-0000-0000-00004A6A416F Message-Id: <1579180232.5857.23.camel@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-01-16_04:2020-01-16,2020-01-15 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 phishscore=0 mlxlogscore=794 malwarescore=0 mlxscore=0 suspectscore=2 bulkscore=0 lowpriorityscore=0 impostorscore=0 priorityscore=1501 spamscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1910280000 definitions=main-2001160112 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2020-01-15 at 19:13 -0800, Lakshmi Ramasubramanian wrote: > ima_queued_keys() is called from a non-interrupt context, but > ima_process_queued_keys() may be called from both an interrupt > context (ima_timer_handler) and non-interrupt context > (ima_update_policy). Since the spinlock named ima_keys_lock is used > in both ima_queued_keys() and ima_process_queued_keys(), > irq version of the spinlock macros, spin_lock_irqsave() and > spin_unlock_irqrestore(), should be used[1]. > > This patch fixes the "inconsistent lock state" issue caused by > using the non-irq version of the spinlock macros in ima_queue_key() > and ima_process_queued_keys(). > > [1] Documentation/locking/spinlocks.rst > > Signed-off-by: Lakshmi Ramasubramanian > Reported-by: syzbot > Suggested-by: Dmitry Vyukov > Fixes: 8f5d2d06f217 ("IMA: Defined timer to free queued keys") > Fixes: 9fb38e76b5f1 ("IMA: Define workqueue for early boot key measurements") Thanks! This patch is now queued in next-integrity-testing. Mimi