From patchwork Wed Dec 9 18:24:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 11962033 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=-13.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNWANTED_LANGUAGE_BODY,URIBL_BLOCKED,USER_AGENT_GIT 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 DEA2CC4167B for ; Wed, 9 Dec 2020 18:26:03 +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 93C6A23BC6 for ; Wed, 9 Dec 2020 18:26:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 93C6A23BC6 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:From:Subject:References:Mime-Version:Message-Id: In-Reply-To:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=tdb0taFhUEmxAL9v9CTrXfskSUKtfufHSNudhqW7878=; b=HSY0GsM4sPC/YiGHoT4ZIGwVZ 8AlSGcXJ5bfEuFKdyFB4t7b+A77G6curB/S5WM3AKc3GV27pOeHDN3LAapgTQMz6oFSnj7Iu9jCBj H7Ss1YSYG71NFqBrphJTgmJcUUEBrv1Yzw8i4qAKHlqnJuf6fgLNftitVkzmUIa6Df/3cyedI1f1i uRSxAbO4lCKeOLUb/fVH3uF/gXaK4b8xByHLec4kajKFLrpgI9uTk5JgJGs2aaQuROI7Tldzd403I ba0KDkL5BYb1bIYIr6kLZ7iDywOLUYHsq4jTV4vu1ClMPWwP2D7MX6UowUu6I+NE6gePJnbSt1K0d n0fDiQAEw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kn48g-0005Cf-6T; Wed, 09 Dec 2020 18:24:34 +0000 Received: from mail-wm1-x349.google.com ([2a00:1450:4864:20::349]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kn48b-0005AA-0p for linux-arm-kernel@lists.infradead.org; Wed, 09 Dec 2020 18:24:30 +0000 Received: by mail-wm1-x349.google.com with SMTP id b184so653699wmh.6 for ; Wed, 09 Dec 2020 10:24:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=V2rDh/PTRpe6NWZnEeAWnr3LbupuxXOheZwv6czKP7I=; b=sJrzjf+rsOdspdQKnYG9pg0y0KJCU2rf0QxkpTRnNcP3e6Aub3MH1asP3rLsM6Yq64 6sisT6KMQfH8oNrgEGWsXTZd3a3ZzfQwWKmo2YeftvCEs8fMbw2aspmzE5p531i4LWib 1VibozdtcpLde7sbMU6UwWyMSZ89dNKXMFuU8igBRvKCyjCCajbL1nH1Xjfeuq0wS6bN JOZE9p0wa5eM3Zr0LFT/S393AuaG2VtA5OsN7wa9eLZD46TKUlW2qLXWAuuXjEA/yxPZ Tlswk9BfFM5KF/UwXKuc/0LtX+iT/vGi4np7MS7nlxVqpQPKBSpyre6qGHsDxa5L2Nyg gaVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=V2rDh/PTRpe6NWZnEeAWnr3LbupuxXOheZwv6czKP7I=; b=iyyma/ouxEbphn3Iz9kWPjsw1l4GfQ7WQgXXciAauAUvtYsAE3G7q6bMlqKJwxJPgS GjUqrZtAsydjeakjinDOXbtHI3ThBLW6lGicX5nSJ6bu3ShuTMDV8+ne9QWhLJm7j9XC UpeOPJnjLaEzF53S3Z+UaMPxMKMRmMr2MBL/fi1nc7mrx3a/fwWmNK3WE1CTs5EC+59j Q4RNXOCiOyZplqH4kMHW8t6Km5gzmZWEmYtz7b45ow2i5GjSV+7apwxFbMJX79CGs2Bt h6V5tsF87XRlZ0RvglisIOFcCLWEFAylr/nARZzYNbes6hJfXU9xouDeT10XT++INfGN +L1g== X-Gm-Message-State: AOAM530Qg2p4nDKjVUWWJK/3pfArhTYsROIOYcw6B0vqzXh1q116g5/l w6FN/b4N7o5yjGiiqvBHi0PhpwnRGrM2CxQo X-Google-Smtp-Source: ABdhPJyP0L7+kNbjb687i7w1wzyg+YrLTPf+fehJ67MnVyUl7tP85xcGPS2oT8rxgT392YbT4bW+Ohr26jGwv8aY X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:7220:84ff:fe09:7e9d]) (user=andreyknvl job=sendgmr) by 2002:adf:e710:: with SMTP id c16mr4123641wrm.295.1607538265727; Wed, 09 Dec 2020 10:24:25 -0800 (PST) Date: Wed, 9 Dec 2020 19:24:15 +0100 In-Reply-To: Message-Id: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.29.2.576.ga3fc446d84-goog Subject: [PATCH mm 1/2] kasan: don't use read-only static keys From: Andrey Konovalov To: Andrew Morton X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201209_132429_089985_24B6D940 X-CRM114-Status: GOOD ( 13.12 ) 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: linux-arm-kernel@lists.infradead.org, Marco Elver , Catalin Marinas , Kevin Brodsky , Will Deacon , Branislav Rankov , kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Alexander Potapenko , Evgenii Stepanov , Andrey Konovalov , Andrey Ryabinin , Vincenzo Frascino , Dmitry Vyukov Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org __ro_after_init static keys are incompatible with usage in loadable kernel modules and cause crashes. Don't use those, use normal static keys. Signed-off-by: Andrey Konovalov Reviewed-by: Marco Elver --- This fix can be squashed into "kasan: add and integrate kasan boot parameters". --- mm/kasan/hw_tags.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/kasan/hw_tags.c b/mm/kasan/hw_tags.c index c91f2c06ecb5..55bd6f09c70f 100644 --- a/mm/kasan/hw_tags.c +++ b/mm/kasan/hw_tags.c @@ -43,11 +43,11 @@ static enum kasan_arg_stacktrace kasan_arg_stacktrace __ro_after_init; static enum kasan_arg_fault kasan_arg_fault __ro_after_init; /* Whether KASAN is enabled at all. */ -DEFINE_STATIC_KEY_FALSE_RO(kasan_flag_enabled); +DEFINE_STATIC_KEY_FALSE(kasan_flag_enabled); EXPORT_SYMBOL(kasan_flag_enabled); /* Whether to collect alloc/free stack traces. */ -DEFINE_STATIC_KEY_FALSE_RO(kasan_flag_stacktrace); +DEFINE_STATIC_KEY_FALSE(kasan_flag_stacktrace); /* Whether panic or disable tag checking on fault. */ bool kasan_flag_panic __ro_after_init; From patchwork Wed Dec 9 18:24:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrey Konovalov X-Patchwork-Id: 11962031 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=-16.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT 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 DA782C4361B for ; Wed, 9 Dec 2020 18:26:03 +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 9460C23C8F for ; Wed, 9 Dec 2020 18:26:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9460C23C8F 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:From:Subject:References:Mime-Version:Message-Id: In-Reply-To:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=fAeaaqmdSa/23LQtIPbQz/zbYxFtoofmoRNcOl366ro=; b=JChTxlfXk4+znxW1K/pwrrgjN crIC5cbUePZG2OknoLz5dKLApKrpoEe5yk+Xhnu0O1O/a5sNQdupJlpVmO0gFwwOrOFOKTaaDxDLY RRVZD+QrhxEnhYLjSB/jVuFf4hx15hWnhg79MGh4TyPlNg/i+/L18SrGzeL39BtMOZu9zaQop0xtZ vLCLPdncz67pP5VeT35hqOfn3ORLQFAqhhrvX24dVzSU0FNjQ+vHwQKF8Za+kk9jz7THpXt3xMZBI PwRlS61KM4Kgtij0b1h7pIAfJDWKsg5kr7mQ44TdkkrguoSguxc9oweUAqJ6KbkE8/yrPAYd5YNAD uOBjPa9Sw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kn48j-0005D7-9l; Wed, 09 Dec 2020 18:24:37 +0000 Received: from mail-qt1-x84a.google.com ([2607:f8b0:4864:20::84a]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kn48e-0005BF-Dl for linux-arm-kernel@lists.infradead.org; Wed, 09 Dec 2020 18:24:33 +0000 Received: by mail-qt1-x84a.google.com with SMTP id z43so1873546qtb.0 for ; Wed, 09 Dec 2020 10:24:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:in-reply-to:message-id:mime-version:references:subject :from:to:cc; bh=u1bxfC07ZuZBOWsTyyUWqPiXaJQ6KPVo7f7CpicouQI=; b=jtZIxOGhOaY8oAUb8BvD+E79MIfynRleHrjdAsL7FWljVpVMiW+9Os1KVux0owqEVe kMtJVVMUdf40DWsrihpEssIeQvMKLCF7OFDI5UN+uL+0VG3PlWmY+CXC0qOxGNfPMgbB NfRJVSkGoC/wzm3y/97pFIYkMUwMSxktEWQ+N/D0jQWx9QJsSB7gzjwQLCUSeH/FmSJe dh8Qe7dcOeX2MgbUWfd9W9mQlAGniesJc4ri3yHSy+ZogRa9j74wYqIyVNcD5OVEUMnZ aBoOQ8V14gfhZObvQwUWgtENIiXQrwT5r9VXz94S/1UsAeJCHm6UagGVBZFv53XqMazv R2Og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=u1bxfC07ZuZBOWsTyyUWqPiXaJQ6KPVo7f7CpicouQI=; b=ofc6yZemaIp+VS0pOQpnY3yMc7WUet7+mx+xbewRWxqkNWaJfzZAdyd3kK1YfcNwLF 62vATxHIlKUeadEhZovvMfw/MEMIIkfBlBUYdgiKiHF7aYRRETP+hhid4LmYPdqMY0C3 jxtR874D/yRStsFMmGG14jHIbiX+uVUS4A5fu4CwdPy3M36cAbPSPo4YyPmFWW23NtRw vdCU+IJmpjBZZz2AhNkhv8PEgSg55ba9E7Mi2AYAuATEEtPNaIh1Q+hg7PzNMIKnPBZt 8LnVMXxomkwTyvZWtFOCss7Rdu5/Wkyq6eATLEwsPD2norqzH8J76m94e+6Q9OwICpYg 0A4Q== X-Gm-Message-State: AOAM53095PKL1qZUtJxTLFCI5z/aJgJN3By/XWziasl/FMejrct9HLmw iXPZGOGWuo/GBSL1QP3m2B0QoM7rQRBrXaRW X-Google-Smtp-Source: ABdhPJxjO35UNSehkB4BGFZLOWZ+ziczwvX3GKaWDtrA9OavTleg8eROATOV1foJb2L/aZPp+CXzNseKMOST5KYg X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:7220:84ff:fe09:7e9d]) (user=andreyknvl job=sendgmr) by 2002:ad4:47c4:: with SMTP id p4mr4509202qvw.23.1607538268306; Wed, 09 Dec 2020 10:24:28 -0800 (PST) Date: Wed, 9 Dec 2020 19:24:16 +0100 In-Reply-To: Message-Id: Mime-Version: 1.0 References: X-Mailer: git-send-email 2.29.2.576.ga3fc446d84-goog Subject: [PATCH mm 2/2] Revert "kasan, arm64: don't allow SW_TAGS with ARM64_MTE" From: Andrey Konovalov To: Andrew Morton X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201209_132432_469932_A685047D X-CRM114-Status: GOOD ( 14.15 ) 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: linux-arm-kernel@lists.infradead.org, Marco Elver , Catalin Marinas , Kevin Brodsky , Will Deacon , Branislav Rankov , kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Alexander Potapenko , Evgenii Stepanov , Andrey Konovalov , Andrey Ryabinin , Vincenzo Frascino , Dmitry Vyukov Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This reverts "kasan, arm64: don't allow SW_TAGS with ARM64_MTE". In earlier versions on the hardware tag-based KASAN patchset in-kernel MTE used to be always enabled when CONFIG_ARM64_MTE is on. This caused conflicts with the software tag-based KASAN mode. This is no logner the case: in-kernel MTE is never enabled unless the CONFIG_KASAN_HW_TAGS is enabled, so there are no more conflicts with CONFIG_KASAN_SW_TAGS. Allow CONFIG_KASAN_SW_TAGS to be enabled even when CONFIG_ARM64_MTE is enabled. Signed-off-by: Andrey Konovalov Reviewed-by: Marco Elver --- arch/arm64/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 6fefab9041d8..62a7668976a2 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -135,7 +135,7 @@ config ARM64 select HAVE_ARCH_JUMP_LABEL select HAVE_ARCH_JUMP_LABEL_RELATIVE select HAVE_ARCH_KASAN if !(ARM64_16K_PAGES && ARM64_VA_BITS_48) - select HAVE_ARCH_KASAN_SW_TAGS if (HAVE_ARCH_KASAN && !ARM64_MTE) + select HAVE_ARCH_KASAN_SW_TAGS if HAVE_ARCH_KASAN select HAVE_ARCH_KASAN_HW_TAGS if (HAVE_ARCH_KASAN && ARM64_MTE) select HAVE_ARCH_KFENCE select HAVE_ARCH_KGDB