Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp5619785pxb; Tue, 16 Feb 2021 03:22:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJziKpBmLPqmseeCUkOniL6vEpj9tjg8qvMGf0JRaGF321VjpCPq3VDikrtqZnpFclUzDI9V X-Received: by 2002:a17:906:3105:: with SMTP id 5mr20164905ejx.168.1613474538600; Tue, 16 Feb 2021 03:22:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613474538; cv=none; d=google.com; s=arc-20160816; b=05cqyM3Qoa9XSRr13uhtrIZGYL8D+s24wkPB1ZwHIOWqC8zKj/PdRKpy4HqWKPOojW U0uVNFnJusbnei/rOBb9T8ITSZl9aq65ofwNWqaKbJVl2XDpvo115+gWTZIQcJ4vIwkK L8cfABy64URavXJr8LLjOoAjCb40C/AknGVL0+HBldwWdxylkZTjPBzroGbM5kR79A3b GSDtti/t5LzLFst/d7ExWNYD83nnL4VNcjA+b+bvuPuLPcMRUUiF6ZTTsKj3n1TwglTg mV2dgwJBmtjUPbPiTXnT1s0T00Qy48V/i+BQZHmGyiob1djfXIeRg3SW9bhIZYr9cnmW wt9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=+yi48HIfDpj5+7cpoyDCNHw6yQcq1pcG1ot9n73mhd0=; b=qaW7T7hcZxe7YVgbspnxPSIUuB7cigDg/B62HHvuNf5pNv85by69Z7aemfivoCGWnE huPQkInuXZY/w7NFh6An6cmkuz/4U19FNfrZjfMqwcEGH0XPcJPg4/8SddphEGKMHgKg Gi9nwWP525O0EPC84rfREGt2Mx0GjeUT1IqP6VLloocy/xGGawNjN13rBJXVt4AEtM6s QFvV4+/RK9KZ9z+f/sPXhNW+MFox+umrN2dpbjMqht4QrVZ7+/d8kGofl6Lx3viQjEen Fm63KLQAVrmxbkv/J52ed90vFeRQcXz/9e44UHAYcTYGF5xvbDQZP50WQDHaa+ZwooiH PCWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=YxaffVO7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s10si12954575edd.231.2021.02.16.03.21.55; Tue, 16 Feb 2021 03:22:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=YxaffVO7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230335AbhBPLSk (ORCPT + 99 others); Tue, 16 Feb 2021 06:18:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230310AbhBPLSZ (ORCPT ); Tue, 16 Feb 2021 06:18:25 -0500 Received: from mail-qk1-x72a.google.com (mail-qk1-x72a.google.com [IPv6:2607:f8b0:4864:20::72a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37BF3C06174A for ; Tue, 16 Feb 2021 03:17:43 -0800 (PST) Received: by mail-qk1-x72a.google.com with SMTP id b14so9051094qkk.0 for ; Tue, 16 Feb 2021 03:17:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+yi48HIfDpj5+7cpoyDCNHw6yQcq1pcG1ot9n73mhd0=; b=YxaffVO7zp8rEiGeTbUX5Ki7tJ11g4dLfSxGlgdZKFGK+KHuDT0SyDQ4UZT9KqKHnJ PoA1Jd/7CZfFmqu6gfGH0WTjueyUz5dR778ADBSSVfKqYgCXQYzhrrn15o8FvpD3wahn cZzilJtE3Y+oxQ1168aV2Ewfth8SUlPyWcfrTkiETPp5e6qIytcY4Ru3vRwC3Ret2fnY s8+DxfClW49UgRZhNDCa0sxVclRXzpZQ6WqMZS3krzNGOYK6niAh5aDw2gkWU8GGQkc7 fFfyB6OaiYnO3EsONDuqdH5L8VvZ/tfU9NlpKMSddG3pc4SkYCOC98ACXwOnK6t0+wQc SGWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+yi48HIfDpj5+7cpoyDCNHw6yQcq1pcG1ot9n73mhd0=; b=Odf7pO4xj2Net9XfWZKRNhY6lsrt1myYDWvFs5ERkwF8f53+Mtk+rggzoUn3Sr6b+6 eCNAC1MCcBbiYBM08TIqhK9APQJv1ba32dniOdw0Af1i1g0JaFjNeHikDoxkVbVymKnn 29c0roJ/KsX9sMeywk3xzr6464nufwvzV4soKIRheOSvThwRCJgMx4xrPDmXvlQlfDTi HsNJaCb5kMdgT9yPL1DXEVJwVGMS6tiHe3BmLEYWhpyzKKg5MY5+ppMNKaKu/Thkkvc9 g2RQKtHjK9Rm5HqTWGXSd5+P/Wxq+WD9BTz72zHlGcOzaM0+tWsZ1tuMW4PyDvgLx/AG iGWA== X-Gm-Message-State: AOAM531HtfufLqWHvdrMxEmJUtWxHzNLIH0SabQFU8gMy87RhyTM2d+a dwOscbKitPM6kullpwasiEIi8f6lZScCQlXK2DYivg== X-Received: by 2002:a37:a757:: with SMTP id q84mr18474346qke.501.1613474262101; Tue, 16 Feb 2021 03:17:42 -0800 (PST) MIME-Version: 1.0 References: <20210118145310.crnqnh6kax5jqicj@distanz.ch> <6e9ee3a1-0e16-b1fc-a690-f1ca8e9823a5@ghiti.fr> In-Reply-To: From: Dmitry Vyukov Date: Tue, 16 Feb 2021 12:17:30 +0100 Message-ID: Subject: Re: riscv+KASAN does not boot To: Alex Ghiti Cc: Tobias Klauser , Albert Ou , Bjorn Topel , Palmer Dabbelt , LKML , nylon7@andestech.com, syzkaller , Andreas Schwab , Paul Walmsley , linux-riscv Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 29, 2021 at 9:11 AM Dmitry Vyukov wrote: > > I was fixing KASAN support for my sv48 patchset so I took a look at your > > issue: I built a kernel on top of the branch riscv/fixes using > > https://github.com/google/syzkaller/blob/269d24e857a757d09a898086a2fa6fa5d827c3e1/dashboard/config/linux/upstream-riscv64-kasan.config > > and Buildroot 2020.11. I have the warnings regarding the use of > > __virt_to_phys on wrong addresses (but that's normal since this function > > is used in virt_addr_valid) but not the segfaults you describe. > > Hi Alex, > > Let me try to rebuild buildroot image. Maybe there was something wrong > with my build, though, I did 'make clean' before doing. But at the > same time it worked back in June... > > Re WARNINGs, they indicate kernel bugs. I am working on setting up a > syzbot instance on riscv. If there a WARNING during boot then the > kernel will be marked as broken. No further testing will happen. > Is it a mis-use of WARN_ON? If so, could anybody please remove it or > replace it with pr_err. Hi, I've localized one issue with riscv/KASAN: KASAN breaks VDSO and that's I think the root cause of weird faults I saw earlier. The following patch fixes it. Could somebody please upstream this fix? I don't know how to add/run tests for this. Thanks diff --git a/arch/riscv/kernel/vdso/Makefile b/arch/riscv/kernel/vdso/Makefile index 0cfd6da784f84..cf3a383c1799d 100644 --- a/arch/riscv/kernel/vdso/Makefile +++ b/arch/riscv/kernel/vdso/Makefile @@ -35,6 +35,7 @@ CFLAGS_REMOVE_vgettimeofday.o = $(CC_FLAGS_FTRACE) -Os # Disable gcov profiling for VDSO code GCOV_PROFILE := n KCOV_INSTRUMENT := n +KASAN_SANITIZE := n # Force dependency $(obj)/vdso.o: $(obj)/vdso.so