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=1796453594; b=qBOMih66gnO/YyatDwzvFDht1rqC0gsvDgHVMfJPbEyZjouPhEdl758++ZLJxufW774r tjao2SujJ+XRv/ujC1YB1Dt+5eahGsujrqvJ7ywExqb/cFzI629R5FM2hnMeujhyM4MqK xhMdUfwysucd4lPh01E7mO0ZKvdtFpG3M0pZr5Qy6/Zt1h2BBBCEEQiNcCNnx8j9E4Oih FIHJNSLK/VPdjanvR3JN8QiG77K3N+rCly1cjF7TVXv1Sti0YPXG8yzcSsTkSUf45VtHo iUDhCPdw/ddLPWBEn89fNw9Uvxm2cqgsuEqhOPuivyOM3bRKbJ/LOIKVQHek2YwXAFw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796453594; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=E+G45mFWnje052JdwqdysuiI5Qvio8KIBlxcOHhpOEo=; b=JJFnwnGQ4bggybA3dkV0IUb2dCtE7EY0+8uaQ06yZarjqJmH3B6E9Xe3oODUb29Zan/0 sk++bg+3xu3lUsfNpK9BcYEyKlyBCGAsjHZ/R2Hx+hzkrc+s+4t+A+ETaJQH58uFeqn/F 139BdSLWY2y3NqbvsqVRHO5dmtot9AFbCgLoIvdPmT0U15RDFomxuVwnEaMQEKPam0ogZ cvbzpNpQuo4PRVxcEEhlvw7/6KCJ2ieBzQ41O1Ax5tMh2ToMcd4Uqmp5r8QfmOIi2tdpk Gkj0dwHYXxwfkOIU39WcY9/6/d+sKoFucaHtLk2Q7bCY7Bl2mC3TkN4UkF6vedQWtVA== 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=m4HyZbDp; 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 47B40606A322 for ; Sat, 5 Dec 2026 06:53:14 +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=m4HyZbDp Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA79B1F0092B; Sat, 5 Dec 2026 06:53:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796453594; bh=E+G45mFWnje052JdwqdysuiI5Qvio8KIBlxcOHhpOEo=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=m4HyZbDpNS2G9j7V0q1XBfvy+chSo83faYXmr0anKjqbB2yYprReE1SIf8ek1bumt zJwhRyyw4jfB8EuZidyWYb24wKj4XD+oi/1IDeH/E5yEKOEXd8dghU9G7I1Dts/vBf fM8SMkiBrOaJCq2b2zxUMS+MIiUqEtW7hr8CRs6k0XSzaHd6B2Zl3rj5hEKvubsTeN HLsXwSylAC75s3FWWiwXPJuQAdBcBQce4g58pDeXWtBTBY3l+NWv49VpjfR4uG85jc HlLLNsBu6UnrFVL8ol+71/8VHqfvjd28UPvzBkvtOToIRWMMi7RJUZWtZmtocpXZCT /wE5RhF/qenCg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 1/4] tty: hvsi: fix stack overread in hvsi_version_respond() Reply-To: sashiko-reviews@lists.linux.dev To: "Praneeth Balasubramanian" Cc: linux-serial@vger.kernel.org In-Reply-To: <20261205063536.2519566-2-praneethb2002@gmail.com> References: <20261205063536.2519566-1-praneethb2002@gmail.com> <20261205063536.2519566-2-praneethb2002@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Dec 2026 06:53:13 +0000 X-Mailing-List: linux-serial@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: - [Medium] tty: hvsi: incomplete fix leaves stack overreads in hvc_put_chars() callers -- commit b74704ec7a06e3ab6946c94e8953559355686fee Author: Praneeth Balasubramanian tty: hvsi: fix stack overread in hvsi_version_respond() This commit copies the 12-byte struct hvsi_query_response packet in hvsi_version_respond() into a zeroed, aligned 16-byte stack buffer before passing it to hvc_put_chars(). > diff --git a/drivers/tty/hvc/hvsi.c b/drivers/tty/hvc/hvsi.c > index a94068bce76f3..ec91ee42ad8c0 100644 > --- a/drivers/tty/hvc/hvsi.c > +++ b/drivers/tty/hvc/hvsi.c > @@ -279,7 +279,9 @@ static void hvsi_recv_response(struct hvsi_struct *hp= , uint8_t *packet) > /* respond to service processor's version query */ > static int hvsi_version_respond(struct hvsi_struct *hp, uint16_t query_s= eqno) > { > - struct hvsi_query_response packet __ALIGNED__; > + struct hvsi_query_response packet; > + /* hvc_put_chars() reads 16 bytes even if count is smaller. */ > + uint8_t buf[16] __ALIGNED__ =3D {}; > int wrote; > =20 > packet.hdr.type =3D VS_QUERY_RESPONSE_PACKET_HEADER; > @@ -292,7 +294,8 @@ static int hvsi_version_respond(struct hvsi_struct *h= p, uint8_t *packet) > pr_debug("%s: sending %i bytes\n", __func__, packet.hdr.len); > dbg_dump_hex((uint8_t*)&packet, packet.hdr.len); > =20 > - wrote =3D hvc_put_chars(hp->vtermno, (char *)&packet, packet.hdr.len); > + memcpy(buf, &packet, sizeof(packet)); > + wrote =3D hvc_put_chars(hp->vtermno, buf, packet.hdr.len); [Severity: Medium] Should this be fixed in hvc_put_chars() instead of working around it in hvsi_version_respond() alone? Patching only this call site leaves the same stack out-of-bounds read in other callers of hvc_put_chars(): hvsi_query() (6 bytes), hvsi_set_mctrl() and hvsi_close_protocol() (14 bytes) in this file, hvsi_send_packet() in drivers/tty/hvc/hvsi_lib.c, and hvc_poll_put_char() (1 byte). On every HVSI handshake, hvsi_query() still triggers a 10-byte stack overread, causing KASAN stack-out-of-bounds reports and loading adjacent stack bytes into H_PUT_TERM_CHAR hypercall registers. Copying count bytes (clamped to MAX_VIO_PUT_CHARS) into a zeroed, aligned 16-byte local buffer in hvc_put_chars() in arch/powerpc/platforms/pseries/hvconsole.c would fix all callers at once. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261205063536.2519= 566-1-praneethb2002@gmail.com?part=3D1