From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C2010347BC5 for ; Mon, 4 May 2026 08:45:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777884337; cv=none; b=nMNO8ffb755oz8iKcNZJH1Du7OqBYYpWEr+fxISaR6R/U9s+Tc/itHQig5R3REMrEFFuI5P3lO+Ga23xN529f4lUurv7LRdRqFsTDBQZ+LXmsubsUySU8KnHGYhO++yjIDpvEbXMUutqdC3zTs7QrXfbZv4hL6afzl+21MNeX2Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777884337; c=relaxed/simple; bh=/U86S23KyUL7ZQy/oAnGm1hbGqj/3pxltZV56df0OfQ=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=R9fT1UYbNqHAehcWYyY8BpwPWi8ow/5nfRzQkxQlGc8bvAdxVey847pTBht5jZqoZvw6KcT233K7hnrsBfD7Ez86KHTD+IL1akkZA5wCt3XnaiLjE8YqENrQ7Q/eGdRbBrb25KCOjSsJcrHAmwsXqA0IJ77Xx1OVZ99Z/xlAJvU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=nJP8i5Bj; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="nJP8i5Bj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86E6AC2BCB8; Mon, 4 May 2026 08:45:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1777884336; bh=/U86S23KyUL7ZQy/oAnGm1hbGqj/3pxltZV56df0OfQ=; h=Subject:To:Cc:From:Date:From; b=nJP8i5BjHdjuEYzZuiiGknPoFUYCeeHOg3hSreCIoNp5kDFY3XNA0zhtZaOhmNJ3h e8sUAiZEeDcT11OOQQDLPawXJWSrIiKLST6OZD6ppjxlcRh8BZoH/sUJXY3SIzpVP1 Vai8m1z7cgAfvlzjfN+vJMPYiG8r1v6+qiqaY8cA= Subject: FAILED: patch "[PATCH] apparmor: use target task's context in apparmor_getprocattr()" failed to apply to 5.10-stable tree To: cengiz.can@canonical.com,john.johansen@canonical.com,qsa@qualys.com Cc: From: Date: Mon, 04 May 2026 10:45:24 +0200 Message-ID: <2026050424-perceive-compress-fcb1@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 5.10-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y git checkout FETCH_HEAD git cherry-pick -x 4afc61702bdcc3b9b519749ef966cf762a6e7051 # git commit -s git send-email --to '' --in-reply-to '2026050424-perceive-compress-fcb1@gregkh' --subject-prefix 'PATCH 5.10.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 4afc61702bdcc3b9b519749ef966cf762a6e7051 Mon Sep 17 00:00:00 2001 From: Cengiz Can Date: Tue, 10 Feb 2026 11:17:14 +0300 Subject: [PATCH] apparmor: use target task's context in apparmor_getprocattr() apparmor_getprocattr() incorrectly calls task_ctx(current) instead of task_ctx(task) when retrieving prev and exec attributes, returning the caller's labels rather than the target's. Fix by passing task to task_ctx(). The issue can be reproduced when a process with an onexec transition (e.g., configured by a container runtime) is inspected via /proc//attr/apparmor/exec. The reader's own value is returned instead of the target's. Reported-by: Qualys Security Advisory Fixes: 3b529a7600d8 ("apparmor: move task domain change info to task security") Cc: stable@vger.kernel.org Co-developed-by: Cengiz Can Signed-off-by: Cengiz Can Co-developed-by: John Johansen Signed-off-by: John Johansen diff --git a/security/apparmor/lsm.c b/security/apparmor/lsm.c index c1d42fc72fdb..d3af2d10fc22 100644 --- a/security/apparmor/lsm.c +++ b/security/apparmor/lsm.c @@ -822,25 +822,23 @@ static int apparmor_getprocattr(struct task_struct *task, const char *name, char **value) { int error = -ENOENT; - /* released below */ - const struct cred *cred = get_task_cred(task); - struct aa_task_ctx *ctx = task_ctx(current); struct aa_label *label = NULL; + rcu_read_lock(); if (strcmp(name, "current") == 0) - label = aa_get_newest_label(cred_label(cred)); - else if (strcmp(name, "prev") == 0 && ctx->previous) - label = aa_get_newest_label(ctx->previous); - else if (strcmp(name, "exec") == 0 && ctx->onexec) - label = aa_get_newest_label(ctx->onexec); + label = aa_get_newest_cred_label(__task_cred(task)); + else if (strcmp(name, "prev") == 0 && task_ctx(task)->previous) + label = aa_get_newest_label(task_ctx(task)->previous); + else if (strcmp(name, "exec") == 0 && task_ctx(task)->onexec) + label = aa_get_newest_label(task_ctx(task)->onexec); else error = -EINVAL; + rcu_read_unlock(); if (label) error = aa_getprocattr(label, value, true); aa_put_label(label); - put_cred(cred); return error; }