Message ID | 20230203075232.274282-1-alexghiti@rivosinc.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp701905wrn; Thu, 2 Feb 2023 23:58:44 -0800 (PST) X-Google-Smtp-Source: AK7set+53kAn4IWpNDQuGwjOUZL758EbK/0bT3zI+Z4H9ud0DcjeNMTiYpZyyFLL6cJ+eBpqK4QX X-Received: by 2002:a05:6a20:69a0:b0:bf:58d1:ce82 with SMTP id t32-20020a056a2069a000b000bf58d1ce82mr4572173pzk.1.1675411123873; Thu, 02 Feb 2023 23:58:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675411123; cv=none; d=google.com; s=arc-20160816; b=T/Gq2qBIrjz+q9vvhwFpcXdKjyp8fCcukW0M8EQXVLGxiQuNWjXxy0lPh0II5LSJlT XtCQ/tvqj/15J0Ald4AVdfMF5DQ47B/szzCXc8nVXLPeD+2VTFntSgeZDOwPKDRC5yi8 zpWWtyyaDvYOfXA1AWpIOiTEMOTsrPiLSRx+hCcRzGJUywYwAHZH/boWNh3YdSsUdOQb ghvCE1gQskhX+15Q4aNug5FuZ9hedMzhPU9oom4wD30g8DnnAfRLZy5rd0zsKjeq9163 kT9f13vSnNnXYGOO4oRmDtCQvIyrpa/R1nNEcFcFKNSjDxk6kjWauDpLQBJhWz8hchOu UxcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=NlhJRyLGWhYCTglJAyNtdlMktkkn7B+K+8DalaA2gVM=; b=jIfBCSZI6+v5AwqDt/qkbDSG0DucI+K4oYh6rGa5lQ5zvsmQ7MtpJu882QU9pVsXjh eeOKhTlAkHO98nb3PZqvF8o+L4zG6o6UVVDs5szZp1P8X2EiU8thN69tNEHiyxpi4wxb 0DUZ46LUIVYSh50Aw0HXEJLQSToxCScOUPOJJx/Rt3XrWmHMbM+b5n06eUllVndPCpt5 p7i3mZz4VoM5JpkfpnztRAUVxlmAoqqR0Zh0/yPFZGMvlU6bRAgq9Gv86Pyuw2D+sZKU fYBjIjk/YpR44tPxHm/5xI8SNl8N3NOyr8iaTvAskrykFa1Yv/6fzM1nMTfEZzp7+S5O rHKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=qQ4IzbW+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r2-20020a638f42000000b00497238f03e1si1872709pgn.508.2023.02.02.23.58.31; Thu, 02 Feb 2023 23:58:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20210112.gappssmtp.com header.s=20210112 header.b=qQ4IzbW+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231751AbjBCHwj (ORCPT <rfc822;il.mystafa@gmail.com> + 99 others); Fri, 3 Feb 2023 02:52:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229602AbjBCHwi (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 3 Feb 2023 02:52:38 -0500 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D561893ADE for <linux-kernel@vger.kernel.org>; Thu, 2 Feb 2023 23:52:36 -0800 (PST) Received: by mail-wm1-x333.google.com with SMTP id n13so3191407wmr.4 for <linux-kernel@vger.kernel.org>; Thu, 02 Feb 2023 23:52:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=NlhJRyLGWhYCTglJAyNtdlMktkkn7B+K+8DalaA2gVM=; b=qQ4IzbW+3YUP1LGsXZqe+TW2yoNdt5CgIM9iCfoPeTDgRcMgdCF93Uik1VA+RXDJ6w /jbovzM4aJ6zefnsmmc88ugJf7g0TqnY8PFjV1D9ZMT9NBBQZwHCHJdn7r9+cbiLzmti RJQFrxE2IfePta/OjJhTxnpSxtTui+FBNymB1THoXsoy+lDE6UJ/ey1mOQt3Qvu0B/Uw AlsMy8Ua932t0qE+8JUTdRuYjP3YYPr4rNlE4U+KJzZkzxnJvzedEiWKGEK9vRGiXXsU 84/XnF4I6ebriVsJtPGVUt3r3y0fHhqmgE4BiUj13dmhDv5+mEvv3RCtikwPAUhRrNg9 WChA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=NlhJRyLGWhYCTglJAyNtdlMktkkn7B+K+8DalaA2gVM=; b=ZDR2Bc66IvihiDZiZIQVOQ7HnzOKi8LhOZfQwvJnsmORlAnGgKsvLibQuW8Do/cYHu NUzAgVeeLF0x4ejcOS29KBXlvunau0/4FuPc7Gm6xGk7sbP1bNEMPLRaqOqCejJ7nQUz VDmW0c7iEEmbYfa46v6Hhy0GH6B16nhs7isGyQOiZMMXC+D/I6lOJnSqoklMPFfTdlNa Qt0cilT4aGi9iuoBIR6TvNu75szKNv6tuoiesF7iuyxtYBFxEE4iRKZc4WiGdBY87onG edxaLzw6UxgXfzF2GzaHWC96QBQQr5OGbOU+z08rnKuZip6iCQvnH53OG8O7J05sVvUv xqqg== X-Gm-Message-State: AO0yUKWezFHEvoAFWooM9ZdSs51Vc3JlWNXZFr2K9pCWcNXo6gjKB0t7 QPpJECM3SOQTiXurstciSRalxQ== X-Received: by 2002:a05:600c:1e19:b0:3dc:52fc:7f06 with SMTP id ay25-20020a05600c1e1900b003dc52fc7f06mr8189377wmb.41.1675410755367; Thu, 02 Feb 2023 23:52:35 -0800 (PST) Received: from alex-rivos.home (lfbn-lyo-1-450-160.w2-7.abo.wanadoo.fr. [2.7.42.160]) by smtp.gmail.com with ESMTPSA id v17-20020a05600c445100b003dc433355aasm2020861wmn.18.2023.02.02.23.52.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Feb 2023 23:52:35 -0800 (PST) From: Alexandre Ghiti <alexghiti@rivosinc.com> To: Paul Walmsley <paul.walmsley@sifive.com>, Palmer Dabbelt <palmer@dabbelt.com>, Albert Ou <aou@eecs.berkeley.edu>, Andrey Ryabinin <ryabinin.a.a@gmail.com>, Alexander Potapenko <glider@google.com>, Andrey Konovalov <andreyknvl@gmail.com>, Dmitry Vyukov <dvyukov@google.com>, Vincenzo Frascino <vincenzo.frascino@arm.com>, Ard Biesheuvel <ardb@kernel.org>, Conor Dooley <conor@kernel.org>, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, linux-efi@vger.kernel.org Cc: Alexandre Ghiti <alexghiti@rivosinc.com> Subject: [PATCH v4 0/6] RISC-V kasan rework Date: Fri, 3 Feb 2023 08:52:26 +0100 Message-Id: <20230203075232.274282-1-alexghiti@rivosinc.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756795894472136521?= X-GMAIL-MSGID: =?utf-8?q?1756795894472136521?= |
Series |
RISC-V kasan rework
|
|
Message
Alexandre Ghiti
Feb. 3, 2023, 7:52 a.m. UTC
As described in patch 2, our current kasan implementation is intricate, so I tried to simplify the implementation and mimic what arm64/x86 are doing. In addition it fixes UEFI bootflow with a kasan kernel and kasan inline instrumentation: all kasan configurations were tested on a large ubuntu kernel with success with KASAN_KUNIT_TEST and KASAN_MODULE_TEST. inline ubuntu config + uefi: sv39: OK sv48: OK sv57: OK outline ubuntu config + uefi: sv39: OK sv48: OK sv57: OK Actually 1 test always fails with KASAN_KUNIT_TEST that I have to check: # kasan_bitops_generic: EXPECTATION FAILED at mm/kasan/kasan__test.c:1020 KASAN failure expected in "set_bit(nr, addr)", but none occurrred Note that Palmer recently proposed to remove COMMAND_LINE_SIZE from the userspace abi https://lore.kernel.org/lkml/20221211061358.28035-1-palmer@rivosinc.com/T/ so that we can finally increase the command line to fit all kasan kernel parameters. All of this should hopefully fix the syzkaller riscv build that has been failing for a few months now, any test is appreciated and if I can help in any way, please ask. base-commit-tag: v6.2-rc6 v4: - Fix build warning by declaring create_tmp_mapping as static, kernel test robot v3: - Add AB from Ard in patch 4, thanks - Fix checkpatch issues in patch 1, thanks Conor v2: - Rebase on top of v6.2-rc3 - patch 4 is now way simpler than it used to be since Ard already moved the string functions into the efistub. Alexandre Ghiti (6): riscv: Split early and final KASAN population functions riscv: Rework kasan population functions riscv: Move DTB_EARLY_BASE_VA to the kernel address space riscv: Fix EFI stub usage of KASAN instrumented strcmp function riscv: Fix ptdump when KASAN is enabled riscv: Unconditionnally select KASAN_VMALLOC if KASAN arch/riscv/Kconfig | 1 + arch/riscv/kernel/image-vars.h | 2 - arch/riscv/mm/init.c | 2 +- arch/riscv/mm/kasan_init.c | 516 ++++++++++++++++++--------------- arch/riscv/mm/ptdump.c | 24 +- 5 files changed, 298 insertions(+), 247 deletions(-)
Comments
On Fri, 3 Feb 2023 08:52:26 +0100, Alexandre Ghiti wrote: > As described in patch 2, our current kasan implementation is intricate, > so I tried to simplify the implementation and mimic what arm64/x86 are > doing. > > In addition it fixes UEFI bootflow with a kasan kernel and kasan inline > instrumentation: all kasan configurations were tested on a large ubuntu > kernel with success with KASAN_KUNIT_TEST and KASAN_MODULE_TEST. > > [...] Applied, thanks! [1/6] riscv: Split early and final KASAN population functions https://git.kernel.org/palmer/c/70a3bb1e1fd9 [2/6] riscv: Rework kasan population functions https://git.kernel.org/palmer/c/fec8e4f66e4d [3/6] riscv: Move DTB_EARLY_BASE_VA to the kernel address space https://git.kernel.org/palmer/c/1cdf594686a3 [4/6] riscv: Fix EFI stub usage of KASAN instrumented strcmp function https://git.kernel.org/palmer/c/415e9a115124 [5/6] riscv: Fix ptdump when KASAN is enabled https://git.kernel.org/palmer/c/fe0c8624d20d [6/6] riscv: Unconditionnally select KASAN_VMALLOC if KASAN https://git.kernel.org/palmer/c/4cdc06c5c741 Best regards,
Hello: This series was applied to riscv/linux.git (for-next) by Palmer Dabbelt <palmer@rivosinc.com>: On Fri, 3 Feb 2023 08:52:26 +0100 you wrote: > As described in patch 2, our current kasan implementation is intricate, > so I tried to simplify the implementation and mimic what arm64/x86 are > doing. > > In addition it fixes UEFI bootflow with a kasan kernel and kasan inline > instrumentation: all kasan configurations were tested on a large ubuntu > kernel with success with KASAN_KUNIT_TEST and KASAN_MODULE_TEST. > > [...] Here is the summary with links: - [v4,1/6] riscv: Split early and final KASAN population functions https://git.kernel.org/riscv/c/70a3bb1e1fd9 - [v4,2/6] riscv: Rework kasan population functions https://git.kernel.org/riscv/c/fec8e4f66e4d - [v4,3/6] riscv: Move DTB_EARLY_BASE_VA to the kernel address space https://git.kernel.org/riscv/c/1cdf594686a3 - [v4,4/6] riscv: Fix EFI stub usage of KASAN instrumented strcmp function https://git.kernel.org/riscv/c/415e9a115124 - [v4,5/6] riscv: Fix ptdump when KASAN is enabled https://git.kernel.org/riscv/c/fe0c8624d20d - [v4,6/6] riscv: Unconditionnally select KASAN_VMALLOC if KASAN https://git.kernel.org/riscv/c/4cdc06c5c741 You are awesome, thank you!
On Tue, 07 Mar 2023 19:29:11 PST (-0800), Palmer Dabbelt wrote: > > On Fri, 3 Feb 2023 08:52:26 +0100, Alexandre Ghiti wrote: >> As described in patch 2, our current kasan implementation is intricate, >> so I tried to simplify the implementation and mimic what arm64/x86 are >> doing. >> >> In addition it fixes UEFI bootflow with a kasan kernel and kasan inline >> instrumentation: all kasan configurations were tested on a large ubuntu >> kernel with success with KASAN_KUNIT_TEST and KASAN_MODULE_TEST. >> >> [...] > > Applied, thanks! > > [1/6] riscv: Split early and final KASAN population functions > https://git.kernel.org/palmer/c/70a3bb1e1fd9 > [2/6] riscv: Rework kasan population functions > https://git.kernel.org/palmer/c/fec8e4f66e4d > [3/6] riscv: Move DTB_EARLY_BASE_VA to the kernel address space > https://git.kernel.org/palmer/c/1cdf594686a3 > [4/6] riscv: Fix EFI stub usage of KASAN instrumented strcmp function > https://git.kernel.org/palmer/c/415e9a115124 > [5/6] riscv: Fix ptdump when KASAN is enabled > https://git.kernel.org/palmer/c/fe0c8624d20d > [6/6] riscv: Unconditionnally select KASAN_VMALLOC if KASAN > https://git.kernel.org/palmer/c/4cdc06c5c741 > > Best regards, Sorry, this one didn't actually get tested -- I'd thought it was in the queue before I kicked off the run, but it wasn't. It's testing now, I've dropped it from for-next for a bit as I don't remember if this is one of the patch sets that had a bulid/test failure.
On Fri, 03 Feb 2023 08:52:26 +0100, Alexandre Ghiti wrote: > As described in patch 2, our current kasan implementation is intricate, > so I tried to simplify the implementation and mimic what arm64/x86 are > doing. > > In addition it fixes UEFI bootflow with a kasan kernel and kasan inline > instrumentation: all kasan configurations were tested on a large ubuntu > kernel with success with KASAN_KUNIT_TEST and KASAN_MODULE_TEST. > > [...] Applied, thanks! [1/6] riscv: Split early and final KASAN population functions https://git.kernel.org/palmer/c/cd0334e1c091 [2/6] riscv: Rework kasan population functions https://git.kernel.org/palmer/c/96f9d4daf745 [3/6] riscv: Move DTB_EARLY_BASE_VA to the kernel address space https://git.kernel.org/palmer/c/401e84488800 [4/6] riscv: Fix EFI stub usage of KASAN instrumented strcmp function https://git.kernel.org/palmer/c/617955ca6e27 [5/6] riscv: Fix ptdump when KASAN is enabled https://git.kernel.org/palmer/c/ecd7ebaf0b5a [6/6] riscv: Unconditionnally select KASAN_VMALLOC if KASAN https://git.kernel.org/palmer/c/864046c512c2 Best regards,
On Fri, 03 Feb 2023 08:52:26 +0100, Alexandre Ghiti wrote: > As described in patch 2, our current kasan implementation is intricate, > so I tried to simplify the implementation and mimic what arm64/x86 are > doing. > > In addition it fixes UEFI bootflow with a kasan kernel and kasan inline > instrumentation: all kasan configurations were tested on a large ubuntu > kernel with success with KASAN_KUNIT_TEST and KASAN_MODULE_TEST. > > [...] Applied, thanks! [1/6] riscv: Split early and final KASAN population functions https://git.kernel.org/palmer/c/cd0334e1c091 [2/6] riscv: Rework kasan population functions https://git.kernel.org/palmer/c/96f9d4daf745 [3/6] riscv: Move DTB_EARLY_BASE_VA to the kernel address space https://git.kernel.org/palmer/c/401e84488800 [4/6] riscv: Fix EFI stub usage of KASAN instrumented strcmp function https://git.kernel.org/palmer/c/617955ca6e27 [5/6] riscv: Fix ptdump when KASAN is enabled https://git.kernel.org/palmer/c/ecd7ebaf0b5a [6/6] riscv: Unconditionnally select KASAN_VMALLOC if KASAN https://git.kernel.org/palmer/c/864046c512c2 Best regards,