Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp49027pxb; Tue, 12 Jan 2021 19:41:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJwTAXvoXsAGNlv4iGQB5Q3/L2ake7H/hH3QppNr1uOcj2060OrCa7q33RiaspRdTe39lB6/ X-Received: by 2002:a17:906:b2d6:: with SMTP id cf22mr84599ejb.181.1610509284520; Tue, 12 Jan 2021 19:41:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610509284; cv=none; d=google.com; s=arc-20160816; b=iFgoZ//BgUiOAQorNGrdl1o2UENrrJoH3iSGt8PR6Eoc1hzZaDg2SVjGQOZUThlzlY RPumSnTQUkPNwnrsOOhQ5rZg4t+uW2bKm8odIToy1hx+8NXBHI/gSh/UlEJq+l7vlsw5 WEEW9GePTV4SdGZIjJCS1XqucnNqEoTilgI+Y4NArfrpO9W2Nig8Lt37KRaMwK5Mot8+ HAQo0/wJeBjeiEGDGz+lDKHjJByi3U5FBa6+dfd6LX9sDf479d1f8IGfcasxjIeUr9ya RBp/PhwBZXW+k0j9k/DxeoliSG01INrLOaSHcizaEXSY/uKPvPZ/hMQnsBLfP8y14WAG QskA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=4g8bpWRFFbze0eKjyeoZv0D3z0R2ISPPfm/xh72URvs=; b=LmZQ3Q5QDAQn8nR138PbMjM6M2ymXAwDDAkF25nVk+bgHX5U31MbiDQeGDTm90NbS7 PAyReJ+AL99yIT9VyIzi8sx4djJbq3QJFiu+xPS7V7X5nFfsCkV3eT5zTEWoHflW/WXW mYZiSEjuK/7ac8yjF0wgilf6W7Z9v4fp7N2L9DDLtRBLI1VefrCVIVx/iUvCEFnz03Wd kbJ4MpiEAI1duwWjZCj4kKGXudiAqg4o5aYHPs3vqc2cN5CEvVPVp+3iNWgjxPMNyfcH zLaNuDHRXKdv3lgS8lJN0cZ5+Gr5PsrHe3sFxGf+7E4jsuP/r2oAdKDClmQwf1Ljdlmh n0zA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bs24si354181edb.519.2021.01.12.19.41.01; Tue, 12 Jan 2021 19:41:24 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728026AbhAMCfU (ORCPT + 99 others); Tue, 12 Jan 2021 21:35:20 -0500 Received: from atcsqr.andestech.com ([60.248.187.195]:46149 "EHLO ATCSQR.andestech.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727952AbhAMCfU (ORCPT ); Tue, 12 Jan 2021 21:35:20 -0500 Received: from ATCSQR.andestech.com (localhost [127.0.0.2] (may be forged)) by ATCSQR.andestech.com with ESMTP id 10D2RaEO042340 for ; Wed, 13 Jan 2021 10:27:36 +0800 (GMT-8) (envelope-from nylon7@andestech.com) Received: from mail.andestech.com (atcpcs16.andestech.com [10.0.1.222]) by ATCSQR.andestech.com with ESMTP id 10D2Pffl039664; Wed, 13 Jan 2021 10:25:41 +0800 (GMT-8) (envelope-from nylon7@andestech.com) Received: from atcfdc88.andestech.com (10.0.15.120) by ATCPCS16.andestech.com (10.0.1.222) with Microsoft SMTP Server id 14.3.487.0; Wed, 13 Jan 2021 10:28:24 +0800 From: Nylon Chen To: , CC: , , , , , , , , , , Subject: [PATCH 0/1] kasan: support backing vmalloc space for riscv Date: Wed, 13 Jan 2021 10:28:21 +0800 Message-ID: <20210113022822.9230-1-nylon7@andestech.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.0.15.120] X-DNSRBL: X-MAIL: ATCSQR.andestech.com 10D2Pffl039664 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patchset is support KASAN_VMALLOC in riscv. We reference x86/s390 mailing list discussion for our implement. https://lwn.net/Articles/797950/ It's also pass `vmalloc-out-of-bounds` of test_kasan.ko log: [ 235.834318] # Subtest: kasan [ 235.835190] 1..37 [ 235.845238] ================================================================== [ 235.847818] BUG: KASAN: slab-out-of-bounds in kmalloc_oob_right+0xe2/0x192 [test_kasan] [ 235.850688] Write of size 1 at addr ffffffe0075d5a7b by task kunit_try_catch/125 [ 235.852630] [ 235.853212] CPU: 0 PID: 125 Comm: kunit_try_catch Tainted: G B 5.11.0-rc3-13940-gb0bb4cd86282-dirty #1 ... [ 241.835850] ================================================================== [1154/67143] [ 241.840884] ok 36 - kmalloc_double_kzfree [ 241.852642] ================================================================== [ 241.857261] BUG: KASAN: vmalloc-out-of-bounds in vmalloc_oob+0xcc/0x17c [test_kasan] [ 241.861327] Read of size 1 at addr ffffffd00407ec1c by task kunit_try_catch/161 [ 241.864525] [ 241.865200] CPU: 0 PID: 161 Comm: kunit_try_catch Tainted: G B 5.11.0-rc3-13940-gb0bb4cd86282-dirty #1 [ 241.869887] Call Trace: [ 241.870972] [] walk_stackframe+0x0/0x128 [ 241.873353] [] show_stack+0x32/0x3e [ 241.875457] [] dump_stack+0x84/0xa0 [ 241.877806] [] print_address_description.constprop.0+0x88/0x362 [ 241.881150] [] kasan_report+0x176/0x194 [ 241.883604] [] __asan_load1+0x42/0x4a [ 241.885897] [] vmalloc_oob+0xcc/0x17c [test_kasan] [ 241.889458] [] kunit_try_run_case+0x80/0x11a [kunit] [ 241.892665] [] kunit_generic_run_threadfn_adapter+0x2c/0x4e [kunit] [ 241.896568] [] kthread+0x206/0x222 [ 241.899219] [] ret_from_exception+0x0/0xc [ 241.901700] [ 241.902497] [ 241.903257] Memory state around the buggy address: [ 241.905430] ffffffd00407eb00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 241.908661] ffffffd00407eb80: 00 00 00 00 00 00 00 f8 f8 f8 f8 f8 f8 f8 f8 f8 [ 241.911841] >ffffffd00407ec00: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 [ 241.915037] ^ [ 241.916053] ffffffd00407ec80: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 [ 241.919272] ffffffd00407ed00: f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 [ 241.922417] ================================================================== [ 242.073698] ok 37 - vmalloc_oob Nylon Chen (1): riscv/kasan: add KASAN_VMALLOC support arch/riscv/Kconfig | 1 + arch/riscv/mm/kasan_init.c | 66 +++++++++++++++++++++++++++++++++++++- 2 files changed, 66 insertions(+), 1 deletion(-) -- 2.17.1