Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1384221ybb; Wed, 1 Apr 2020 23:03:02 -0700 (PDT) X-Google-Smtp-Source: APiQypLGsGvoD7eNcMnBK1DMDk+83MyN8FSWyEhteoTAZOgJM/+frOOxstORd86npzHHbc4kZLgV X-Received: by 2002:a9d:6c8f:: with SMTP id c15mr1131705otr.10.1585807382453; Wed, 01 Apr 2020 23:03:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585807382; cv=none; d=google.com; s=arc-20160816; b=CV5YmXNu484F0/sA71mYRNsPPv1PS4ppd4qNs0sC8EWhr1cDpgwCFy1zmRZmlEuVNq vjn2vFdUsTAELyNiE/ups917CHb3pNCXBV6h0kFnF0QHkwbTVCLXL29Od9IJNxoWIiGx Fn2D49f+/kbOK8LeSYMFfNQ4anwuLz+aP0rB+hJgTkAe+gpMkAOc3XQ1UUSFl4ZZEojW TJQxhLaIi0DHBJn/fVFVNv53ydn//vrzk8S+y8y9dfx9FPv+rtyOuwtnbpkSUc40ER4B eet+0IE0sH9ohaDKfsU7/3ZA5jWwJ/cFX3KZRky7/JIlLn6BFCmdmHv4Q77+ViEjSX63 tL1w== 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=yhj6KWtssq/9HtB6SBkmuq3DwjT/cxHZuREg3PpIDCafe18WLU3BipO8vkBXudoq4b tPhMbkExzo8Z8gUVbJSRbSwpiuCFx+q5jRmLBZlCW9GETIjwekHAJxPYwRxDAghmv7xs ioJw09oxhsXLPxmuhi8GE8pstfAPBmMmO1Hwe7fRNkTnCFSOUMs+1d5rOjylxvig5rs/ 1GmB8DEmT7PHedkOfquDtITO4yixMq2jZfGo5qRazfm3yUvC1QqLQRBsKu9GsZHmWr9Y tuN7ESEQlHPUVLsaC9oHyOsd3qKW+l1og9Z7DjrFxdGy27vYFK7aE7MKMF6nOjsu8PYQ FSXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=G7uZ1Wcv; 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 94si1776083oti.94.2020.04.01.23.02.48; Wed, 01 Apr 2020 23:03:02 -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=G7uZ1Wcv; 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 S1728585AbgDBF5N (ORCPT + 99 others); Thu, 2 Apr 2020 01:57:13 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:37066 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725789AbgDBF5M (ORCPT ); Thu, 2 Apr 2020 01:57:12 -0400 Received: by mail-pl1-f195.google.com with SMTP id x1so943338plm.4 for ; Wed, 01 Apr 2020 22:57:12 -0700 (PDT) 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=G7uZ1WcvWQXQhE89TjGanF83SSBtnYTzfsKrsZMSO99kV3o0lqB4hLjVXUJgPIlEKN MMVBXIwdagq4gBOwV1UYGru2LrNs1b2VXa5vu5r3MzNYwBfTIJ8ITowd1B36Go8wrBru DRTpy/WThWpv9D+uoEjemiAT3xmnzkOOv9JPYZxXQn4x2ogiXP+LkuHhR0IsefzV1Lw8 S06y5Yq7W8YqatW+5AjcTHL3m2WsvWt6kCHqhgRN7d3t4XxGV/DEIKS2TpRbRb9glSzl 5Mmy6E9a3tylkrg9wUbIO9IWA16tWCpLmACemp8pmWBs5Sw9SKKy1cWB+OIsx6lZogXv ECug== 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=H+xpB/jUZg2L7DhCZhy/LEK1l3gVXQwSiroFEKkIWPtA1JzIkD+fyxISsbZVtbpCRj vKE39wVuMpk57PGgzcL/KI49n89pPwG/A76P43kd7IMuKIwDBesKBMsqrfj9UyCqxj+9 brUMxKwJOcLJfFO8WFoFxsvH0YbFZVji0MrT43L0pnzGhA5O9J1Cd7Dqw26u8agHeS7M 5MePUpYWBD8686zfZ/VqkImLp2C9bXQIFYUYbIqtDvnGw0oFxCcYz6Ey2qf7hvnP+Jp1 diZj2yoTdy7BTP0TU0qX1I18XtfHwK+9mu4oiGUTDfcAU6vDcfmnGlUlsWrsuavwLniQ povQ== X-Gm-Message-State: AGi0Puby1tJLa8dVbnEKzFNczAwe5rNBeGYdJ05uM5varlEgHBHT56ua tAl8mzaT3SlcxG0gLQsV46o= X-Received: by 2002:a17:90a:fe18:: with SMTP id ck24mr2037363pjb.57.1585807031699; Wed, 01 Apr 2020 22:57:11 -0700 (PDT) Received: from localhost.localdomain ([103.87.57.161]) by smtp.googlemail.com with ESMTPSA id 207sm2776058pgg.19.2020.04.01.22.57.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Apr 2020 22:57:11 -0700 (PDT) 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 RESEND] sched: Remove __rcu annotation from cred pointer Date: Thu, 2 Apr 2020 11:26:38 +0530 Message-Id: <20200402055640.6677-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