Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4287209rdb; Mon, 11 Dec 2023 14:51:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IEgnsFShNzwG4UwQaAhbYu+1bomCDb9laHb5fo+a01pKHJOmS9D8z7tbitc1Wm4RqCxMTeW X-Received: by 2002:a05:6358:52c2:b0:170:e12b:c73f with SMTP id z2-20020a05635852c200b00170e12bc73fmr1444313rwz.52.1702335075370; Mon, 11 Dec 2023 14:51:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702335075; cv=none; d=google.com; s=arc-20160816; b=vMO/U7fh4Ayl8H30HcZKtbvRhx6+wfYp+hjkpCHgjRApTBpCBg19P3tgkA3aSfHamj wys5PGty48rzyvw7qIYH2RcnMCY6lLWGmSyRfRHZVDd2bKwd0nsHPVIszeoZXxwQi9ds +B6kw0e85ZQylTAb4Kj+1cmlWYk9XMKNmUXewNmLsxLaIUgH1TrlYN4DKXEcx3yhbFQC bErkjbFU/4drhkSZWdScZEqyn0Gjp02QSFeLOpC13cfDvesoKZGNLOUHS2x5cD1EZWo7 S94E3KcKCYL7I6VkmuRBPUKX/Du2RU6htZ8iSp9qcwnxtSLxmZ27YCAhdL7faFu3sSkT CREw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=tTJlVsXBi7y2TQE7P+0CqLTO4ot/KrhtAj+ptWJNgtk=; fh=oeWWgArGQrov3Bk7L7Hu86tiRgGctzah9oHkOQZBlMM=; b=bAq4l2V2iYUi48MxLtkmIo9dAatIbnJTUFcNtKn48uu1efVK7oypJUxbrKdU/yso2L YS1msowKKhefIN2e+HSxffsWcx2wF3/isbirlU393hqEeaMQlpFMpJan3PBa+3+oTcO/ A3eLT7/3kETy7Jrz7r3VaxkeGDG8CYLIptKQOUlEqnd9uyU/G6HP12f20swbXUJobyqL rGEypHlRriuT5EU6QIgGX0SA4VXhV82W9kXWHplvw9BFSWjz6NEh0o4D+Bhz5QsK4QGa LW0XNCvfPu3bNC3eeSbtrtONPGz2GIToLSt5YXCsMlI4jND040luDMccJqKndvZ4IDFr uzew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aKyFYFp7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id cp10-20020a17090afb8a00b00285be1801d8si6802656pjb.101.2023.12.11.14.51.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 14:51:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aKyFYFp7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id CC99D80A91AC; Mon, 11 Dec 2023 14:51:13 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345023AbjLKWvE (ORCPT + 99 others); Mon, 11 Dec 2023 17:51:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229562AbjLKWvD (ORCPT ); Mon, 11 Dec 2023 17:51:03 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6C328C2 for ; Mon, 11 Dec 2023 14:51:08 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8466DC433C8; Mon, 11 Dec 2023 22:51:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702335068; bh=1CCbYByQIoadE0Uqf+KApKn4LZFBzrE7oNUkmsRIU6Q=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=aKyFYFp7TmGl8P5u1cOH6e1xl0twZ/fGEwcbqiBlg+eu26ORfM8M5fUCw1B3zVKbC BibBHwVGke8ZxpIUuqtOU/hv5CiZ98o9L9un7oxm3l+k3SKDzspADXq3SKuiRIdciu 6iNKRQLi2yJxAsz0sLVFQHrKizQIvEclvjfJEq+ZYZvMi6adbQ3Hb8VBhBOIOX71Gj wscoNoMiOTxH6qQ3kFcoulQj6Rso+RzvT792sjeFp/Dv0l3H+rpKX3fncXEM0WkL8r umtVd2NfTO/NF8SYYGXon7pb3b93iTUWK2QW7IcP3lIOAyg0ey+aLLqgpJwTVC+Qec u/l3UbwNUFUvw== Date: Mon, 11 Dec 2023 22:51:04 +0000 From: Conor Dooley To: Alexandre Ghiti Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, syzbot+afb726d49f84c8d95ee1@syzkaller.appspotmail.com Subject: Re: [PATCH -fixes] riscv: Fix wrong usage of lm_alias() when splitting a huge linear mapping Message-ID: <20231211-deviancy-uncooked-6a24328f6200@spud> References: <20231211141929.74027-1-alexghiti@rivosinc.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="3GQRIqzq/daVXmBi" Content-Disposition: inline In-Reply-To: <20231211141929.74027-1-alexghiti@rivosinc.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 11 Dec 2023 14:51:14 -0800 (PST) --3GQRIqzq/daVXmBi Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Dec 11, 2023 at 03:19:29PM +0100, Alexandre Ghiti wrote: > lm_alias() can only be used on kernel mappings since it explicitly uses > __pa_symbol(), so simply fix this by checking where the address belongs > to before. >=20 > Fixes: 311cd2f6e253 ("riscv: Fix set_memory_XX() and set_direct_map_XX() = by splitting huge linear mappings") > Reported-by: syzbot+afb726d49f84c8d95ee1@syzkaller.appspotmail.com > Closes: https://lore.kernel.org/linux-riscv/000000000000620dd0060c02c5e1@= google.com/ > Signed-off-by: Alexandre Ghiti =2E./arch/riscv/mm/pageattr.c:311:14: warning: variable 'ret' is used unini= tialized whenever '&&' condition is false [-Wsometimes-uninitialized] > --- > arch/riscv/mm/pageattr.c | 13 ++++++++++--- > 1 file changed, 10 insertions(+), 3 deletions(-) >=20 > diff --git a/arch/riscv/mm/pageattr.c b/arch/riscv/mm/pageattr.c > index fc5fc4f785c4..f5f8aa1d38d6 100644 > --- a/arch/riscv/mm/pageattr.c > +++ b/arch/riscv/mm/pageattr.c > @@ -304,9 +304,16 @@ static int __set_memory(unsigned long addr, int nump= ages, pgprot_t set_mask, > if (ret) > goto unlock; > } > - } else if (is_kernel_mapping(start) || is_linear_mapping(start)) { > - lm_start =3D (unsigned long)lm_alias(start); > - lm_end =3D (unsigned long)lm_alias(end); > + } else { > + if (is_kernel_mapping(start)) { > + lm_start =3D (unsigned long)lm_alias(start); > + lm_end =3D (unsigned long)lm_alias(end); > + } else if (is_linear_mapping(start)) { > + lm_start =3D start; > + lm_end =3D end; > + } else { > + goto unlock; > + } > =20 > ret =3D split_linear_mapping(lm_start, lm_end); > if (ret) > --=20 > 2.39.2 >=20 >=20 > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv --3GQRIqzq/daVXmBi Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRh246EGq/8RLhDjO14tDGHoIJi0gUCZXeSWAAKCRB4tDGHoIJi 0sVlAP0T5/oaW6j/LkQ397MBYUvh8Eco7FXATW3thQaTZIN6qgD/XGQBW9AY5sDC 2YwV/oLkT6RTgaar8D58YdjsAjmF+g0= =g9/e -----END PGP SIGNATURE----- --3GQRIqzq/daVXmBi--