From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796300522; b=t3YuC2qYrBgjl31ZtvvWyRz6FU6I1Ht6hLg15eoPpf9uLmCxbH2VnRg7b9DLC19ZPx4y d1ype9DBcrwgU7Qmi4lGaNbX2MJd2A/24latoOQtjw1iFhv9QdkAFoO35l+jKUT86kQlA V6grqroSKYLxF2tDCiFeDUGWTZVlLcvzjxk05dhGa6qUE1U4FFD09+HHAYB4ibAdcMaNy YhRABNhs5L8gia1ptMS0d0DaqBs+3NLh6kFrOJeClrkN+/qOts8vYEjZcFJajD27gWucM YQrdkkERR/CI0qBXBEWsdluxIoiAg/IZAqCKlg+0FJgY1gz5O0VJmTOB9oqr+0USYew== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796300522; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=VHG+UkoF/l8RIlyr7FGJ3ceOT8/9XqY+Fyc4ZwSvaME=; b=Sb/RlM/RUVwizgKYcn58DCnu4v3GO5WtrGgAU/iGTb7FVYbpjnmNAEMz2vm4lch9JzM/ twzg4Eu03JdKVILMpnexogf9H0DLmQKofppSax/6UsCDLRBOeQ4lTo1OhFY9UaDalrHtX hjibx7z8iRkNmPrW6NFD+qMo1JTi2UT8kO+8r9gotsn/sXtrKSbW2vYtZTCKtMMOFwZ8M IuaamEBl4Hr/5Ik/eP49eWfVlJz/+PPjtk2x5rCeewwbWENrybeHM2u64zQk099YkhKZR aked6RNJQW5IDenfUqskln8r87HLW2mT2ovnGRQbvfzjDwKwWF8+hwg/B3uJMILiJUQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=FGLG6YxB; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D0676606A333 for ; Thu, 3 Dec 2026 12:22:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=FGLG6YxB Received: by smtp.kernel.org (Postfix) with ESMTPSA id 362871F00899; Thu, 3 Dec 2026 12:22:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796300522; bh=VHG+UkoF/l8RIlyr7FGJ3ceOT8/9XqY+Fyc4ZwSvaME=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=FGLG6YxBBmthROd8x+PLRSEPXEimeNGdqUME0a2K+aJwykr146ks9vG71B9k93OfV RpVPRPlTJULjAYd+oMKh8DYDqW+5yWae3w7PRZLQWJ/qAk0VqIfTRetjpiOBLgPlNe TRUjcMmuusIoDK4p5mJCU18NSrG5ofmmOHc6nSunj2/tlWaEJWreLymU8F2DKIhFUO bbDXSA7HhaT+JVbRnVnB1unIjZFvIxSzZZT977wWtzVUdtlAvKUGfdbCBOBn/34QID 0VA/tg3XkC5Oc35LO2cFTcbF41+ZNr2o9RflzNAooaIBR+cyk6PxRd8WBQglhpUPJj PAzcOg29Vi2kA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH can-next v5 02/24] can: isotp: read socket options under conf_lock in isotp_getsockopt() Reply-To: sashiko-reviews@lists.linux.dev To: "Oliver Hartkopp" , linux-can@vger.kernel.org Cc: "Marc Kleine-Budde" , "Vincent Mailhol" , "Oleksij Rempel" In-Reply-To: <20261203-getsockopt-memcg-isotp-v5-2-bbe89b3d3b71@hartkopp.net> References: <20261203-getsockopt-memcg-isotp-v5-0-bbe89b3d3b71@hartkopp.net> <20261203-getsockopt-memcg-isotp-v5-2-bbe89b3d3b71@hartkopp.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 12:22:01 +0000 X-Mailing-List: linux-can@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] can: isotp: uninitialized stack padding leak in isotp_getsockopt() -- commit d17434ceea1b8050b1dc60722582615a030c16f4 Author: Oliver Hartkopp can: isotp: read socket options under conf_lock in isotp_getsockopt() This commit copies the CAN_ISOTP socket options into a local stack union under so->conf_lock in isotp_getsockopt(), then copies the result to user space after releasing the mutex. > diff --git a/net/can/isotp.c b/net/can/isotp.c > index 642fec500af9d..98a7e489ca3e5 100644 > --- a/net/can/isotp.c > +++ b/net/can/isotp.c [ ... ] > @@ -1862,8 +1862,14 @@ static int isotp_getsockopt(struct socket *sock, i= nt level, int optname, > { > struct sock *sk =3D sock->sk; > struct isotp_sock *so =3D isotp_sk(sk); > + union { > + struct can_isotp_options opt; > + struct can_isotp_fc_options rxfc; > + struct can_isotp_ll_options ll; > + u32 stmin; > + } val; > int len; > - void *val; > + int err =3D 0; [ ... ] > case CAN_ISOTP_RECV_FC: > len =3D min_t(int, len, sizeof(struct can_isotp_fc_options)); > - val =3D &so->rxfc; > + val.rxfc =3D so->rxfc; > break; [ ... ] > case CAN_ISOTP_LL_OPTS: > len =3D min_t(int, len, sizeof(struct can_isotp_ll_options)); > - val =3D &so->ll; > + val.ll =3D so->ll; > break; [ ... ] > if (put_user(len, optlen)) > return -EFAULT; > - if (copy_to_user(optval, val, len)) > + if (copy_to_user(optval, &val, len)) > return -EFAULT; [Severity: Low] Can this leak an uninitialized stack byte to user space on ARM OABI? Both struct can_isotp_fc_options and struct can_isotp_ll_options have three __u8 fields without __packed, so under ARM OABI (!CONFIG_AEABI) they are padded to 4 bytes. C struct assignment need not copy padding bytes, and val is uninitialized on the stack, so copy_to_user() can leak 1 uninitialized byte to an unprivileged caller when CONFIG_INIT_STACK_ALL_ZERO is disabled. Zero-initializing val with memset() or copying with memcpy() avoids this. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203-getsockopt= -memcg-isotp-v5-0-bbe89b3d3b71@hartkopp.net?part=3D2