From nobody Mon Sep 28 05:45:46 2026 Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) (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 3158238838B for ; Tue, 25 Aug 2026 20:02:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787688139; cv=none; b=prhaipIgrv7zbWZ7O9ar9mb2z8P6JcNugGRsCIRfyogt24SSffWLQ3I029FhgUWyhnm5GQOJwOdcXc49Ib5q2qBbrP13jULLSwUZRhklKiprIoj9poAaXCwuOwJYEYoWJwKv4PN3a7z63YGDN2AVDm3Ilg62LmZc87MDQHI5Qac= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787688139; c=relaxed/simple; bh=qUBA6A9UnyHbYzJFPiZQnoAk4q/iuycPsbOtXqa6CtY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DtiYmwesd2DfeBoBcrKwAkPB559ROiV50IuV2Nm33JnVMW3awSerbdp42oe85lLskK9yzWhnTSOXeu4rR7szXOI7He3DFHVDXfdRCIt5JFVga6z8tHgJotTw67lQhKTUgNL1XNwjELrpPiJlntibwqJBjf3MJZ0vOxoIWpoSZA8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=ZxNFX/Ex; arc=none smtp.client-ip=209.85.167.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="ZxNFX/Ex" Received: by mail-lf1-f46.google.com with SMTP id 2adb3069b0e04-5b159850b16so166900e87.3 for ; Tue, 25 Aug 2026 13:02:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1787688136; x=1788292936; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=UX7g0ukijwjjIrziQAgaTHtTRLbta6EIpn4u0/mNSSE=; b=ZxNFX/ExHXAUebpdXw902S1auhenzWEpOXYRKpXDRFxK/PnER8g3/q3A1n3iYxE0lJ 2ZGTRh7QVBDpCsuX7vTjSddmtQi3qXZcOVGitmvXbWUHNlVkLMTMTrEx9ftNZs1RJ3vz 5bbr8ePrFKqJpOELdOiaKMmQmvpt0+zQ0UE8k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787688136; x=1788292936; h=cc:to:in-reply-to:references: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=UX7g0ukijwjjIrziQAgaTHtTRLbta6EIpn4u0/mNSSE=; b=XLYqG3jTucs4p8QotsTfQ4TRkynNyCe3YnPPJ5zN4O3mf7r7S/p9q8PW6pi1y+qJXB 8wGOQyeczZsYRaiYvCaLBN7Qcq/Af2FUHytaI+Ifc1be4pEUnfZFA7WJ8MJUEY1HtgFS zmWHbPDVkQnwEk0xu+SPrm5DWTzEKb49GqtIKTonjClkVLLO0Z+gmBQAlLxoGeEXD0i0 9xtmy/7wfw46fE6Mte+1Fmg2T1Q9dNHbxagk2jg99SlusHL0A3jxXjaPP71d1D0WW1T5 8Nbenj4v18MId9Om5SRJRUXY1T7PtAgiZXS/4eo4Ruwq8hDOsy+SmO6ukgLQ0WpKUz+6 8iXQ== X-Forwarded-Encrypted: i=1; AHgh+RreHMZ5eBB1WYxZ9IRj8C1aLv7jgJ1KKduYRklv60jMO9maseoET+3uJv1TS13wpLhkOjdg3oGARpR+VDI=@vger.kernel.org X-Gm-Message-State: AFuF++klz58cj5eeRGWo9CxsOzYwNk74MgO+u3BaqbjzmhtRD9UBCdxp PRrBQzH8k+RK4uF2rU8BjXm1wR/sjjjsLOWirP4VyOK69jcUpXPqz/Q/xRbHczqv/A== X-Gm-Gg: AR+sD13/gAa7fmIJL6+axrYhYGsfHOGsVMil2mDTjWaLjHDmUdNaHCZscfvEzn6lhsq d5mEvI+P2BogVeELX95LOiImWc8RSA9ZkvAPnnyrr/Uttr3MqfKuumNvzTBQylfZAJ/7tedesD9 A8BJeKqhSSOyywsQfiLvpIiuOWxMfZ8YFyqI1O1laKbkqvd31nAKJvhdchZ/7jzURBTiWoFzxBd Bd7XJ0+VTm/Ep0YikIdSxI+vHWGHGOLU7LU7+D81sz0T1FBamwf48WoDTnak8L69ouNrQHjdFif n0WT7382b1gldziiPfCY9s7YHI7XuFiNr/stPKTUX5yrwyIJjnp8+qnFdtGZEKaBs1qig04k6Mu LptIwed/Ggj5f5v3pmUJupimsmpQS0MZtYRqxwM6kpUnBlNNdteHybSL5NNJ+bk+5B6mQV/w5KZ VdZA//9LKHHDBA7Ip8j3QnsBzcWUdfxLpVu2LJpuJpsV1SThTvfDid8M0u7U//pcIMeoz3hTuwA onJu4auN8xHjhfwGxsP4YOxEt1ICj8nLpVqrc3pnikdarb6eg== X-Received: by 2002:ac2:5e8a:0:b0:5b1:537b:de9b with SMTP id 2adb3069b0e04-5b4a9064b4amr172876e87.19.1787688136158; Tue, 25 Aug 2026 13:02:16 -0700 (PDT) Received: from ribalda.c.googlers.com (11.36.88.34.bc.googleusercontent.com. [34.88.36.11]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5b4a41533c5sm135381e87.15.2026.08.25.13.02.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Aug 2026 13:02:15 -0700 (PDT) From: Ricardo Ribalda Date: Tue, 25 Aug 2026 20:02:10 +0000 Subject: [PATCH 1/2] rcu: Fix casting while dereferencing rcu pointers 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: <20260825-unqual-v1-1-7024fb81b4f9@chromium.org> References: <20260825-unqual-v1-0-7024fb81b4f9@chromium.org> In-Reply-To: <20260825-unqual-v1-0-7024fb81b4f9@chromium.org> To: "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Uladzislau Rezki , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Zqiang , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Dan Carpenter Cc: rcu@vger.kernel.org, linux-kernel@vger.kernel.org, Ricardo Ribalda X-Mailer: b4 0.14.3 Recent versions of smatch preserved the address space qualifiers with typeof()[1]. This fix has discovered an invalid casting in rcu dereference logic. This patch fixes tens of smatch errors like the following: ./include/trace/events/vb2.h:46:1: warning: incorrect type in assignment (d= ifferent address spaces) ./include/trace/events/vb2.h:46:1: expected struct tracepoint_func *it_f= unc_ptr ./include/trace/events/vb2.h:46:1: got struct tracepoint_func __rcu * [1] https://github.com/error27/smatch/commit/e53027a4e816a772403baafa83c09e= 4a94c1cb8f Signed-off-by: Ricardo Ribalda --- include/linux/rcupdate.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index 44c07a66edff..80276cedda80 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h @@ -488,7 +488,7 @@ static __always_inline bool lockdep_assert_rcu_helper(b= ool c, const struct __ctx context_unsafe( \ typeof(*p) *local =3D (typeof(*p) *__force)(p); \ rcu_check_sparse(p, __rcu); \ - ((typeof(*p) __force __kernel *)(local)) \ + ((TYPEOF_UNQUAL(*p) __force __kernel *)(local)) \ ) /** * unrcu_pointer - mark a pointer as not being RCU protected @@ -503,7 +503,7 @@ context_unsafe( \ ({ \ typeof(*p) *local =3D (typeof(*p) *__force)READ_ONCE(p); \ rcu_check_sparse(p, space); \ - ((typeof(*p) __force __kernel *)(local)); \ + ((TYPEOF_UNQUAL(*p) __force __kernel *)(local)); \ }) ) #define __rcu_dereference_check(p, local, c, space) \ ({ \ @@ -511,19 +511,19 @@ context_unsafe( \ typeof(*p) *local =3D (typeof(*p) *__force)READ_ONCE(p); \ RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_check() usage"); \ rcu_check_sparse(p, space); \ - ((typeof(*p) __force __kernel *)(local)); \ + ((TYPEOF_UNQUAL(*p) __force __kernel *)(local)); \ }) #define __rcu_dereference_protected(p, local, c, space) \ ({ \ RCU_LOCKDEP_WARN(!(c), "suspicious rcu_dereference_protected() usage"); \ rcu_check_sparse(p, space); \ - ((typeof(*p) __force __kernel *)(p)); \ + ((TYPEOF_UNQUAL(*p) __force __kernel *)(p)); \ }) #define __rcu_dereference_raw(p, local) \ ({ \ /* Dependency order vs. p above. */ \ typeof(p) local =3D READ_ONCE(p); \ - ((typeof(*p) __force __kernel *)(local)); \ + ((TYPEOF_UNQUAL(*p) __force __kernel *)(local)); \ }) #define rcu_dereference_raw(p) __rcu_dereference_raw(p, __UNIQUE_ID(rcu)) =20 --=20 2.55.0.897.gb25b4bd76c-goog From nobody Mon Sep 28 05:45:46 2026 Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) (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 3479F3B42CC for ; Tue, 25 Aug 2026 20:02:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787688140; cv=none; b=I5sJwGb/IOOu776FfDFFjH+sqiHX/p3FiyDPRMIovuwCbCpUyGbGHxv/P8TYOWa4e+l/16neCLiI0yLyTpM/Bhpvlww55zJmyR8qi5cj38rWNfbGBE71RV/DnmbZ7cDvoJmrSJnNla/qCMeSONMuALAzI8Mg6Dg8U7YAFbDVbGA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787688140; c=relaxed/simple; bh=I4fpEQQE9zFc0xnAO9CBIB2LJQb63RqiIeKZFmwOlzw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=C4g1Jn7bNkUv+Qffql6h12zwjKPc5288ssTBpq39d17xmLT98GtDO6s7Mwx1TlBZeWehqAAdPvny7F/Hu6Sl4INEDv5PANvsQDVtUgAzMgfqw6nvV9bzUlOffdABMgOjmrJWKC48GOxBpHoKV3VVtHHxVGv9R6zYCF05/uqNluc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=ClfAUPwa; arc=none smtp.client-ip=209.85.167.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="ClfAUPwa" Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-5b15dcaca31so182121e87.0 for ; Tue, 25 Aug 2026 13:02:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1787688137; x=1788292937; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=GTVqDctRrMjBLA2E0tBTgvop5gHmOnA0BG3Qw1HtV1U=; b=ClfAUPwaqsMFUkAZpT875RLTyqz/pDVtGDKsrOIUiAYuoUmvIzLkAJ1g2Pd2uNoTFq M8cy4xgalegUZgqsBKElZjPZGb9gviFMYEkUeJVtUFJ4aCvBHfWAJh6jc982/iwLZ0zG S5ZFJvDZs8QiB1gNGugLCrtGrOoJaI3cxH/vU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787688137; x=1788292937; h=cc:to:in-reply-to:references: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=GTVqDctRrMjBLA2E0tBTgvop5gHmOnA0BG3Qw1HtV1U=; b=qQ/+6A+sWF+ogM84pg3/RKeHgPlkIfVOBSDd4sknJZ5Fmnkq1uhU4ZfDx6A6xpYHr7 3nLfElaUHeH6okt9wO1eHgw9SIa4aIAabXzntMHn+Mou3OgxWRKD285uE2zQNXv7o70+ JaDQcsXKo988/7h2dgLfIHXTtTh6gfMfOiT5SBDCqanBfjXhC5U18Xuz0m8Itiu0mSGB UdDJbGZrrdtjVFGijHiQa2PHGmGjgCx430u0yY24J34FAVrl+DWPlH7Yc0jgIfYPUiLX kbst2APqT5C3mxCAYMWUVXPjsEwbDpk+GEp8Sq3ABarGJAHYXMj9BKPBjQYsgoHV7F/J k50g== X-Forwarded-Encrypted: i=1; AHgh+Ropiob1IarfXH3WJuXaxo6WB8nPBZILPWVn1zmdGDYZFHBB3k+mdJN7+gj4obbxgA6tNCtGiAILz1uuAXU=@vger.kernel.org X-Gm-Message-State: AFuF++kXZZPbGTbHjdiNId8p1IvCg727//Q2Oj5q2s1idfu3Im1nbI3L fNhptLBBgoS3kh1JutUDxsPslgiIuWApLLTR1lUDi6LLSXQ5/GrXbEaGWD/Bw+rXdw== X-Gm-Gg: AR+sD11TFet5+FfcMZ33q3CfMnp8ElvA1S2hqcLRiBw/MyvY3zkm6fweyC998BixkuE i2w7/6De0CEhfB79G8Cf9C6ZbN5UmbwN4tv2LHpzgKeMnyoExcnZmxaovjdM/R7vNnE3a+/XCuO +KMJHI955+EKNJyX3nR3XteqzLM4KIvm6tdAqd/lrDOXuhbmWtIDPgvqjVEgWBqMc9CraBZNbyP 0+WdziREAG4i5KzZ6YScpGyzOsNFe9tHyZ4343LIhPzjbu6P8IeYOFgopi6AS5iAE7DShv/laRP j8GyZfzOlDEjOXSBM2+m8ipI3+HNycp3LsKHD5rw5EeWud6zYVwGgyt7dYihy3jNxVUUK7WBHSe IdX2V3nMN2eDENjMrcSlj2jGqb0F+TPudh+6TDGFegckrIkoCInF4k40pAWuHJ/ivzQTPNQCPrW vVFcW4KKrSvJbIUFl6poHNLcWu530LTHP/S6T5xgy/7lbQRSr3aEX2l0j9KxTrz9Ow3Wzdnb1lT 2X9AMBBeVmI4h5UKH1QGqcqCD2wjBYpsMbusxA= X-Received: by 2002:a05:6512:6399:20b0:5ae:b8f8:77ce with SMTP id 2adb3069b0e04-5b4a906a95emr148221e87.23.1787688137080; Tue, 25 Aug 2026 13:02:17 -0700 (PDT) Received: from ribalda.c.googlers.com (11.36.88.34.bc.googleusercontent.com. [34.88.36.11]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5b4a41533c5sm135381e87.15.2026.08.25.13.02.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Aug 2026 13:02:16 -0700 (PDT) From: Ricardo Ribalda Date: Tue, 25 Aug 2026 20:02:11 +0000 Subject: [PATCH 2/2] x86/uaccess: Fix casting in put_user 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: <20260825-unqual-v1-2-7024fb81b4f9@chromium.org> References: <20260825-unqual-v1-0-7024fb81b4f9@chromium.org> In-Reply-To: <20260825-unqual-v1-0-7024fb81b4f9@chromium.org> To: "Paul E. McKenney" , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Uladzislau Rezki , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Zqiang , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Dan Carpenter Cc: rcu@vger.kernel.org, linux-kernel@vger.kernel.org, Ricardo Ribalda , Dan Carpenter X-Mailer: b4 0.14.3 Recent versions of smatch preserved the address space qualifiers with typeof()[1]. This fix has discovered an invalid casting in put_user. This patch fixes tens of smatch errors like the following: drivers/media/usb/uvc/uvc_v4l2.c:1112:13: warning: incorrect type in argume= nt 2 (different address spaces) drivers/media/usb/uvc/uvc_v4l2.c:1112:13: expected void const *from drivers/media/usb/uvc/uvc_v4l2.c:1112:13: got unsigned int __user * [1] https://github.com/error27/smatch/commit/e53027a4e816a772403baafa83c09e= 4a94c1cb8f Suggested-by: Dan Carpenter Signed-off-by: Ricardo Ribalda --- arch/x86/include/asm/uaccess.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/uaccess.h b/arch/x86/include/asm/uaccess.h index 3a0dd3c2b233..4e576c0b9131 100644 --- a/arch/x86/include/asm/uaccess.h +++ b/arch/x86/include/asm/uaccess.h @@ -172,7 +172,7 @@ extern void __put_user_nocheck_8(void); int __ret_pu; \ void __user *__ptr_pu; \ register __typeof__(*(ptr)) __val_pu asm("%"_ASM_AX); \ - __typeof__(*(ptr)) __x =3D (x); /* eval x once */ \ + TYPEOF_UNQUAL(*(ptr)) __x =3D (x); /* eval x once */ \ __typeof__(ptr) __ptr =3D (ptr); /* eval ptr once */ \ __chk_user_ptr(__ptr); \ __ptr_pu =3D __ptr; \ @@ -231,7 +231,7 @@ extern void __put_user_nocheck_8(void); =20 #define __put_user_size(x, ptr, size, label) \ do { \ - __typeof__(*(ptr)) __x =3D (x); /* eval x once */ \ + TYPEOF_UNQUAL(*(ptr)) __x =3D (x); /* eval x once */ \ __typeof__(ptr) __ptr =3D (ptr); /* eval ptr once */ \ __chk_user_ptr(__ptr); \ switch (size) { \ --=20 2.55.0.897.gb25b4bd76c-goog