From nobody Mon Jun 8 12:11:54 2026 Received: from mail-wr1-f74.google.com (mail-wr1-f74.google.com [209.85.221.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E3733C1F46 for ; Fri, 29 May 2026 09:33:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.74 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780047196; cv=none; b=BkRMbjbjaT1S5D9+PVxPQ6zg/O4D8DmsEotUnNMDNEMY6i6dJ4LnSHHSg+nPj3NjjAE5vXWEXJhcsg2pWKctriqJwsiouaM8ebtfL3pz0fmNmYmI9kqM1aYpW2PyskTcsGdclCSWpW0I+IcTzDPsp8w5Ucl32zeu6lx4eJGDwGM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780047196; c=relaxed/simple; bh=m2M1hqLeBWvqPQs5ztdeH6LdezGSXUVSFlb8F3nedpI=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=bPV8C//2ipajNdYHoYEejZI/PhLWnM232BY+Xvy++quUOkfaQM/tg+PqWLXK2RzbqLeki0NoFHlWxPfSoFNGhgHs3fFK3oy4s60M2074HkcEoNxi+/XTFD1quOYekOBgR+rd9oQQ8Hk+ap64ZY9qJpOHAdzW/uQHcKoyrHba38Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=olRzD6fO; arc=none smtp.client-ip=209.85.221.74 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="olRzD6fO" Received: by mail-wr1-f74.google.com with SMTP id ffacd0b85a97d-45e80183514so9626539f8f.3 for ; Fri, 29 May 2026 02:33:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1780047194; x=1780651994; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=pgBUNf+zONY3y3bIHQzKq/7IR7Q4CQOsSs3bYWLSYZ8=; b=olRzD6fOMf+OEJeRU3XYfOkQy3JsNjFLpkd7vuXx7TyszH2ddkCAd8xJZiPDfTbmkf CpSNNADCccBIRI6A1IFSFNIj/w9p7t3L7+M5Aun3BbruK8uUweFdu9Lfz+f0zVKF72b/ ZQnzBAJd7GU50KRLwO1E9QkW8UleKsMxhOcSZu2k8LXHdyodAXZ1mxwFFnehZpKPjp37 ly5aZ5Cb56VEy+Mb6az1n0Ls2BIPdcgmDQsZgYU1zHTOJMvCkEe3N2FxAMd4orEnIyzI 801jn/cvhwAJTlwJUqFI781PETlX1Hr2F08qhA88lEg8TBpBPgYIxi9baW+nRcprBYIW +ojg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780047194; x=1780651994; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=pgBUNf+zONY3y3bIHQzKq/7IR7Q4CQOsSs3bYWLSYZ8=; b=AWF3catCMBd0oml0QWLZ43EVPI9ykGdNfMiJde/0mUykA0TyrnMNL6z/Gj2RTJN/kG ud2P91ngqqyPoo8ArGnQ7VtHxzRxG20lY4bKxoCZRFZ8luePy97vJ4g4c2AimmftxUm0 +LYKGAojRBYUsZwU8fSXSTUUuNYb0Yz98sTA7faalX+o9M+NiHFe4bbvz1p2YBAaPv3w gvpascsLxkzQZv3LbONNz8a/TR9PJB3mGL9dBV29+X4l7GIe9wvgwVqKiYvwJCIu30/m Uf6Axmpic/yIk535d3wqcYj6Hi4Anh9xGUjN2GThze5fpVvM6S4AWcBxT5h0qgr1lHUJ I0ng== X-Forwarded-Encrypted: i=1; AFNElJ8r/ovYoXDECJ/I3thc/OmxLgefkaMNkp8qUvxUACiMNUJM2hGmjuHAGN38rHxVm2efurfp7fo/vnK3Jnk=@vger.kernel.org X-Gm-Message-State: AOJu0YxoiGa3+TC4B9JbSTOIalTBKtmJxwuhnVkTm49gYTmGMIoyp/PZ /3jD63tcB65USaZZAp8r9mhvLh9hUC86EnG0pYVURdE9JF6TJeX1GhJbzRT+CDhnGF0An3d13rI TL1dmOqsKsnZsBg3OdQ== X-Received: from wrux14.prod.google.com ([2002:a5d:650e:0:b0:45e:e154:705f]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:adf:e405:0:b0:451:3b12:9bca with SMTP id ffacd0b85a97d-45ef14659f6mr2944656f8f.25.1780047193368; Fri, 29 May 2026 02:33:13 -0700 (PDT) Date: Fri, 29 May 2026 09:33:01 +0000 In-Reply-To: <20260529-remove-task-euid-v4-0-07cbdf3af980@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260529-remove-task-euid-v4-0-07cbdf3af980@google.com> X-Developer-Key: i=aliceryhl@google.com; a=openpgp; fpr=49F6C1FAA74960F43A5B86A1EE7A392FDE96209F X-Developer-Signature: v=1; a=openpgp-sha256; l=2697; i=aliceryhl@google.com; h=from:subject:message-id; bh=y1KXlGVYnm1pX/oKAuz20EvxJFYU3EACcVg7zUuAQwU=; b=owEBbQKS/ZANAwAKAQRYvu5YxjlGAcsmYgBqGV1WXEt0VAFuXMCffSAPXG9HpCtsPqdouwXhX XnBDBRN3c+JAjMEAAEKAB0WIQSDkqKUTWQHCvFIvbIEWL7uWMY5RgUCahldVgAKCRAEWL7uWMY5 RrYkEACDEvg+5bfmrGM9ko1sQki3qLPW2T4znB2zmDUHgZNcCoAeUS+1E/N3khEN53mzLCRkyru uVflfG8A/cGB264unm9GM8Xnlr8dQX0Hy9feDf39WXQNJhj+tybCqP7/7GTETTVqkoiFBhbNH9j /iD9+ynhtE410KedhBGDSUMzBQgMTnX0qqPmNe1uLGMBObaC/xWHTCbZGBZGCaQg+nWs2xlQp1S VJt26fhOLhYNsuV9kqfKCRFVmL1butWHBLpALID8TbfPMvkhkXVx10T9B3r3B8oYx1XddfTqZUw Fl8fdSFF5LcAIt/dxXFmROZ3r1BGo8gFn8SWbmlhpvGJBBX79vjXVXWVmCVHcRUKtsRoAaa2xRE xYoZ8p3ioNz+Rr8OFPHym/qcLkUpLiHhOC2e/BVgDvDWa3WO2at56aUVQypcn4q9mLNoP7Gj/eK LjE1tEBlHBOV/EaVRtE8K85jLHiM9mCuFRIihTcQIBbQjHIjAnXlBJ1wxomAqjaYYGyRxsbAEX1 Y1s8rHibSIqjdtF7G6/QaXLxPyLDzba8+Ylxct00FVQReZm2kkv+DXCzQe7VSP9G2yMLIDpJqpy DDGoAyiesecIpl35K3nUUA/qHnX7eL//wAJANF3k/ycHy6y4PMcOwOT/e96E9cc3OsQSt8aiEMN gTR8pOiW3e11plw== X-Mailer: b4 0.14.3 Message-ID: <20260529-remove-task-euid-v4-1-07cbdf3af980@google.com> Subject: [PATCH v4 1/2] rust: task: clarify comments on task UID accessors From: Alice Ryhl To: Paul Moore , Serge Hallyn , Jonathan Corbet , Greg Kroah-Hartman , Shuah Khan , Alex Shi , Yanteng Si , Dongliang Mu Cc: Miguel Ojeda , Boqun Feng , Gary Guo , "=?utf-8?q?Bj=C3=B6rn_Roy_Baron?=" , Benno Lossin , Andreas Hindborg , Trevor Gross , Danilo Krummrich , Jann Horn , linux-security-module@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, Alice Ryhl Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable From: Jann Horn Linux has separate subjective and objective task credentials, see the comment above `struct cred`. Clarify which accessor functions operate on which set of credentials. Also document that Task::euid() is a very weird operation. You can see how weird it is by grepping for task_euid() - binder is its only user. Task::euid() obtains the objective effective UID - it looks at the credentials of the task for purposes of acting on it as an object, but then accesses the effective UID (which the credentials.7 man page describes as "[...] used by the kernel to determine the permissions that the process will have when accessing shared resources [...]"). For context: Arguably, binder's use of task_euid() is a theoretical security problem, which only has no impact on Android because Android has no setuid binaries executable by apps. commit 29bc22ac5e5b ("binder: use euid from cred instead of using task") fixed that by removing that only user of task_euid(), but the fix got reverted in commit c21a80ca0684 ("binder: fix test regression due to sender_euid change") because some Android test started failing. Signed-off-by: Jann Horn Signed-off-by: Alice Ryhl Reviewed-by: Gary Guo --- Originally sent as: https://lore.kernel.org/r/20260212-rust-uid-v1-1-deff4214c766@google.com --- rust/kernel/task.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/rust/kernel/task.rs b/rust/kernel/task.rs index 38273f4eedb5..eabd65bfde12 100644 --- a/rust/kernel/task.rs +++ b/rust/kernel/task.rs @@ -210,14 +210,17 @@ pub fn pid(&self) -> Pid { unsafe { *ptr::addr_of!((*self.as_ptr()).pid) } } =20 - /// Returns the UID of the given task. + /// Returns the objective real UID of the given task. #[inline] pub fn uid(&self) -> Kuid { // SAFETY: It's always safe to call `task_uid` on a valid task. Kuid::from_raw(unsafe { bindings::task_uid(self.as_ptr()) }) } =20 - /// Returns the effective UID of the given task. + /// Returns the objective effective UID of the given task. + /// + /// You should probably not be using this; the effective UID is normal= ly + /// only relevant in subjective credentials. #[inline] pub fn euid(&self) -> Kuid { // SAFETY: It's always safe to call `task_euid` on a valid task. @@ -371,7 +374,7 @@ fn eq(&self, other: &Self) -> bool { impl Eq for Task {} =20 impl Kuid { - /// Get the current euid. + /// Get the current subjective effective UID. #[inline] pub fn current_euid() -> Kuid { // SAFETY: Just an FFI call. --=20 2.54.0.823.g6e5bcc1fc9-goog From nobody Mon Jun 8 12:11:54 2026 Received: from mail-wm1-f73.google.com (mail-wm1-f73.google.com [209.85.128.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9F3733C3BF1 for ; Fri, 29 May 2026 09:33:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780047198; cv=none; b=aroLjYUJJsVWK9OZYtVEtEnEP6UVn1DctnAZx9NE608jEucpI/m472FqjADaAiq8NOLY6quw4MggCYRaWkQKLiKaa1k2jsRTsz13Ufn4P7MUUS3VdowYA+tENFRI2OudHxlPZIofwfCXd5wnweOczi+3W3FBn4j5Ez+q+BZ326Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780047198; c=relaxed/simple; bh=otu5o7pRYtjGXZXB5OxTzD4WhwRYhD/4UrnoDeLfnm8=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=eFf6JRS500AaFFOwwU6lDuq06lFQ70l7hQsu7lG9viuTI/1uhnflPWbNa+HxtwdJb4MOoK+PvedR+6v6qGrRIJH2W8uWUoTJ84fFW412BTRrrYH7SfQfsJjX4n4cZG6+GEvzYQrxXIMFD3CYabwMo0fo2b6RwiAZP8IsVZFDjWk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=dQjgBE7t; arc=none smtp.client-ip=209.85.128.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="dQjgBE7t" Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-4909deb82d0so3278295e9.1 for ; Fri, 29 May 2026 02:33:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1780047195; x=1780651995; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=dF2rlJK0QqWdCxbx8di2+l238YTKQx/uFYdCNV0FDMo=; b=dQjgBE7tDDYQm5ghNJw+U6/USKy394bQZAaszR3EjqsWVZPJZF07Za4tnTAF3xaoij N+B5I7ew/QnNjuUEwq3XDfy6ctoEAyJ+Yw3YIFeqfmCqKIgYTqzIFJB9ifj8Z0ZEQlM4 KCedZv8pjX5Dh2Is21DabZA7T2VqrF4OAHT7e9aMPcMmzue7I6jkFFwkFxSBc8QWvYjI sxlQBR4HJNvjAybTcPTDaVui04BNPPhm7/rF5t46WPfLRcPFeioIQHV9dfQsLTOQIK6+ 7GGDQ57ZL+Xtj/+a+9MyXkm7bzJssJpClI2uJzkyh0EwhONvIOegL7qh7a3PxH2YzDRX PvMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780047195; x=1780651995; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=dF2rlJK0QqWdCxbx8di2+l238YTKQx/uFYdCNV0FDMo=; b=AlJgF69RoEtXQcpFBIFZAbYAzg4wFzqr0AnbQgONOlh9OlfBNU08g5u04GlwAQA6iV W7icrAHMT1wluV1RVl3NAVQ9nVSzqgy/3C2dsT8EnFMitzorPh0gcBi083aB+lGeu1tw NH+NCnq94UwYCPYFhWTAMa0mfHqrkJIfXOYCB1BcOOBQkNI9ZAIoZjOiOr+GLy7fkV9Y T8dkxXdej12MEPbHpQqFKnihP4uMgdpO4ov5M5w1JOVuv4hNyQTASUK8hLegwOWBe8Fh 4SZR+8sWZlelfmk3Y2rZOSgu4LPyjmrx5dllhBzFsSFs50OJjbCsKA5au/fe+NJdUu3N Cvtw== X-Forwarded-Encrypted: i=1; AFNElJ+/gyabkqFiR1H1GPNcJ80txIHPjyW7aJ+m0GJK2Axp9zzxs6+bwqlPIAgVF8abLpR/u2coEVKIhF3Pmss=@vger.kernel.org X-Gm-Message-State: AOJu0YxaBdSbUCuJJYgQQ+nw/6sXhDLtc/OUWMNrqx7ML9UOZ6F25MLc +G3Yvn+DCHfwu6fzbpFpX6Aui+E84jdaa7ZpNO/eE1hRpTCBuim1x0SHJXNzc0dZoKVVFyXaXEF bLBxstsNgZgZKZsdfnw== X-Received: from wrwd3.prod.google.com ([2002:a5d:6443:0:b0:45e:e3fe:3bf7]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a7b:ce92:0:b0:490:7136:ad02 with SMTP id 5b1f17b1804b1-4909c07912amr25180755e9.7.1780047194868; Fri, 29 May 2026 02:33:14 -0700 (PDT) Date: Fri, 29 May 2026 09:33:02 +0000 In-Reply-To: <20260529-remove-task-euid-v4-0-07cbdf3af980@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260529-remove-task-euid-v4-0-07cbdf3af980@google.com> X-Developer-Key: i=aliceryhl@google.com; a=openpgp; fpr=49F6C1FAA74960F43A5B86A1EE7A392FDE96209F X-Developer-Signature: v=1; a=openpgp-sha256; l=5385; i=aliceryhl@google.com; h=from:subject:message-id; bh=Sqf6W+iuyYwfVOyXG6o9lyXAtDS7P16R3gUql+S6AZ4=; b=owEBbQKS/ZANAwAKAQRYvu5YxjlGAcsmYgBqGV1WHo773G4uNEMCpDiYYm14FvckHHpUg6Ebb btX/URxZhGJAjMEAAEKAB0WIQSDkqKUTWQHCvFIvbIEWL7uWMY5RgUCahldVgAKCRAEWL7uWMY5 Rhu8EAC1G7Hd/Vz3FDH7qlyJbxacK2Mi1dHvFqvb5uALbkM1n0fPodX52gWpv5Ds00WYx8MPSZG zZXe+ittpteY8TZG3yXWlOJXNRvm4/m0NmsrEP0C58IL+XmsV4Vnj3B6moF75niwmHQiYYcy+4w NKD/LX1slHwoHw31E2mRDsv5ACd7VWxpy/a91lldwVPucWTtpu4SL5Rs8aWcF7Eucv163TyLIDY vQK3iQ5oH5genU3I4u/nVvUcm1ra6Z+XoaHgXBwaqSvc67HFiPcxVSenR/BS119mdHO11UpC85U MQ53coPpd3+eBYZVp2IsXn7biNvDqojFjgQFm0Su+OyuubhxkGZ/8J8pnmdS3iteWzv3gDZQhrG EVMACZSsEqA28kOTy1YgcJTn6zcjjOZMEUyqMnT4mqsUVl3ax3vGghOsAXQUmSE75KOfyMVF30s HM1melLIMtlNQvBFxohT7YbrS6Swj/OcOIJiNbjSLiFFRsYbYzZfPrGKg6XBd7IMTpzY+GcURLI x7hQCOyaCJZMSoBc3DOQkpwT1q0qSKydnAGHAHDCfwzyr+pwiCubPaH53S8fOL9F8cFbgtzC3xj 9JhokjjGe+oDfWqOoKgkSftJC2tUvGet/HI20QB2vZMo9D9oarmSLuqD/Rxvawv6xP8iG6Pmbua fCDltjC/ZOcfhMg== X-Mailer: b4 0.14.3 Message-ID: <20260529-remove-task-euid-v4-2-07cbdf3af980@google.com> Subject: [PATCH v4 2/2] cred: delete task_euid() From: Alice Ryhl To: Paul Moore , Serge Hallyn , Jonathan Corbet , Greg Kroah-Hartman , Shuah Khan , Alex Shi , Yanteng Si , Dongliang Mu Cc: Miguel Ojeda , Boqun Feng , Gary Guo , "=?utf-8?q?Bj=C3=B6rn_Roy_Baron?=" , Benno Lossin , Andreas Hindborg , Trevor Gross , Danilo Krummrich , Jann Horn , linux-security-module@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, Alice Ryhl Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable task_euid() is a very weird operation. You can see how weird it is by grepping for task_euid() - binder is its only user. task_euid() obtains the objective effective UID - it looks at the credentials of the task for purposes of acting on it as an object, but then accesses the effective UID (which the credentials.7 man page describes as "[...] used by the kernel to determine the permissions that the process will have when accessing shared resources [...]"). Since usage in Binder has now been removed, get rid of the resulting dead code. Changes to the zh_CN translation was carried out with the help of Gemini and Google Translate, and since adjusted as per Alex Shi's feedback. Suggested-by: Jann Horn Reviewed-by: Gary Guo Signed-off-by: Alice Ryhl --- Documentation/security/credentials.rst | 6 ++---- Documentation/translations/zh_CN/security/credentials.rst | 4 +--- include/linux/cred.h | 1 - rust/helpers/task.c | 5 ----- rust/kernel/task.rs | 10 ---------- 5 files changed, 3 insertions(+), 23 deletions(-) diff --git a/Documentation/security/credentials.rst b/Documentation/securit= y/credentials.rst index d0191c8b8060..81d3b5737d85 100644 --- a/Documentation/security/credentials.rst +++ b/Documentation/security/credentials.rst @@ -393,16 +393,14 @@ the credentials so obtained when they're finished wit= h. The result of ``__task_cred()`` should not be passed directly to ``get_cred()`` as this may race with ``commit_cred()``. =20 -There are a couple of convenience functions to access bits of another task= 's -credentials, hiding the RCU magic from the caller:: +There is a convenience function to access bits of another task's credentia= ls, +hiding the RCU magic from the caller:: =20 uid_t task_uid(task) Task's real UID - uid_t task_euid(task) Task's effective UID =20 If the caller is holding the RCU read lock at the time anyway, then:: =20 __task_cred(task)->uid - __task_cred(task)->euid =20 should be used instead. Similarly, if multiple aspects of a task's creden= tials need to be accessed, RCU read lock should be used, ``__task_cred()`` calle= d, diff --git a/Documentation/translations/zh_CN/security/credentials.rst b/Do= cumentation/translations/zh_CN/security/credentials.rst index 88fcd9152ffe..20c8696f8198 100644 --- a/Documentation/translations/zh_CN/security/credentials.rst +++ b/Documentation/translations/zh_CN/security/credentials.rst @@ -337,15 +337,13 @@ const=E6=8C=87=E9=92=88=E4=B8=8A=E6=93=8D=E4=BD=9C=EF= =BC=8C=E5=9B=A0=E6=AD=A4=E4=B8=8D=E9=9C=80=E8=A6=81=E8=BF=9B=E8=A1=8C=E7=B1= =BB=E5=9E=8B=E8=BD=AC=E6=8D=A2=EF=BC=8C=E4=BD=86=E9=9C=80=E8=A6=81=E4=B8=B4= =E6=97=B6=E6=94=BE=E5=BC=83 ``__task_cred()`` =E7=9A=84=E7=BB=93=E6=9E=9C=E4=B8=8D=E5=BA=94=E7=9B= =B4=E6=8E=A5=E4=BC=A0=E9=80=92=E7=BB=99 ``get_cred()`` =EF=BC=8C =E5=9B=A0=E4=B8=BA=E8=BF=99=E5=8F=AF=E8=83=BD=E4=B8=8E ``commit_cred()`= ` =E5=8F=91=E7=94=9F=E7=AB=9E=E4=BA=89=E6=9D=A1=E4=BB=B6=E3=80=82 =20 -=E8=BF=98=E6=9C=89=E4=B8=80=E4=BA=9B=E6=96=B9=E4=BE=BF=E7=9A=84=E5=87=BD= =E6=95=B0=E5=8F=AF=E4=BB=A5=E8=AE=BF=E9=97=AE=E5=8F=A6=E4=B8=80=E4=B8=AA=E4= =BB=BB=E5=8A=A1=E5=87=AD=E6=8D=AE=E7=9A=84=E7=89=B9=E5=AE=9A=E9=83=A8=E5=88= =86=EF=BC=8C=E5=B0=86RCU=E6=93=8D=E4=BD=9C=E5=AF=B9=E8=B0=83=E7=94=A8=E6=96= =B9=E9=9A=90=E8=97=8F=E8=B5=B7=E6=9D=A5:: +=E6=9C=89=E4=B8=80=E4=B8=AA=E6=96=B9=E4=BE=BF=E7=9A=84=E5=87=BD=E6=95=B0= =E5=8F=AF=E7=94=A8=E4=BA=8E=E8=AE=BF=E9=97=AE=E5=8F=A6=E4=B8=80=E4=B8=AA=E4= =BB=BB=E5=8A=A1=E5=87=AD=E6=8D=AE=E7=9A=84=E7=89=B9=E5=AE=9A=E9=83=A8=E5=88= =86=EF=BC=8C=E4=BB=8E=E8=80=8C=E5=AF=B9=E8=B0=83=E7=94=A8=E6=96=B9=E9=9A=90= =E8=97=8FRCU=E6=9C=BA=E5=88=B6:: =20 uid_t task_uid(task) Task's real UID - uid_t task_euid(task) Task's effective UID =20 =E5=A6=82=E6=9E=9C=E8=B0=83=E7=94=A8=E6=96=B9=E5=9C=A8=E6=AD=A4=E6=97=B6= =E5=B7=B2=E7=BB=8F=E6=8C=81=E6=9C=89RCU=E8=AF=BB=E9=94=81=EF=BC=8C=E5=88=99= =E5=BA=94=E4=BD=BF=E7=94=A8:: =20 __task_cred(task)->uid - __task_cred(task)->euid =20 =E7=B1=BB=E4=BC=BC=E5=9C=B0=EF=BC=8C=E5=A6=82=E6=9E=9C=E9=9C=80=E8=A6=81= =E8=AE=BF=E9=97=AE=E4=BB=BB=E5=8A=A1=E5=87=AD=E6=8D=AE=E7=9A=84=E5=A4=9A=E4= =B8=AA=E6=96=B9=E9=9D=A2=EF=BC=8C=E5=BA=94=E4=BD=BF=E7=94=A8RCU=E8=AF=BB=E9= =94=81=EF=BC=8C=E8=B0=83=E7=94=A8 ``__task_cred()`` =E5=87=BD=E6=95=B0=EF=BC=8C=E5=B0=86=E7=BB=93=E6=9E=9C=E5=AD=98=E5=82=A8= =E5=9C=A8=E4=B8=B4=E6=97=B6=E6=8C=87=E9=92=88=E4=B8=AD=EF=BC=8C=E7=84=B6=E5= =90=8E=E4=BB=8E=E4=B8=B4=E6=97=B6=E6=8C=87=E9=92=88=E4=B8=AD=E8=B0=83=E7=94= =A8=E5=87=AD=E6=8D=AE=E7=9A=84=E5=90=84=E4=B8=AA=E6=96=B9=E9=9D=A2=EF=BC=8C= =E6=9C=80=E5=90=8E=E9=87=8A=E6=94=BE=E9=94=81=E3=80=82 diff --git a/include/linux/cred.h b/include/linux/cred.h index c6676265a985..6ef1750c93e2 100644 --- a/include/linux/cred.h +++ b/include/linux/cred.h @@ -371,7 +371,6 @@ DEFINE_FREE(put_cred, struct cred *, if (!IS_ERR_OR_NUL= L(_T)) put_cred(_T)) }) =20 #define task_uid(task) (task_cred_xxx((task), uid)) -#define task_euid(task) (task_cred_xxx((task), euid)) #define task_ucounts(task) (task_cred_xxx((task), ucounts)) =20 #define current_cred_xxx(xxx) \ diff --git a/rust/helpers/task.c b/rust/helpers/task.c index c0e1a06ede78..b46b1433a67e 100644 --- a/rust/helpers/task.c +++ b/rust/helpers/task.c @@ -28,11 +28,6 @@ __rust_helper kuid_t rust_helper_task_uid(struct task_st= ruct *task) return task_uid(task); } =20 -__rust_helper kuid_t rust_helper_task_euid(struct task_struct *task) -{ - return task_euid(task); -} - #ifndef CONFIG_USER_NS __rust_helper uid_t rust_helper_from_kuid(struct user_namespace *to, kuid_= t uid) { diff --git a/rust/kernel/task.rs b/rust/kernel/task.rs index eabd65bfde12..c2b3457b700c 100644 --- a/rust/kernel/task.rs +++ b/rust/kernel/task.rs @@ -217,16 +217,6 @@ pub fn uid(&self) -> Kuid { Kuid::from_raw(unsafe { bindings::task_uid(self.as_ptr()) }) } =20 - /// Returns the objective effective UID of the given task. - /// - /// You should probably not be using this; the effective UID is normal= ly - /// only relevant in subjective credentials. - #[inline] - pub fn euid(&self) -> Kuid { - // SAFETY: It's always safe to call `task_euid` on a valid task. - Kuid::from_raw(unsafe { bindings::task_euid(self.as_ptr()) }) - } - /// Determines whether the given task has pending signals. #[inline] pub fn signal_pending(&self) -> bool { --=20 2.54.0.823.g6e5bcc1fc9-goog