Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp698881pxm; Fri, 25 Feb 2022 17:36:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJzn1lB4Kaxn4n9Y1waZGSrwXKkzc3ZADUJQ4RRxTaU8uFoEUQJMycUqfxlMTn5yCQ+au0Sy X-Received: by 2002:a63:1f5a:0:b0:375:ec6f:667e with SMTP id q26-20020a631f5a000000b00375ec6f667emr6539277pgm.462.1645839418837; Fri, 25 Feb 2022 17:36:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645839418; cv=none; d=google.com; s=arc-20160816; b=tlBPDvEDzxrIgADC3UYXWBGoaDjzH5RYuConWR1nHO6liqMik92RwcuPkON73k2FHZ begDq5L8csBPz6b97th8ZEZPqP/YkbSdvhfD+r3pkMD9LhyKc//Vkr++pEHwV7Y/M9UT btg+nDf7MxxGaeitRsfGmqj9IkIrajpZsci6W/33VG65vZnDANCRWub9TlXBp4MymcVC hSfQkJX8OunjHa+IjlxjtZIDniuu9MrL4grR5eXlJVvpKy1XObBMXg1mCbL/F5l4KEm3 PxSdhgM6eMZ343OSvNupZzD/8tcwI3FjK9p91gYt+0Ip9dk7Z7xPoDCj49gR7lxEJp78 3Fdw== 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=dOC9NztcOZs3DksWle8GHoaYwka1l2lDGqOy4HRLA/c=; b=Zz/L6jk8cbN6wcFNBeMFKhnMtGGDrlfdUtVmshK6GiUinlPRcBkgSziuActvrpmFEl CdX2M7YySxwJu+TtcfwuFfCf0M2rQXu0ONfNEb33/NIwefzzus6AYz8Vs+RD2kfEEte1 P+TpewlKTewmJCKbiTM9Y8khwNZnfHDM/JJNx4e0q+M8bcDOdyR03A/MxJC/V268w4Xw pq7c5yTnKS4xCSS8IHb+4OTEch4an70/nOPCfV69SXNNzHT9ixlkgrIaHTYtDhUxdvDK nMf45pvEZLXwm6Tald0cDCjbDGDvCTB8Mi9qsqsdd5aomj+/AtjNXT1eRMdy1weVFfwm fLRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=a7TdkWuI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id b23-20020a656697000000b00372d703119csi3286418pgw.205.2022.02.25.17.36.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Feb 2022 17:36:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=a7TdkWuI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3F2187666A; Fri, 25 Feb 2022 17:31:23 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241860AbiBYOri (ORCPT + 99 others); Fri, 25 Feb 2022 09:47:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241855AbiBYOrb (ORCPT ); Fri, 25 Feb 2022 09:47:31 -0500 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2159119F2D for ; Fri, 25 Feb 2022 06:46:58 -0800 (PST) Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 2EF563FCA5 for ; Fri, 25 Feb 2022 14:46:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1645800416; bh=dOC9NztcOZs3DksWle8GHoaYwka1l2lDGqOy4HRLA/c=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=a7TdkWuIjHNp1DUZkTadiN06co1KLzD5PUhnP/fR1Iqi5cEZOpKvmG/8ZsQf5nnfn xnXgEHij1HpebGpSIxodauiRNbnh2UEzM12vdcOWjyfVEExnYjYrDIVzqTTfmQb4gW fhHCk9JFNRjRwA37NLl1ylGkt6oeDwdJrPnowu8HwHy6HCCCRnuFzHZx89JRP72c8H Auu9P8p40p/qLGJkx9mDZ1sW+N6+ZB6x1MGx9v9vdhouG6m+ofYH7tRPtZMQDxmHLB TnmV1+a/zChbn4MSQjvMJ1+O1uYSYpVNGl9sZeIXcOkYiA+GTjdA503Z5DjW6IW26h u2MdJS8FAX+cg== Received: by mail-ed1-f69.google.com with SMTP id dy17-20020a05640231f100b00412897682b4so2416735edb.18 for ; Fri, 25 Feb 2022 06:46:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=dOC9NztcOZs3DksWle8GHoaYwka1l2lDGqOy4HRLA/c=; b=yUpzDhQYCtuV3VnmdH2wZ9SJxKyE3o1EAjcggv5sb1vnFnPCskq2LXG/FLZyN/UZfZ d/Basuz2kT7knNWTY2VcyuVVDNuf4DlU+rJuNLfwG3GgRYvUPfrQGXGcbRN9y0H8PLg2 qn8d/wkgnazmoJhtfxzIWUAOPT4+gIeNhhYWSjOLWkU8qD2BYR97LWZn1ysiIX6wZyo1 n6z1GGf0NrUJWWVBsNHGAflII+NOfhRJs3oLbE/xcTo6XjWOKUUJQsjjIBr9oTIVOcc4 2+hy5KxhGMQo5/iG+P2tKzPWURRc/XsrW8qnM2J0ujL8o9sYiYrKWvkAxf/+bmzT9Iql XKNw== X-Gm-Message-State: AOAM5305Tccg8LRpHFhYuQlh8bN7M9W3/0eZgvg/dbiDXdzwkkldUy+M KKBsd1IRhJ155Qykf1C2qbrUmgjme2ZZ/caLnuzfLL7ZpSouLMZvheIFrSczYKIYaiPbTCT5w8O +SIl4qhWgpeaHgupu4GhQQIAuf87g5Q/PPnAWCS/kDaE6lca2hXg9UMKTRA== X-Received: by 2002:a05:6402:1681:b0:410:a467:833b with SMTP id a1-20020a056402168100b00410a467833bmr7405664edv.412.1645800415656; Fri, 25 Feb 2022 06:46:55 -0800 (PST) X-Received: by 2002:a05:6402:1681:b0:410:a467:833b with SMTP id a1-20020a056402168100b00410a467833bmr7405642edv.412.1645800415364; Fri, 25 Feb 2022 06:46:55 -0800 (PST) MIME-Version: 1.0 References: <20220225123953.3251327-1-alexandre.ghiti@canonical.com> In-Reply-To: From: Alexandre Ghiti Date: Fri, 25 Feb 2022 15:46:44 +0100 Message-ID: Subject: Re: [PATCH -fixes v3 0/6] Fixes KASAN and other along the way To: Alexander Potapenko Cc: Marco Elver , Paul Walmsley , Palmer Dabbelt , Albert Ou , Andrey Ryabinin , Andrey Konovalov , Dmitry Vyukov , Aleksandr Nogikh , Nick Hu , linux-riscv@lists.infradead.org, LKML , kasan-dev Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 On Fri, Feb 25, 2022 at 3:31 PM Alexander Potapenko wro= te: > > > > On Fri, Feb 25, 2022 at 3:15 PM Alexandre Ghiti wrote: >> >> On Fri, Feb 25, 2022 at 3:10 PM Alexander Potapenko = wrote: >> > >> > >> > >> > On Fri, Feb 25, 2022 at 3:04 PM Alexandre Ghiti wrote: >> >> >> >> On Fri, Feb 25, 2022 at 2:06 PM Marco Elver wrote: >> >> > >> >> > On Fri, 25 Feb 2022 at 13:40, Alexandre Ghiti >> >> > wrote: >> >> > > >> >> > > As reported by Aleksandr, syzbot riscv is broken since commit >> >> > > 54c5639d8f50 ("riscv: Fix asan-stack clang build"). This commit a= ctually >> >> > > breaks KASAN_INLINE which is not fixed in this series, that will = come later >> >> > > when found. >> >> > > >> >> > > Nevertheless, this series fixes small things that made the syzbot >> >> > > configuration + KASAN_OUTLINE fail to boot. >> >> > > >> >> > > Note that even though the config at [1] boots fine with this seri= es, I >> >> > > was not able to boot the small config at [2] which fails because >> >> > > kasan_poison receives a really weird address 0x4075706301000000 (= maybe a >> >> > > kasan person could provide some hint about what happens below in >> >> > > do_ctors -> __asan_register_globals): >> >> > >> >> > asan_register_globals is responsible for poisoning redzones around >> >> > globals. As hinted by 'do_ctors', it calls constructors, and in thi= s >> >> > case a compiler-generated constructor that calls >> >> > __asan_register_globals with metadata generated by the compiler. Th= at >> >> > metadata contains information about global variables. Note, these >> >> > constructors are called on initial boot, but also every time a kern= el >> >> > module (that has globals) is loaded. >> >> > >> >> > It may also be a toolchain issue, but it's hard to say. If you're >> >> > using GCC to test, try Clang (11 or later), and vice-versa. >> >> >> >> I tried 3 different gcc toolchains already, but that did not fix the >> >> issue. The only thing that worked was setting asan-globals=3D0 in >> >> scripts/Makefile.kasan, but ok, that's not a fix. >> >> I tried to bisect this issue but our kasan implementation has been >> >> broken quite a few times, so it failed. >> >> >> >> I keep digging! >> >> >> > >> > The problem does not reproduce for me with GCC 11.2.0: kernels built w= ith both [1] and [2] are bootable. >> >> Do you mean you reach userspace? Because my image boots too, and fails >> at some point: >> >> [ 0.000150] sched_clock: 64 bits at 10MHz, resolution 100ns, wraps >> every 4398046511100ns >> [ 0.015847] Console: colour dummy device 80x25 >> [ 0.016899] printk: console [tty0] enabled >> [ 0.020326] printk: bootconsole [ns16550a0] disabled >> > > In my case, QEMU successfully boots to the login prompt. > I am running QEMU 6.2.0 (Debian 1:6.2+dfsg-2) and an image Aleksandr shar= ed with me (guess it was built according to this instruction: https://githu= b.com/google/syzkaller/blob/master/docs/linux/setup_linux-host_qemu-vm_risc= v64-kernel.md) > Nice thanks guys! I always use the latest opensbi and not the one that is embedded in qemu, which is the only difference between your command line (which works) and mine (which does not work). So the issue is probably there, I really need to investigate that now. That means I only need to fix KASAN_INLINE and we're good. I imagine Palmer can add your Tested-by on the series then? Thanks again! Alex >> >> It traps here. >> >> > FWIW here is how I run them: >> > >> > qemu-system-riscv64 -m 2048 -smp 1 -nographic -no-reboot \ >> > -device virtio-rng-pci -machine virt -device \ >> > virtio-net-pci,netdev=3Dnet0 -netdev \ >> > user,id=3Dnet0,restrict=3Don,hostfwd=3Dtcp:127.0.0.1:12529-:22 -devi= ce \ >> > virtio-blk-device,drive=3Dhd0 -drive \ >> > file=3D${IMAGE},if=3Dnone,format=3Draw,id=3Dhd0 -snapshot \ >> > -kernel ${KERNEL_SRC_DIR}/arch/riscv/boot/Image -append "root=3D/dev= /vda >> > console=3DttyS0 earlyprintk=3Dserial" >> > >> > >> >> >> >> Thanks for the tips, >> >> >> >> Alex >> > >> > >> > >> > -- >> > Alexander Potapenko >> > Software Engineer >> > >> > Google Germany GmbH >> > Erika-Mann-Stra=C3=9Fe, 33 >> > 80636 M=C3=BCnchen >> > >> > Gesch=C3=A4ftsf=C3=BChrer: Paul Manicle, Liana Sebastian >> > Registergericht und -nummer: Hamburg, HRB 86891 >> > Sitz der Gesellschaft: Hamburg >> > >> > Diese E-Mail ist vertraulich. Falls Sie diese f=C3=A4lschlicherweise e= rhalten haben sollten, leiten Sie diese bitte nicht an jemand anderes weite= r, l=C3=B6schen Sie alle Kopien und Anh=C3=A4nge davon und lassen Sie mich = bitte wissen, dass die E-Mail an die falsche Person gesendet wurde. >> > >> > >> > >> > This e-mail is confidential. If you received this communication by mis= take, please don't forward it to anyone else, please erase all copies and a= ttachments, and please let me know that it has gone to the wrong person. >> >> -- >> You received this message because you are subscribed to the Google Group= s "kasan-dev" group. >> To unsubscribe from this group and stop receiving emails from it, send a= n email to kasan-dev+unsubscribe@googlegroups.com. >> To view this discussion on the web visit https://groups.google.com/d/msg= id/kasan-dev/CA%2BzEjCsQPVYSV7CdhKnvjujXkMXuRQd%3DVPok1awb20xifYmidw%40mail= .gmail.com. > > > > -- > Alexander Potapenko > Software Engineer > > Google Germany GmbH > Erika-Mann-Stra=C3=9Fe, 33 > 80636 M=C3=BCnchen > > Gesch=C3=A4ftsf=C3=BChrer: Paul Manicle, Liana Sebastian > Registergericht und -nummer: Hamburg, HRB 86891 > Sitz der Gesellschaft: Hamburg > > Diese E-Mail ist vertraulich. Falls Sie diese f=C3=A4lschlicherweise erha= lten haben sollten, leiten Sie diese bitte nicht an jemand anderes weiter, = l=C3=B6schen Sie alle Kopien und Anh=C3=A4nge davon und lassen Sie mich bit= te wissen, dass die E-Mail an die falsche Person gesendet wurde. > > > > This e-mail is confidential. If you received this communication by mistak= e, please don't forward it to anyone else, please erase all copies and atta= chments, and please let me know that it has gone to the wrong person.