Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp880546ybv; Fri, 7 Feb 2020 10:09:24 -0800 (PST) X-Google-Smtp-Source: APXvYqyR0c0ot0YmyAaOzI7+DbTtV1FLRavEYwN0fefl3yZS7urLfzF22/sY8LM3JViaulYw9o+U X-Received: by 2002:aca:bfc2:: with SMTP id p185mr2960799oif.57.1581098964193; Fri, 07 Feb 2020 10:09:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581098964; cv=none; d=google.com; s=arc-20160816; b=XBcZWdlNz8bo00HWgN7ipMsXsySQRQhTtSSWc1BbE2TDWq5FaPZ/eLkXSQqA1XtIiF gTxBPQTGmZRcUa2taggAKx8Bs53HAEQUoE93XTDOwOYnnu1laWwCw43V0Ydg+H3+1V09 bq87XahIj6G7T5Co4xvEbjMVozSt9enMIsX0UkidknFr01PVPPmvVPR6K5oeb42SkPXp SbL0jqUwmXxXHQvYIR7qOXRIZdE2+Ltl8zqZKmNmY+rH7KxRz8Z5r0f06y+sS2IFVIun hlzAS1lWjeMHtNWaOokCwRjWnOBa/TvIpDGSohIJjYe74Rq7vfEufg805cB5FauTBFz3 RpvA== 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:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=0v8qFG+lakbNwCs1dTA5aCEVT1bp7ahYq6NmZeNOrGQ=; b=LlcILROcmY6d3a5EnVFs1gE3oeTvCrAv1WJzMHWLQr+ntDMPpVnMf1YBAeWsRIdKuh GIzrLN0krnYil2VkAZxJYe+yQZ6J73hZaPnysi5viSv8oMjqptPY7T46YxxPdTGyn3JP XTBjLgSa6xy0McNXJrBZzzVZzqdS+I1KsT6PMaX6YwPbt02up41XUi4IzT9/tAVH8BXl 2eCkQJPgd/jMxVL9xVJDHL7XL5DoonTQ3Is8g8MUI6RNX0egKXmhjTZx6YXiavGGDUbf thH1JaTyPV05dWNlljcgvqHfHVqYDLx46oVv8ZfZY8pZWCgevjgp+szggZRkQlYXLEj7 nOag== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=YZFLV0Uw; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 16si29378oth.99.2020.02.07.10.09.12; Fri, 07 Feb 2020 10:09:24 -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=fail header.i=@gmail.com header.s=20161025 header.b=YZFLV0Uw; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727491AbgBGSIK (ORCPT + 99 others); Fri, 7 Feb 2020 13:08:10 -0500 Received: from mail-pf1-f196.google.com ([209.85.210.196]:47049 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726974AbgBGSIJ (ORCPT ); Fri, 7 Feb 2020 13:08:09 -0500 Received: by mail-pf1-f196.google.com with SMTP id k29so138001pfp.13 for ; Fri, 07 Feb 2020 10:08:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=0v8qFG+lakbNwCs1dTA5aCEVT1bp7ahYq6NmZeNOrGQ=; b=YZFLV0Uw3aGkA8Di8/+VdoaniHd8W36VUerYnREvcVaDz4ZrjpBC4fp7llzYwLLqjE /dh336xBMloCOnEejmmoYQAr0i95xSJlW4+cMn/Rnw8K9BM4eSB+8E0tAcdHodTR5X6p e2x/gsyjUYhqYvdt+wKzZHifjOXU37OXwd0HShElOPyGhZhRlycYXLRVoKCDxy6Cobd/ MgawCZ3tNO5lRvO0ZFjRWNxUisGE57LqlAtmsYlV+6bveBq2YnCqRIo48IEw6M30/cZ/ 9bi/LcSXSpWVhq2qIL43638VAiF0MCaPG3Ms98jKGeMtEzVepZwziTrhIAoyrFHjTCEj blWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=0v8qFG+lakbNwCs1dTA5aCEVT1bp7ahYq6NmZeNOrGQ=; b=hQ5A3A6KC/L/Fc/1wIHAmJG+tnEdiXgfd2pqCdrbqRsT0lZQhJZRPnR/nSklQ2sK5M ycuSeXFYW3557IinA41dlZf4yKT3TALNqcbg3e3paqv+3J1jxYl4526IpQy/122X7aNK 4VmME8KvKyrzq4RmdGqK6tluF/gB0wI4X5geDaX9VxbcT3axMIoi3M1NB370GsNQvCfx ao4S46ij9XcuZRWxFgXEbY+GLlc0ct9mofq73hUzK3F1ChcCK18YQiE7dbPpf+UdUdmx a3G3Q7csFZbP6SYngiXszxLpXabvWWqbTsLtG5VnteeY8xd3PRPfG1pTXlm1CN+OGLdO ugVg== X-Gm-Message-State: APjAAAUu02utd/6TG177KCWXMPUl2f6+YindL2wSWfo4sD3ZlDWpVcHG vyemySAD0jAbssUdWw3Fjf0= X-Received: by 2002:aa7:979a:: with SMTP id o26mr105769pfp.257.1581098888027; Fri, 07 Feb 2020 10:08:08 -0800 (PST) Received: from localhost.localdomain ([103.211.17.120]) by smtp.googlemail.com with ESMTPSA id gx18sm3088795pjb.8.2020.02.07.10.08.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Feb 2020 10:08:07 -0800 (PST) From: Amol Grover To: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , James Morris , Thomas Gleixner , Peter Zijlstra , Jann Horn , David Howells , Shakeel Butt , "Eric W . Biederman" , Andrew Morton , Paul Moore , Eric Paris Cc: linux-kernel-mentees@lists.linuxfoundation.org, linux-kernel@vger.kernel.org, linux-audit@redhat.com, Joel Fernandes , Madhuparna Bhowmik , "Paul E . McKenney" , Amol Grover Subject: [PATCH 1/3] sched: Remove __rcu annotation from cred pointer Date: Fri, 7 Feb 2020 23:35:03 +0530 Message-Id: <20200207180504.4200-1-frextrite@gmail.com> X-Mailer: git-send-email 2.24.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org task_struct::cred (subjective credentials) is *always* used task-synchronously, hence, does not require RCU semantics. task_struct::real_cred (objective credentials) can be used in RCU context and its __rcu annotation is retained. However, task_struct::cred and task_struct::real_cred *may* point to the same object, hence, the object pointed to by task_struct::cred *may* have RCU delayed freeing. Suggested-by: Jann Horn Co-developed-by: Joel Fernandes (Google) Signed-off-by: Joel Fernandes (Google) Signed-off-by: Amol Grover --- include/linux/sched.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/linux/sched.h b/include/linux/sched.h index 716ad1d8d95e..39924e6e0cf2 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -879,8 +879,11 @@ struct task_struct { /* Objective and real subjective task credentials (COW): */ const struct cred __rcu *real_cred; - /* Effective (overridable) subjective task credentials (COW): */ - const struct cred __rcu *cred; + /* + * Effective (overridable) subjective task credentials (COW) + * which is used task-synchronously + */ + const struct cred *cred; #ifdef CONFIG_KEYS /* Cached requested key. */ -- 2.24.1