Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1158125rdb; Mon, 2 Oct 2023 00:17:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEsLkf834z3EqbHPNtYjRmDHgXdOgPOwugfGlUDtf03nKQBS9LhcmQXP9Jh52yqMCH2lWvE X-Received: by 2002:a54:4f1d:0:b0:3a9:cfb5:462a with SMTP id e29-20020a544f1d000000b003a9cfb5462amr8954543oiy.36.1696231027977; Mon, 02 Oct 2023 00:17:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696231027; cv=none; d=google.com; s=arc-20160816; b=wJ4laTYyKgEjl/rTUVeESg+FoHdi0mPYaOHfY/V7ZJtw+yluy113EMlX71QvZ/JnJD Hdt7wsNFjd7G2/HxcdgtAiKKbvcTJKxDXRwN6TzFKs9zloZpTPTbEUSJwIgXn+XriZ7o BTB61KaVmQUkgKIl2v2i+3ZYrXTqOAocPtaKxSjmyAf15rhNj4gqX6iUrtXz3oXPcYcu WCdXUiHi6yuRpgJBYdPLkWcYkkBm3pWlhXXX8101MUqDQ6WAdLUcZ9TlabMD4LlWDyn9 3vVBqkUihAnqs9cBg3uMak+doZyKVl2R4JuMwlB1nhLJ9DC8BONZp9sT7L23u7nK5fKU ZOdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=vyEJm0Vs8HzMk1ARIArOtOc0lGgfBnw3jKoPIGWI2IU=; fh=EVEcJI+L5pGYj+7NktINbY0iXqDkfT0Aus4X15ZBu+o=; b=h9ROT3y6e47HwjYm2mP8eBM4klbO+X5YcqDSOLjvThv+904+zcBjDDtoYnhHEY2Ei5 oPgxajujTd5qurd4anfOd+rXPttI7/9JWmMXZEaqLOpDCr0Abxrire8EmedfuCGmYIA0 DaTNykBrkiRINyPFlPM3vLycTRCDEKTJVAEon8TIFxBxNwhvFyGEkk6FXsqnQ1bFn34S yjkKdTBWJlYvntAD3JkKhsxe465hX5phRVrVt3iuYciGwVCq5mN2p30qDQS1tNhx65Pz pfrNPVKVcT1oqJ2kzxPrswnH15d7RPGl2P9x/Yv2wpgiORKjsZqMKpNkKoTevDJnZXKX mwrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=ncQqFiFY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id h5-20020a17090ac38500b0027752ac4aefsi6871858pjt.24.2023.10.02.00.17.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 00:17:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=ncQqFiFY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id B859E80296D9; Mon, 2 Oct 2023 00:14:25 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235708AbjJBHOK (ORCPT + 99 others); Mon, 2 Oct 2023 03:14:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235667AbjJBHOI (ORCPT ); Mon, 2 Oct 2023 03:14:08 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50BD199 for ; Mon, 2 Oct 2023 00:14:05 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-3231d67aff2so12637410f8f.0 for ; Mon, 02 Oct 2023 00:14:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1696230844; x=1696835644; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=vyEJm0Vs8HzMk1ARIArOtOc0lGgfBnw3jKoPIGWI2IU=; b=ncQqFiFYJTEqjNv9P80BLA3l77PdKx+KpWNHKabUiEP2S56Le9YynoIv3vJ6U/I35a g0htVy2V0Rhc4c/4dJYziE8SO5e0gpxdEaRCNF2ON4VwPPblijzGNadh+C8KGZ/lEcB6 5pJ4/M2Li3MmyzyP0LYUJ9ZlVwcWjMx1RWE2/XGxltgUvgq718AmqeQmAdCanPbraSTU OP35OQJT+ItmomTMLbBUuj3/Rwwkm1RY97gHbcZdOqa9mpOBq4JnNkFMP6jK2MVixfxQ igViPAVDbON2q1Bw4eYGZHpLp4SqAy5TdmkT86sn/CgSca7zb+FB228Ff6SoRcVLG6LX W6yA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696230844; x=1696835644; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vyEJm0Vs8HzMk1ARIArOtOc0lGgfBnw3jKoPIGWI2IU=; b=CjNvrbCWk3dif+WW6hgYmD0cgr9UcV1TTZcIYYhkrhkcv1foLLNqDtCmZHAr4r2SQI JCtG15ibV3WJ96Vmnrm/mf4EI5spj1YeKRk7SVDT2NeogNp7v2Mf5mvvTpT8+hsm73ou ANadHFXjRnnA4ACLrZGh/Fnyvg6MNQEn+7IwusMDpjN30yOqhj39in9T9JHBHMQfxapm KhbJjfud18I0sdwYJ7pINLzgJLXi075hlE4O8vkTHD4UWu22CHZaPzFWByqmQZ+WiYS/ FBQxQfbBc2oMT0V8gaBXR3CdK/5E/90THh8mXA4k2Ha8igOo9JOFw9sxEJs4MCJMFwot lh1g== X-Gm-Message-State: AOJu0Yzfdh3j/vjeZA9RV0ppZB6WWB/NLWoTHL/IO7VWntyhu/b6PiqA ZfUlVv2CMHKiKgv/wTB2oYe6ykZjd+vMQvaHE1IRgw== X-Received: by 2002:a5d:674a:0:b0:324:7a6b:d4fe with SMTP id l10-20020a5d674a000000b003247a6bd4femr9856489wrw.9.1696230843723; Mon, 02 Oct 2023 00:14:03 -0700 (PDT) MIME-Version: 1.0 References: <20230929230549.45206-2-twuufnxlz@gmail.com> In-Reply-To: <20230929230549.45206-2-twuufnxlz@gmail.com> From: Alexandre Ghiti Date: Mon, 2 Oct 2023 09:13:52 +0200 Message-ID: Subject: Re: [PATCH] Test for riscv fixes To: Edward AD Cc: alex@ghiti.fr, aou@eecs.berkeley.edu, conor@kernel.org, gregkh@linuxfoundation.org, guoren@kernel.org, jirislaby@kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, linux-serial@vger.kernel.org, liushixin2@huawei.com, palmer@dabbelt.com, paul.walmsley@sifive.com, syzbot+8d2757d62d403b2d9275@syzkaller.appspotmail.com, syzkaller-bugs@googlegroups.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email 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 (pete.vger.email [0.0.0.0]); Mon, 02 Oct 2023 00:14:26 -0700 (PDT) Hi Edward, On Sat, Sep 30, 2023 at 1:06=E2=80=AFAM Edward AD wro= te: > > Hi Alexandre, > > On Fri, 29 Sep 2023 10:25:59 +0200 Alexandre Ghiti wrote: > > I'm still not convinced this will fix the kasan out-of-bounds > > accesses, the page can be valid but the read can happen at an offset > > not initialized and trigger such errors right? I still think there is > > something weird about the stack frame, as to me this should not happen > > (but admittedly I don't know much about that). > The added check can confirm that the physical page is invalid (whether it= is a > vmalloc allocated page or a slab allocated page), and exit the for loop w= hen it is invalid. Yes, but to me this is not what happens in the bug report you link: | BUG: KASAN: out-of-bounds in walk_stackframe+0x130/0x2f2 arch/riscv/kernel/stacktrace.c:59 | Read of size 8 at addr ff20000006d37c38 by task swapper/1/0 So the read at address ff20000006d37c38 is not "normal" according to KASAN (you can see there is no trap, meaning the physical mapping exists). | The buggy address belongs to the virtual mapping at | [ff20000006d30000, ff20000006d39000) created by: | kernel_clone+0x118/0x896 kernel/fork.c:2909 The virtual address is legitimate since the vma exists ^ | The buggy address belongs to the physical page: | page:ff1c00000250dbc0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x9436f And the physical page also exists ^ So I insist, checking that a physical mapping exists to exit the loop is not enough, to me, the error here is that the backtrace goes "too far" at an address where nothing was written before and then KASAN complains about that, again, we don't take any page fault here so it's not a problem of existing physical mapping. > > Perhaps we can trust the test results of syzbot. > > Thanks, > edward