Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3156924ybl; Fri, 20 Dec 2019 04:55:19 -0800 (PST) X-Google-Smtp-Source: APXvYqxSVhTfODcQQTuFAVr8xv0gqQd8gmTMBZX88YbJvU2Ux5IOjx3uN1nt13IEC6qpl53BJ47I X-Received: by 2002:a9d:6b17:: with SMTP id g23mr14232875otp.265.1576846519647; Fri, 20 Dec 2019 04:55:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576846519; cv=none; d=google.com; s=arc-20160816; b=tt5LGQWo1joZj1HGFPw1T4s2SK1XZtapyeZAU6avN2IxZfREe/CrScWdx8fyyd/wLA c8A93BwIYXSsrvYAAfY+JWDszxKhTQrJUj4fbcsjQ/N/WfOhy+vYW4q1psW9iSEuPmq7 tY/EKKRrH54YyVaNaFbM0AdtYdXrpitozGqU0IHzZbk/wLM9rdq2u3fjfbGF6OCSU89O FakgbNBE5ua6zQxmzWuKQ9IHOYTEuxF4wM5sgf/KbeWz37qJ2gVMS5qKuTd1N2FQ8sOe EyfmdNpmeuImWVKxT+dquScTtFtEkZa//alcX8vbaSNRTOg/t2T84YbCEII3+IHLoVNQ Kv+w== 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=d7haxcn7QIPcblClwKW4+W/pEfyBsxruL2KPDyEk/fY=; b=Zy860Y4oKGh98fSXpYbrA6FwMCYTdatAaeGpgGWft7ZKM3wHt/KpIqHF8+VZtK+bpv OJBtQ9rFeklNj1Nuhv7NOhqs0AeaOGSVzmZ3Q4eiwbJ0sKuyAftAB9d1jk7U0pQDDUkP QPbZZ6pHHa1UaO6tG9ri+oI95Kjb8PtvyFAJV850o/LMLxTqBk/3B8XyK66GlkaETAav tgclxZmn9i31pWuKHh1tA75ybWuJcuS8kKMtElirBZlr3kAJPKvSZlB8z0rcn5YbwGzw dT/h8U3kR/KfgbgKhMNWFExECHFDhPVxPKn7AQOuGfNHSMOHnk2YbQ+gETAj1N6yJTJ2 YBzQ== 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 v18si5008905oic.27.2019.12.20.04.55.07; Fri, 20 Dec 2019 04:55:19 -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 S1727465AbfLTMxR (ORCPT + 99 others); Fri, 20 Dec 2019 07:53:17 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:30672 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727397AbfLTMxQ (ORCPT ); Fri, 20 Dec 2019 07:53:16 -0500 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xBKCosoh102131 for ; Fri, 20 Dec 2019 07:53:15 -0500 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2x0ufv6axv-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 20 Dec 2019 07:53:15 -0500 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 20 Dec 2019 12:53:13 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 20 Dec 2019 12:53:09 -0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id xBKCr8eo31457450 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 20 Dec 2019 12:53:08 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5DD0AA4054; Fri, 20 Dec 2019 12:53:08 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 201F0A4060; Fri, 20 Dec 2019 12:53:07 +0000 (GMT) Received: from localhost.localdomain (unknown [9.85.154.31]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with ESMTP; Fri, 20 Dec 2019 12:53:07 +0000 (GMT) Subject: Re: [PATCH v5 1/2] IMA: Define workqueue for early boot "key" measurements From: Mimi Zohar To: Lakshmi Ramasubramanian , James.Bottomley@HansenPartnership.com, linux-integrity@vger.kernel.org Cc: eric.snowberg@oracle.com, dhowells@redhat.com, mathew.j.martineau@linux.intel.com, matthewgarrett@google.com, sashal@kernel.org, jamorris@linux.microsoft.com, linux-kernel@vger.kernel.org, keyrings@vger.kernel.org Date: Fri, 20 Dec 2019 07:53:06 -0500 In-Reply-To: <503845c9-beeb-b520-ec3f-af5fa7d2b91f@linux.microsoft.com> References: <20191218164434.2877-1-nramas@linux.microsoft.com> <20191218164434.2877-2-nramas@linux.microsoft.com> <1576761104.4579.426.camel@linux.ibm.com> <503845c9-beeb-b520-ec3f-af5fa7d2b91f@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: 8bit X-TM-AS-GCONF: 00 x-cbid: 19122012-0028-0000-0000-000003CA9DAE X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19122012-0029-0000-0000-0000248DF269 Message-Id: <1576846386.5241.13.camel@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,18.0.572 definitions=2019-12-20_02:2019-12-17,2019-12-20 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 adultscore=0 priorityscore=1501 lowpriorityscore=0 bulkscore=0 mlxlogscore=999 phishscore=0 malwarescore=0 suspectscore=0 spamscore=0 impostorscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1910280000 definitions=main-1912200102 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2019-12-19 at 08:55 -0800, Lakshmi Ramasubramanian wrote: > I am not sure if the mutex can be removed. > > In ima_queue_key() we need to test the flag and add the key to the list > as an atomic operation: > > if (!test_bit()) > insert_key_to_list > > Suppose the if condition is true, but before we could insert the key to > the list, ima_process_queued_keys() runs and processes queued keys we'll > add the key to the list and never process it. > > Is there an API in the kernel to test and add an entry to a list > atomically? Ok, using test_and_set_bit() and test_bit() only helps, if we can get rid of the mutex.  I'll queue these patches. thanks, Mimi