From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D22DE8181A for ; Tue, 26 Sep 2023 11:12:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230042AbjIZLM4 (ORCPT ); Tue, 26 Sep 2023 07:12:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229556AbjIZLM4 (ORCPT ); Tue, 26 Sep 2023 07:12:56 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0664FE5; Tue, 26 Sep 2023 04:12:50 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A136C433C8; Tue, 26 Sep 2023 11:12:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695726769; bh=RCT3ksFfxXJUFEFoooNTpXtMGpORVm3wt6SDo0yzwmE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=PnSQ4fEY9EzdNCHhk5QjY7a7Lr6P7QiEj7kurskRLU+lPsoG8n2MMxSPQuWYUfus/ 6JfLmXgWJinhzUbLWYvfRgn9PGR3JOc76sxGakLjyXP9cPSSK71LGuZ/Atco6Nq5DE SJJBmHOiqR4C1E6XlOebea00znq68BFinA5mj+gC11ziLIwtl02ECX1Ye76uabp/SH hbppwmjIlZ/tMX6DPMbqPfO6rf7AntkbdRujTam9AO/Mcn1SzGi2ItClO+iSI0sDmU fy+pF5ntNp/g5rRWMSgXeVzQsNUxTgfV3JKY/tYhqAJf/K5kxJl7i0rV4j5n/xX1mJ 3TojyEDcyRcDg== Date: Tue, 26 Sep 2023 12:12:45 +0100 From: Conor Dooley To: Edward AD Cc: syzbot+8d2757d62d403b2d9275@syzkaller.appspotmail.com, gregkh@linuxfoundation.org, jirislaby@kernel.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, syzkaller-bugs@googlegroups.com Subject: Re: [PATCH] riscv: fix out of bounds in walk_stackframe Message-ID: <20230926-shorter-acetone-25a93d7ab27c@spud> References: <0000000000000170df0605ccf91a@google.com> <20230926105949.1025995-2-twuufnxlz@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="MisKy8cQA+A+qNEs" Content-Disposition: inline In-Reply-To: <20230926105949.1025995-2-twuufnxlz@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-serial@vger.kernel.org --MisKy8cQA+A+qNEs Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hey Edward, Where did you come up with the CC list for this patch from? Please run get_maintainer.pl on your patches and CC the output. You've not CCed any relevant developers on this mail :( On Tue, Sep 26, 2023 at 06:59:50PM +0800, Edward AD wrote: > Increase the check on the frame after assigning its value. This is to pre= vent=20 > frame access from crossing boundaries. >=20 > Reported-and-tested-by: syzbot+8d2757d62d403b2d9275@syzkaller.appspotmail= =2Ecom Please also add a Fixes: tag & a Closes: tag with a link to the report when you do so. Thanks, Conor. > Signed-off-by: Edward AD > --- > arch/riscv/kernel/stacktrace.c | 2 ++ > 1 file changed, 2 insertions(+) >=20 > diff --git a/arch/riscv/kernel/stacktrace.c b/arch/riscv/kernel/stacktrac= e.c > index 64a9c093aef9..53bd18672329 100644 > --- a/arch/riscv/kernel/stacktrace.c > +++ b/arch/riscv/kernel/stacktrace.c > @@ -54,6 +54,8 @@ void notrace walk_stackframe(struct task_struct *task, = struct pt_regs *regs, > break; > /* Unwind stack frame */ > frame =3D (struct stackframe *)fp - 1; > + if (!virt_addr_valid(frame)) > + break; > sp =3D fp; > if (regs && (regs->epc =3D=3D pc) && (frame->fp & 0x7)) { > fp =3D frame->ra; > --=20 > 2.25.1 >=20 --MisKy8cQA+A+qNEs Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZRK8rQAKCRB4tDGHoIJi 0kqjAP90g4/G1TGVcQIXrpJ/IpCj6h9HaqBw4HfNIj6uQ/YO8gD/WqV+EnH6Ri0n 4R16KfJi3y1+MrAgywo2gRnpSYCSfQA= =OI2P -----END PGP SIGNATURE----- --MisKy8cQA+A+qNEs--