From nobody Tue Sep 29 14:54:56 2026 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 66AE849481D for ; Thu, 6 Aug 2026 19:41:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786045306; cv=none; b=BGQNftDT8zFA8fbyAGfJDF0D/zFIo/8/xnXM9SPHw1qiByBzGrW8Wrx/Wj7NDuqePb+M1EcaS3c17oAXDb4XdBidCedlIF8krYSpQdtOq16u4tLPNI5nykxzC/hwwQsQOIYcK9pyzDaOTns/g+Jiw0FaqIJxdNfeH1oYMOHV/hc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786045306; c=relaxed/simple; bh=sSboF3nOx5Fbmhas6I6ey9seACJAKplyQAcNHv1o0WI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=cLjgZcT4dJfPHP254Ra8SDHZQihG1p/cRtfu2f0MO0MYxwuOb8MnFCwveX5DdVwlqdUfnuJ5+JIQz+pV4i+iI5oCLKv4zlBMPUzp7mwLKJnxW66U6m/fJq0NujWuWVZ/PAW/xqV/FMcPjoVU2BNq/JAXRdMZ1N+4SC/kubatBOA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=cLnF48e8; arc=none smtp.client-ip=209.85.128.45 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=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="cLnF48e8" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-495509b08ebso10505e9.1 for ; Thu, 06 Aug 2026 12:41:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1786045302; x=1786650102; darn=vger.kernel.org; h=cc:to:message-id:content-transfer-encoding:content-type :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=0MZnaKjwN+F5O6KUpqyw6XaSkX7zjUg5vy7iF6PcqM0=; b=cLnF48e8QSTFGt1K+YFVIkyy3bIzeGUQgxhDPem3MaR2XIgTEYLCDYNhK6v9o85YUF t3plAcfgHmxoDb54d2uXc1k6PqtAA1PCYXSbKC+1ijpTvzILm8BUfY237YBf0C2rEGE8 XDE2M9FOEN/PR9vc6g+ow0IiOHH0c7Q9nrLNL2UpI+UtnYyhma3jYF52A6NQ5wM0pbi1 S18nGzAVh1xQpopUu7xDpkKTEqU19RP33W91ZegVk6MsGVIf7y8W8pSciA9mR/ISL3qW 78jPbF22RcBV8cIOHkQijMP8m+7/+d6QB899zbSDTq7RYC52gNlAmFT3xs6SH2KVZj4k 5sLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786045302; x=1786650102; h=cc:to:message-id:content-transfer-encoding:content-type :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to:content-type; bh=0MZnaKjwN+F5O6KUpqyw6XaSkX7zjUg5vy7iF6PcqM0=; b=aSADZbw1xhXkL7sBtO4U8jpgVY+8+0JiJrZzo5fdhErzSIUUdNyuG3tZr9Z1Ke1gq3 F0a8Z2yXGS35lGKh/YgTKVMK8373dTa4ZnV0P9CKSAYOjuMqPs8BiI76EZ0F3q4yQ+VL zk4ooSGBfD/d/6tqi1B/UIoDiGweVMxBocRjB7wUkk4Jk1UbZemLMF95HA+e+5s7rb7J 7/R7xPpvWB6EY7mKry+RrglQjE8vhh2Dh2WanPG5jQdAjcBub0ST95qaS/H3JRZf93ok iXYqzq3y7KWy6pXxGMmBtCJ+Gkboy4TijgLvdI41Yc9FeCJ+oM9u/C7+uv/k77o4YNrx b16g== X-Forwarded-Encrypted: i=1; AHgh+Rrmu8ag3mmiZvzBKTCWwkg2hD3jCWAXqzv9uyaLK8dcsxbedOynn6/elXAW0ZIjha6jfSTGK6LRGyGwLnk=@vger.kernel.org X-Gm-Message-State: AOJu0YwbuJK+HaJoSP/XTtrCSadrN0kA4wI2x+OnfIzPixaWHLpOibUW +90K7vogmcsFFLapo12TuYRX/B3+DYTaU7pFrcwTo27L/tjoBHHtj3bAXoq9mKxKvA== X-Gm-Gg: AR+sD12ug6etTVJyQkZMX3Pakn52Fb/OxdGGU78MJ8tbYs5a6+QAULw1XMiH4Jg0Wzx D8WTEGD/kWIdCSsj8CDQoX5cbJlIFLk3vxwkLd4DS9j9S4QKxMb0xvh/wjvUHPjg5dvO+gScw/G NOwn70F1iGG1cS4Cxc6XLysnWiMmQqZ9MueVY+02BkskksdOFkbI3o/u1UQHGfp/WpmGB+2nJE8 T4Hp8VHFTa73nM/3D5k4LJ4ijHwEtn1xiiB/vuCxtedbh5Qu47XJOGd24EBgIbPcoi0OAciWag6 BPLoUYZZBFJpvv0cxnO8z0MrprbZkERGs2yZQaGzaZ9lFhkzjrQo3I/pNFTvfTCacS1NCIkkx7Z TIAj2BS9X+ygnSTSzSXOjdHmHqf1coaBHbEx8JZQKBhmxVDOsqiZWAHr6kTdLZ6BgcQemkfThBS I9INUVAXVpExmfxcaO+x/MS4DCQbenWKdbhXeomUQ8lDulw7PvBCCtA66Rm2vFlO3EA5wbvGEIa 3MJZ26BID4HKKI/CGpoNddzBt3yXKGJSy4AcX55k+y2rSFv X-Received: by 2002:a05:600c:6c09:b0:493:aca0:32e2 with SMTP id 5b1f17b1804b1-4995c06a0ccmr235105e9.4.1786045301935; Thu, 06 Aug 2026 12:41:41 -0700 (PDT) Received: from localhost ([2a00:79e0:288a:8:8b80:1ac5:3668:4014]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-47ff7b18368sm7435085f8f.20.2026.08.06.12.41.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Aug 2026 12:41:41 -0700 (PDT) From: Jann Horn Date: Thu, 06 Aug 2026 21:41:35 +0200 Subject: [PATCH] smack: fix cred UAF in smack_file_send_sigiotask() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260806-smack-uaf-fix-v1-1-26426d389a26@google.com> X-B4-Tracking: v=1; b=H4sIAG/jdGoC/6tWKk4tykwtVrJSqFYqSi3LLM7MzwNyDHUUlJIzE vPSU3UzU4B8JSMDIzMDCwMz3eLcxORs3dLENN20zApd47TUVFOLVNMUS6NUJaCegqJUoDDYvOh YCL+4NCkrNbkEZIhSbS0AMjQdG3EAAAA= X-Change-ID: 20260806-smack-uaf-fix-3fee58e5d92e To: Casey Schaufler , Paul Moore , James Morris , "Serge E. Hallyn" Cc: linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Jann Horn X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1786045297; l=1537; i=jannh@google.com; s=20240730; h=from:subject:message-id; bh=sSboF3nOx5Fbmhas6I6ey9seACJAKplyQAcNHv1o0WI=; b=I3ZfOezORja7D3V6dZUdiOZdMsOVgRHOaFgYMog5MQ+JKbSUKi8qBVN8gs4ATCd4kyTU6RByA TJxQfddNyziBOrMkSnfmhsvKOl5JJFPhifWoQZnk9iiFV8xSYex7hDN X-Developer-Key: i=jannh@google.com; a=ed25519; pk=AljNtGOzXeF6khBXDJVVvwSEkVDGnnZZYqfWhP1V+C8= When inspecting the credentials of another task, objective credentials (->real_cred, accessed with __task_cred()) must always be used. Accessing ->cred on a non-current task is forbidden unless that task is being created or destroyed; a task is allowed to change its own ->cred pointer with no synchronization, and changing ->cred should only affect the current syscall. smack_file_send_sigiotask() was accessing both sets of credentials: First tsk->cred, then __task_cred(tsk). Fix it, always access the objective credentials here. I have tested that this bug can lead to a KASAN-reported UAF of struct cred in smack_file_send_sigiotask(), and that this fix prevents the race. Cc: stable@vger.kernel.org Signed-off-by: Jann Horn --- security/smack/smack_lsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c index ff115068c5c0..bbe6cd6b03f7 100644 --- a/security/smack/smack_lsm.c +++ b/security/smack/smack_lsm.c @@ -1964,7 +1964,7 @@ static int smack_file_send_sigiotask(struct task_stru= ct *tsk, { struct smack_known **blob; struct smack_known *skp; - struct smack_known *tkp =3D smk_of_task(smack_cred(tsk->cred)); + struct smack_known *tkp =3D smk_of_task_struct_obj(tsk); const struct cred *tcred; struct file *file; int rc; --- base-commit: fcaeecb8b0cd44f77d03b28de0671258d4db18f8 change-id: 20260806-smack-uaf-fix-3fee58e5d92e Best regards, -- =20 Jann Horn