Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp995038ybl; Fri, 13 Dec 2019 07:53:45 -0800 (PST) X-Google-Smtp-Source: APXvYqwo18lxlZXywTZiO3/fYGNhN4O/zaKjMVPVkGqtojpv4JwrO11oniecmQODHs2cgR1J5LjL X-Received: by 2002:a05:6830:1d6:: with SMTP id r22mr15742383ota.196.1576252425753; Fri, 13 Dec 2019 07:53:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576252425; cv=none; d=google.com; s=arc-20160816; b=0kfO+WQuHImd6/XHmgwpyKxL3odEN3jauWcGoOVZvwmJ3iwYYjjgsBgBDuZyWMuZ/Y oZy+9WoY5QtDNRGkRx9/zlTgGOJJYLXDtJ+UYIBKWTmEEOSrkQnL76vYiRdRXzfa1UM5 EwKfLjs/5+gfvu35/f9AkLNKYvCx31y6GGVOMEf30V2VYkjaA1zIvqs6Bl2kqav3DNCD wm5UjZQ9A8xKVf0/GMPtBAAGhQlQB6sbOQW6C2NTN9Xnh0ZGSkdgI4aG07tU8Eq4U93i +OdJzl+MMmZ1bOmfhduVFjQds56o6IHQ08tKjWakmFzkHKBD1FZMF0yjPPhgSMP8uuA4 VAQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature:dkim-filter; bh=VamZRT3RyyPdbHwxLZRTfXiZ1Bh2bvZ/QaCwK/05xRk=; b=tvlJVl1eikNTp4v1BsgOQyqVi3Iqx/eoYIVvEAxqdsoZapYBa6b+2gnTT0n1zFNlxo ggSz1qzu36S3b/Kgt8n9fOnGgEYx4nk4SbvX1yswXQISGcM0O253KH00TOE5AnTYyP6y gt5ffo6H2DVpUY3v9T9ktxdO7k8KGOchILeG0Vd9C0Qq1yor976H8R1h0nGy8V4pPQeW 8hKswfaUq/jMo3WBRg8cLH5ihTs+n8BkjgV7uVjMiEfTlUhAYaJAOA9Fd/gOqMOwuuE0 eWeIrQOMXcTE6liZ03Pp/1JohIpDui74caRqBPFPs1IQBbL8qiJfDr2uWiw1JH1SsO4v jO4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=KEpg5cLK; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s11si2824513otd.123.2019.12.13.07.53.34; Fri, 13 Dec 2019 07:53:45 -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; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=KEpg5cLK; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728025AbfLMPvo (ORCPT + 99 others); Fri, 13 Dec 2019 10:51:44 -0500 Received: from linux.microsoft.com ([13.77.154.182]:60950 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727927AbfLMPvo (ORCPT ); Fri, 13 Dec 2019 10:51:44 -0500 Received: from [10.137.112.108] (unknown [131.107.174.108]) by linux.microsoft.com (Postfix) with ESMTPSA id 7026620B7187; Fri, 13 Dec 2019 07:51:43 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 7026620B7187 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1576252303; bh=VamZRT3RyyPdbHwxLZRTfXiZ1Bh2bvZ/QaCwK/05xRk=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=KEpg5cLK7KxN/GLfgvJ3dXvwLMsTMZ8LWoJ0CgTbgYIG90mrWYICoh7JhX6j3GOij 8hs6aqk2cAAdURDB2TGhD/oxO/WoKdd5QgKMLG9LH4ep/gwFYInphHzJetz6oTHpG1 nZ+Md1wyHdDrIl0bfuk2vBwwuz0pcYY9nmBsqf8I= Subject: Re: [PATCH v3 1/2] IMA: Define workqueue for early boot "key" measurements To: Mimi Zohar , 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 References: <20191213004250.21132-1-nramas@linux.microsoft.com> <20191213004250.21132-2-nramas@linux.microsoft.com> <1576202134.4579.189.camel@linux.ibm.com> <6e0dad33-66f9-4807-d08d-ff30396cec5e@linux.microsoft.com> <1576204377.4579.206.camel@linux.ibm.com> <1576242406.4579.239.camel@linux.ibm.com> From: Lakshmi Ramasubramanian Message-ID: <9938ff03-5cf2-5396-1172-5734cc10819e@linux.microsoft.com> Date: Fri, 13 Dec 2019 07:51:37 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <1576242406.4579.239.camel@linux.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/13/19 5:06 AM, Mimi Zohar wrote: > I just need to convince myself that this is correct.  Normally before > reading and writing a flag, there is some sort of locking.  With > taking the mutex before setting the flag, there is now only a lock > around the single writer. > > Without taking a lock before reading the flag, will the queue always > be empty is the question.  If it is, then the comment is correct, but > the code assumes not and processes the list again.  Testing the flag > after taking the mutex just re-enforces the comment. > > Bottom line, does reading the flag need to be lock protected? > > Mimi > I'll change this function to check the flag again after taking the lock and process only if the queue has entries. Will send an update today. Please let me know if you have any concern in other functions in this file. I'll address them, if any, in today's update. thanks, -lakshmi