From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0271EC4321A for ; Tue, 19 Jan 2021 18:30:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CB9DD22CAD for ; Tue, 19 Jan 2021 18:30:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727097AbhASS3o (ORCPT ); Tue, 19 Jan 2021 13:29:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390688AbhASSLc (ORCPT ); Tue, 19 Jan 2021 13:11:32 -0500 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3553C0613CF for ; Tue, 19 Jan 2021 10:10:31 -0800 (PST) Received: by mail-pg1-x536.google.com with SMTP id n7so13465003pgg.2 for ; Tue, 19 Jan 2021 10:10:31 -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=5Opada1Nc74SeJLx5vNBWIsrWjBjEGuHxciJnJB2M/I=; b=PrWo7CyvRvlnmkJHGXRxgNV6sSvFovW9CNemZ8fokQZSgWP8V31DZu1C1PYhvv0ynG IWL55t28ju5ZT/08aPAz+L0P7pjWxaq7o9sMsX6QpZSOE1pywOsU3KEG3As9unvlnlIF 8r/g/kK6Zsz5iK++ciGJdbTUZp2RbW4eCKcAoNrS4sczIyjpatnma53hlI3+dKI+ws4d z+cJs2bDIYtBpTqgqB+5vybHe5XyD0zQo/HzPSVPjcYIpcSzq83V5bmmfkcU1QwgeoSY gnMEtZAodQthIcttnuBXqMX8Z55qc6AO4piP0JnZeQSGMVUcZY7J77HdROvR4CwH6Qs1 Rl3A== 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=5Opada1Nc74SeJLx5vNBWIsrWjBjEGuHxciJnJB2M/I=; b=kxGcsdkjUFCIoBqUmwNXS3Chb9CdK3t/0EHwyXjvjthgwxHBnAtKu4D6uAn5vwFOeb P+D5IJRWZd/ND6MacYm95DHoiLyQ1qyZ2HNNQeWnNIQp4dyTmsUu7UwwaYqdCgo/gtMh s1xb8/3FLjykoKyjZiL6aUlf7tx4lcvHQKH06cSdGdpvvtej04F7ff+g/67vwEByUr0s vDPSS+sytgBAGWXU1ssJNmVV3xATE2cW+gmZB15MLiTrPL26CKgtPMx+JbRLW7dkihJO Mf0XPhIsPstKIdsTQ0eoO4YjhEQjgzLWSbi1A5MslWNjHY3uH1q01cneXT9W+X/inK0M M5mg== X-Gm-Message-State: AOAM531yN02yUl/Yp1jG/WHQ8DSoXORk+0d1/w6MAO16YKQ5BA4cQ0Zl OG4C+NykTfKxlUs10fcVHe4kjbci9tAFMhYD7rqrdA== X-Google-Smtp-Source: ABdhPJyCvQ3D5bDj6KFutl+F42BJdq16wK/CTyP670Mqi3SF9xzP8xf3Ua/QkDHnmmF+uzAaspeGgSn1iuViAZlAK9E= X-Received: by 2002:a63:4644:: with SMTP id v4mr5572351pgk.440.1611079831408; Tue, 19 Jan 2021 10:10:31 -0800 (PST) MIME-Version: 1.0 References: <20210118183033.41764-1-vincenzo.frascino@arm.com> <20210118183033.41764-3-vincenzo.frascino@arm.com> In-Reply-To: <20210118183033.41764-3-vincenzo.frascino@arm.com> From: Andrey Konovalov Date: Tue, 19 Jan 2021 19:10:20 +0100 Message-ID: Subject: Re: [PATCH v4 2/5] kasan: Add KASAN mode kernel parameter To: Vincenzo Frascino Cc: Linux ARM , LKML , kasan-dev , Catalin Marinas , Will Deacon , Dmitry Vyukov , Andrey Ryabinin , Alexander Potapenko , Marco Elver , Evgenii Stepanov , Branislav Rankov Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 18, 2021 at 7:30 PM Vincenzo Frascino wrote: > --- a/Documentation/dev-tools/kasan.rst > +++ b/Documentation/dev-tools/kasan.rst > @@ -162,6 +162,9 @@ particular KASAN features. > > - ``kasan=off`` or ``=on`` controls whether KASAN is enabled (default: ``on``). > > +- ``kasan.mode=sync`` or ``=async`` controls whether KASAN is configured in > + synchronous or asynchronous mode of execution (default: ``sync``). This needs to be expanded with a short explanation of the difference. > +static inline void hw_enable_tagging_mode(void) > +{ > + if (kasan_arg_mode == KASAN_ARG_MODE_ASYNC) > + hw_enable_tagging_async(); > + else > + hw_enable_tagging_sync(); > +} It's OK to open-code this in kasan_init_hw_tags_cpu(), no need for an additional function. > --- a/mm/kasan/kasan.h > +++ b/mm/kasan/kasan.h > @@ -284,7 +284,8 @@ static inline const void *arch_kasan_set_tag(const void *addr, u8 tag) > #define arch_set_mem_tag_range(addr, size, tag) ((void *)(addr)) > #endif > > -#define hw_enable_tagging() arch_enable_tagging() > +#define hw_enable_tagging_sync() arch_enable_tagging_sync() > +#define hw_enable_tagging_async() arch_enable_tagging_async() This is one of the places that conflicts with the testing patches. You'll need to: add an else case definition of hw_enable_tagging_sync(); change lib/test_kasan.c to use hw_enable_tagging_sync(). I'll later add a patch on top that forbids running the tests with the async mode. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C737C433DB for ; Wed, 20 Jan 2021 02:44:16 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 349562310B for ; Wed, 20 Jan 2021 02:44:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 349562310B Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=UH2SrID/UGZD0X5u8wesTe715bxUQCETgBxRE45RM5c=; b=FWHtDu76q2dVuVJF5RjBm92cs igDyKKv0DPzElQbhSugPbHIB8iPwEj723/DEa3Fm0gxH6IK0Z3lTV0Qq+4JXcu4Lkgbpl0vRqH1QF LevCOGfYKpyW+iUMxiZf/DmVkJ17eaFvywajfgs8FBX0GIQBK9ZL6m9O624S3A7HHKgLhUoMo+rtp JiX1IqQtCYZYX6keV9lxnyO+6SjuVZbhETkdULVI+Wm0KvuXa2+C5HsgyJNRz0+cNVfqIwJHik07p QcYVIlY8gkwa12NYC8JmAISzMfTm9CMKyaLFJrzfbzrQ58Cl6TOt2oCYkAILHNT1JJApRlNz6+Epj HzzQc1gNg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l1vSe-0003ni-5B; Tue, 19 Jan 2021 18:10:36 +0000 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l1vSc-0003mm-4N for linux-arm-kernel@lists.infradead.org; Tue, 19 Jan 2021 18:10:34 +0000 Received: by mail-pf1-x434.google.com with SMTP id b3so12762992pft.3 for ; Tue, 19 Jan 2021 10:10:33 -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=5Opada1Nc74SeJLx5vNBWIsrWjBjEGuHxciJnJB2M/I=; b=PrWo7CyvRvlnmkJHGXRxgNV6sSvFovW9CNemZ8fokQZSgWP8V31DZu1C1PYhvv0ynG IWL55t28ju5ZT/08aPAz+L0P7pjWxaq7o9sMsX6QpZSOE1pywOsU3KEG3As9unvlnlIF 8r/g/kK6Zsz5iK++ciGJdbTUZp2RbW4eCKcAoNrS4sczIyjpatnma53hlI3+dKI+ws4d z+cJs2bDIYtBpTqgqB+5vybHe5XyD0zQo/HzPSVPjcYIpcSzq83V5bmmfkcU1QwgeoSY gnMEtZAodQthIcttnuBXqMX8Z55qc6AO4piP0JnZeQSGMVUcZY7J77HdROvR4CwH6Qs1 Rl3A== 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=5Opada1Nc74SeJLx5vNBWIsrWjBjEGuHxciJnJB2M/I=; b=SpCVBwtcLgxeQhMGrE5UvbERomqS0HQjjlvOA5++eIKss2+YmvUWzGyguKv6QFYVvI UuEkMG9/LQsvrfkJasDCdWaf/gQGmVT4k8KCcLvgKsrVK0yEfRE4IF/kEURs6MOGljh5 EOMcWWPyT30+51lXIN/IaqLWCP3xlozFMUyphuJusIwg8J7EN2GNqor4QMwpJPGAVJjD HbRcWk60uwqy8Cc4Om9RaDwNeRqlJXI8KYLem4ZMHQlkmOcI/UB+WSpXsTWQhbH3bMMV 288bvXIzgrJeTse4X/Q3Ji3A1X7QD4f3+K8zv4H3FwCKxDu9SikkROigO55mPVPotyTY Eltg== X-Gm-Message-State: AOAM530C8pcliSIuPHVb/t/3vDo6tZ4RYEeCYKYWylzHvCvQpKVf4+0W OXr8lhqfFGkIgtqDmpijQ1WSKxdJB2mC5xWpcsKK3g== X-Google-Smtp-Source: ABdhPJyCvQ3D5bDj6KFutl+F42BJdq16wK/CTyP670Mqi3SF9xzP8xf3Ua/QkDHnmmF+uzAaspeGgSn1iuViAZlAK9E= X-Received: by 2002:a63:4644:: with SMTP id v4mr5572351pgk.440.1611079831408; Tue, 19 Jan 2021 10:10:31 -0800 (PST) MIME-Version: 1.0 References: <20210118183033.41764-1-vincenzo.frascino@arm.com> <20210118183033.41764-3-vincenzo.frascino@arm.com> In-Reply-To: <20210118183033.41764-3-vincenzo.frascino@arm.com> From: Andrey Konovalov Date: Tue, 19 Jan 2021 19:10:20 +0100 Message-ID: Subject: Re: [PATCH v4 2/5] kasan: Add KASAN mode kernel parameter To: Vincenzo Frascino X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210119_131034_206536_0A56C1B1 X-CRM114-Status: GOOD ( 15.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Branislav Rankov , Marco Elver , Catalin Marinas , Evgenii Stepanov , LKML , kasan-dev , Alexander Potapenko , Linux ARM , Andrey Ryabinin , Will Deacon , Dmitry Vyukov Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Jan 18, 2021 at 7:30 PM Vincenzo Frascino wrote: > --- a/Documentation/dev-tools/kasan.rst > +++ b/Documentation/dev-tools/kasan.rst > @@ -162,6 +162,9 @@ particular KASAN features. > > - ``kasan=off`` or ``=on`` controls whether KASAN is enabled (default: ``on``). > > +- ``kasan.mode=sync`` or ``=async`` controls whether KASAN is configured in > + synchronous or asynchronous mode of execution (default: ``sync``). This needs to be expanded with a short explanation of the difference. > +static inline void hw_enable_tagging_mode(void) > +{ > + if (kasan_arg_mode == KASAN_ARG_MODE_ASYNC) > + hw_enable_tagging_async(); > + else > + hw_enable_tagging_sync(); > +} It's OK to open-code this in kasan_init_hw_tags_cpu(), no need for an additional function. > --- a/mm/kasan/kasan.h > +++ b/mm/kasan/kasan.h > @@ -284,7 +284,8 @@ static inline const void *arch_kasan_set_tag(const void *addr, u8 tag) > #define arch_set_mem_tag_range(addr, size, tag) ((void *)(addr)) > #endif > > -#define hw_enable_tagging() arch_enable_tagging() > +#define hw_enable_tagging_sync() arch_enable_tagging_sync() > +#define hw_enable_tagging_async() arch_enable_tagging_async() This is one of the places that conflicts with the testing patches. You'll need to: add an else case definition of hw_enable_tagging_sync(); change lib/test_kasan.c to use hw_enable_tagging_sync(). I'll later add a patch on top that forbids running the tests with the async mode. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel