Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5133508yba; Wed, 10 Apr 2019 12:05:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqzbmLbbLMfmI6tVip7OgepFX+mvbuQOuQ0tP4Oul95yjPAcefvYoJN0niQdfcS1ORqdZn5D X-Received: by 2002:a62:6086:: with SMTP id u128mr45525715pfb.148.1554923157643; Wed, 10 Apr 2019 12:05:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554923157; cv=none; d=google.com; s=arc-20160816; b=IDqWZ/S4RqiPVgm+De5SCk/Cl3jhHzKLbb6HG1LRYHAGP0QyrHVXgVPah1tIKu4QsA ZiDrl4zI8Dq7HzQttzE964FT41VZ7OkCB6lFFYUa1NWVfzi/Hu9nmDRThsp0qg7o7pHp E9hxfuUNJJ4utVwInTirKFu9IeHxf4XZnMsX5VQU57pp1vG2sqL+4mFOVs/sRWj76cvs D6YOMjZm57OcjHt+GMU57wZlwrDBo2UgjtaLvaYGfnc7hLpTSPVj6QoxS0llu8LWWWiR uIfWhvmyyiNynA3g3GB0bknGkXSnZepfJqWt+LFo4q+7Xr+8ZqR101uwx+x2Y+/UYbE0 AdnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=UWZfsggUcbkvKo7QlMxsS6h/BAlGUvmrr361vdXah+I=; b=HBn5YV1N35lRmo9NWdrUPNU6wMRgRPcuwPqr0RZhcwPOutxyQfNf02nJDWWUQxFGuY iTPM5IyRgE1xSjlfySKLGpaJWpDbdldqVRCj2y9xQ+w08w+X8h26JsFWE3NyZPYlYc0b PBxjzYdZQLiUEGx6oiXLYRogjfXg6mAU7Q/QtaMYv5BxAAHeUpInbkbPy7l9xRLXb1VQ mfdQLEPnlMAKmnY4r3AGIlhh5rlSgl/xzF1lrVs7s6EDGGIaYD9e0ed4BkLFAjuTpXcq jgME2nCXYtMYph2Bit09wqm27CnqIbB6Z+5ppfOsDU8pLzab1HRSFyp7CImsZNVjQt/7 NYBg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k70si12052982pgd.75.2019.04.10.12.05.41; Wed, 10 Apr 2019 12:05:57 -0700 (PDT) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729366AbfDJRbF (ORCPT + 99 others); Wed, 10 Apr 2019 13:31:05 -0400 Received: from namei.org ([65.99.196.166]:33476 "EHLO namei.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728692AbfDJRbF (ORCPT ); Wed, 10 Apr 2019 13:31:05 -0400 Received: from localhost (localhost [127.0.0.1]) by namei.org (8.14.4/8.14.4) with ESMTP id x3AHV1Qh026449; Wed, 10 Apr 2019 17:31:01 GMT Date: Thu, 11 Apr 2019 03:31:01 +1000 (AEST) From: James Morris To: Jann Horn cc: David Howells , "Serge E. Hallyn" , linux-kernel@vger.kernel.org, keyrings@vger.kernel.org, linux-security-module@vger.kernel.org Subject: Re: [PATCH] keys: safe concurrent user->{session,uid}_keyring access In-Reply-To: <20190327155508.144730-1-jannh@google.com> Message-ID: References: <20190327155508.144730-1-jannh@google.com> User-Agent: Alpine 2.21 (LRH 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 27 Mar 2019, Jann Horn wrote: > The current code can perform concurrent updates and reads on > user->session_keyring and user->uid_keyring. Add a comment to > struct user_struct to document the nontrivial locking semantics, and use > READ_ONCE() for unlocked readers and smp_store_release() for writers to > prevent memory ordering issues. > > Fixes: 69664cf16af4 ("keys: don't generate user and user session keyrings unless they're accessed") > Signed-off-by: Jann Horn Applied to git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security.git next-general -- James Morris