Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3889992ybg; Sun, 20 Oct 2019 23:58:54 -0700 (PDT) X-Google-Smtp-Source: APXvYqyOCvEf7ZSZ2qZqQzIRxOlFcNLPdTzk5Amo1l+744bsSwKPvr5M69LMqCE+mKUVFFLJEIyI X-Received: by 2002:aa7:dd92:: with SMTP id g18mr1380944edv.88.1571641134379; Sun, 20 Oct 2019 23:58:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571641134; cv=none; d=google.com; s=arc-20160816; b=TtXzFU3blw5r6WnbfnrsxfH3oH+nit4Ji7hDZzy2gTdzOZ2tN4cex9444INrij+vrK TRg55kASnC5Hi5TMWb1q0GID3EcCGQ1mmK5NrjAee4Mp/3gZpIv5uAuEOVoKFkP9TXkP PCzVviEA+rEB3yAYaROYTkA/3JhBT5lClTJphE95WXVbMVHUIQJwB8YooNCxuzQUdgU8 2FI310b+X62uW4VGzOsPyu1z+XQQH6qLx8AwJQxYdFtDTfrB0Mcjr5+s7fLKVereOqo3 h1D194nK6m2e1AtluHRrea5VGYVOfjNnSG3mJjfPijP+Oednfc06oP2SFuTmjzCeLf6d ni4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=mERVdcaabbZ+RvMpGbS0z6Z3nUjRdN4OI0NdeA+OOR4=; b=AYATD6qW8Qd2Ji5Sae4ZxeF7uEV/Qm8MO99xPh10kCsFlmjG+io1fY7SmzBRPu+D0s d0z9L8CGgmkPvAL4VVbfAIa2fhlQorwZ7eajgc+LYpQjXW+n424fo9IwaB7LTrphbuId nzfcspL1N5tAimPWNG1U0hkm0IzvhESCqGGhM6rnHEQMYadswrukOkHK+mTDFja0DUbQ 97U6HSor1P3YNZY4Af8wgSRZVPb1LXohpDQLb9mh6IzfD5orJXO+dohglb/5iHY4/cqP RZ0FAJOX5ez1kPcNCVWKg+U0gWtb8pF+3k+uVMZAfFKi9ymbO+QKDrzNmSR7UGshFVXh BVSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=HBZp3Vv6; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p20si7273012eju.109.2019.10.20.23.58.31; Sun, 20 Oct 2019 23:58:54 -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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=HBZp3Vv6; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727167AbfJUG6R (ORCPT + 99 others); Mon, 21 Oct 2019 02:58:17 -0400 Received: from mail-wm1-f43.google.com ([209.85.128.43]:34740 "EHLO mail-wm1-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726072AbfJUG6Q (ORCPT ); Mon, 21 Oct 2019 02:58:16 -0400 Received: by mail-wm1-f43.google.com with SMTP id v3so949050wmh.1; Sun, 20 Oct 2019 23:58:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=mERVdcaabbZ+RvMpGbS0z6Z3nUjRdN4OI0NdeA+OOR4=; b=HBZp3Vv63r7qWNzhZZo/J1iBwBRP00R3PaQRH/bIsI3unpSAfuZ9cqZJrKPvZnabih uWD94+v5UMRwZ7GxMCrqnFChgFfiKGHykz16CWicQ81nA1iieM15R0bdNjUxFUH9kFNe rNZcXSjWzzJFWPcn4U6KyqCvbmE8bsKSqFaZv83BwGM0/lxqp4T916hOn/nrdMMVlczC v9cSubA3O0ZqrPyNRnIXfwHzvjuYpVTIRM7TP6hOG6e/ZqDNuQFWK8tM/gn14xLHxXF9 3wVMdn7iS3wFl1HNp4spfRdVawMUBRNzP6KEwZIK5YhCLnJWQmINvjFfF+sT/VYRT+nx Ve+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=mERVdcaabbZ+RvMpGbS0z6Z3nUjRdN4OI0NdeA+OOR4=; b=syVw3vDxDqu34BDp34tpidKpmG36EWSzDvKINwTLhuWrRaXtuNTSd/ihdCpC2mn+Xu kwhsm4pXBcxvb9bk/pFpWTwrWPYf1FupPvKsy/AXLL2ABHVAY/UWKHlrd5IpOTLVdl1t PUU9BfhD4QYVx45sI5s7YlJbVE2rsklN1LNsA6QTkRXXHYo/dCGfmXvk9gwH+N/Aw5oe ouCbQUKcPXdOj/P95m5f0l/hynkkeRDpXt6Jb8U6QfKrWF65uIiDwYUC8Q8A7S1kFD4X 3kT9p08zBK8sBzQBtmmixP414PsjQSY1otOVoerOkDFVJ4rbl/IOpKKhgbBt4P2RZQGQ JUXA== X-Gm-Message-State: APjAAAV/44/Ubs3SewpZhUzU5HgafRkxjAKMx55xsHGpzVChvGiCeqc1 frkiUW69olKwUrJV1dJBcCw= X-Received: by 2002:a05:600c:294c:: with SMTP id n12mr16751201wmd.99.1571641094964; Sun, 20 Oct 2019 23:58:14 -0700 (PDT) Received: from gmail.com (54033286.catv.pool.telekom.hu. [84.3.50.134]) by smtp.gmail.com with ESMTPSA id d11sm15924646wrf.80.2019.10.20.23.58.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 20 Oct 2019 23:58:14 -0700 (PDT) Date: Mon, 21 Oct 2019 08:58:11 +0200 From: Ingo Molnar To: "Paul E. McKenney" Cc: Linus Torvalds , Micah Morton , Jann Horn , Bart Van Assche , Linux Kernel Mailing List , linux-security-module Subject: Re: [GIT PULL] SafeSetID LSM changes for 5.4 Message-ID: <20191021065811.GA17098@gmail.com> References: <20190923233038.GE7828@paulmck-ThinkPad-P72> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190923233038.GE7828@paulmck-ThinkPad-P72> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Paul E. McKenney wrote: > --- a/include/linux/rcupdate.h > +++ b/include/linux/rcupdate.h > @@ -383,20 +383,22 @@ do { \ > } while (0) > > /** > - * rcu_swap_protected() - swap an RCU and a regular pointer > - * @rcu_ptr: RCU pointer > + * rcu_replace() - replace an RCU pointer, returning its old value > + * @rcu_ptr: RCU pointer, whose old value is returned > * @ptr: regular pointer > - * @c: the conditions under which the dereference will take place > + * @c: the lockdep conditions under which the dereference will take place > * > - * Perform swap(@rcu_ptr, @ptr) where @rcu_ptr is an RCU-annotated pointer and > - * @c is the argument that is passed to the rcu_dereference_protected() call > - * used to read that pointer. > + * Perform a replacement, where @rcu_ptr is an RCU-annotated > + * pointer and @c is the lockdep argument that is passed to the > + * rcu_dereference_protected() call used to read that pointer. The old > + * value of @rcu_ptr is returned, and @rcu_ptr is set to @ptr. > */ > -#define rcu_swap_protected(rcu_ptr, ptr, c) do { \ > +#define rcu_replace(rcu_ptr, ptr, c) \ > +({ \ > typeof(ptr) __tmp = rcu_dereference_protected((rcu_ptr), (c)); \ > rcu_assign_pointer((rcu_ptr), (ptr)); \ > - (ptr) = __tmp; \ > -} while (0) > + __tmp; \ > +}) One small suggestion, would it make sense to name it "rcu_replace_pointer()"? This would make it fit into the pointer handling family of RCU functions: rcu_assign_pointer(), rcu_access_pointer(), RCU_INIT_POINTER() et al? rcu_swap() would also look a bit weird if used in MM code. ;-) Thanks, Ingo