Message ID | b6cd96a70f8faf58a1013ae063357d84db8d38d6.1614989145.git.andreyknvl@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <SRS0=RjTh=IE=lists.infradead.org=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@kernel.org> 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.8 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 3B3C4C433DB for <linux-arm-kernel@archiver.kernel.org>; Sat, 6 Mar 2021 00:09:24 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 BC623650AC for <linux-arm-kernel@archiver.kernel.org>; Sat, 6 Mar 2021 00:09:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BC623650AC 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Cc:To:From:Subject:Mime-Version:Message-Id:Date: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=M8vmt9C2ZRV77oPoSX8Q2wpvrf7OOoWmUd66rpzZf+Y=; b=RFVWh2kKtlHghqZah3CSMH7U0u d6ZsndI90FSInlbi3JxiQ1+xhNxR1+qUMLba0qIo+RvkV6xgmRreP69QwiXA0Rpp+Lfc19n7Jjtbw Za9iWzCbMOrh50szHohSt5Dv8CTa5xqc9q6RkjPkNOlNiU1QdqbDfzLHDwiIxxA+H8qpZltPJqBzx jLlrXEdZBeX0Y1s+RQ9TI6WlLBlTMOMUg8hyfZ1uZMwpnSWlKqJfU4efXyl5tXpAt7JWgBw0WelQc B6nwyNlNvxX+sXbY6d8iYf8kTqsYaLxnH2RVvqgR3JaHq8hZjGFpHz1tiDRqFzU/Gr0LoRYNEOypK Vhb1ooyQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lIKTf-00HHyy-Co; Sat, 06 Mar 2021 00:07:27 +0000 Received: from mail-lf1-x149.google.com ([2a00:1450:4864:20::149]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lIKSJ-00HHKx-28 for linux-arm-kernel@lists.infradead.org; Sat, 06 Mar 2021 00:06:04 +0000 Received: by mail-lf1-x149.google.com with SMTP id k14so1373927lfg.16 for <linux-arm-kernel@lists.infradead.org>; Fri, 05 Mar 2021 16:06:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:message-id:mime-version:subject:from:to:cc; bh=fj2q1zjTS7x5AWIG0dea58z8gWp6VMPPrsYTyOmyMJM=; b=UM8dPWueQ2rP8EQo22LdiFyFIdNcCm2LrTSYmDM5rdipYyWdvPnCGXqzzc47WHtSsy hQkeEeT7Ssu8oPpE1PgktnWl0RccYYOCRoDcrhs4G3kfHceJK9WbSVmkpsfAXbwrLYO5 o1Laczp1zvUGvOkZpzzwBWHaUjHUJaJU3YWWeO3Oovo1hrmE1WKm3qhhSz78IQK5ORPQ QD+UAm0N7kAwsHGr9UDhMzI99Kq4GktDYPgKl5HXdujIwjSqUEzKyeVK+AYmD6YAc2QC GnTl1m7b2eHmW9gNVCAN1UR0DDmMSG3P7jD+nztIZfiYhmCvpTXyRu6g+FyTNRmi/0cm jjhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:message-id:mime-version:subject:from :to:cc; bh=fj2q1zjTS7x5AWIG0dea58z8gWp6VMPPrsYTyOmyMJM=; b=m3hjXq71d1UMUZjgehRv47HQauc7uMf7aaIm2Grxb1d3iZ1u6tEw1JKNJAcqnSn3WM mbIeqkpMZ3JvrlfM6ZCbS3fjzH05zG8Hj0pfyQ/0ZBBypZoCEtXWKk9rFR4f0S/T+Kcw 0E3eun0Iru2uI9bxtBrCMdLDbmjcp4X1pIk/gQPnGK98ui/DP2VYgAERPzDW966TKHsV c7h7BlZZGHJxlSfylc7XtEgOIXJuiL5AmM61lKeR5lQ3ReeStsxJW7sGFmgtm3HhJat3 Q7cacRtJomPahYXXrBfJnYAB6kVlBe5QUpskfiv+VS9Xpwm6ljOVhbzPZCUmST31HR53 ii8g== X-Gm-Message-State: AOAM530zokVkJh5V7iesj4WNzErhe8nD3uqGiifNedae+fQvOmO+1+dd 8AMCYJMSK19pZBFmPWLERHgA+UUd3P68PDLF X-Google-Smtp-Source: ABdhPJwSPDStaX/1ocLrHIISD3Qbk8FBkFPpRGzbZcmX+3ex2F1wrfrqzwIzWVswDnjpK5pWJshVddfpd1SJiy9a X-Received: from andreyknvl3.muc.corp.google.com ([2a00:79e0:15:13:953b:d7cf:2b01:f178]) (user=andreyknvl job=sendgmr) by 2002:a2e:8e86:: with SMTP id z6mr833578ljk.27.1614989161291; Fri, 05 Mar 2021 16:06:01 -0800 (PST) Date: Sat, 6 Mar 2021 01:05:57 +0100 Message-Id: <b6cd96a70f8faf58a1013ae063357d84db8d38d6.1614989145.git.andreyknvl@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.30.1.766.gb4fecdf3b7-goog Subject: [PATCH v3 1/2] kasan: initialize shadow to TAG_INVALID for SW_TAGS From: Andrey Konovalov <andreyknvl@google.com> To: Andrew Morton <akpm@linux-foundation.org>, Alexander Potapenko <glider@google.com> Cc: Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will.deacon@arm.com>, Vincenzo Frascino <vincenzo.frascino@arm.com>, Dmitry Vyukov <dvyukov@google.com>, Andrey Ryabinin <aryabinin@virtuozzo.com>, Marco Elver <elver@google.com>, Peter Collingbourne <pcc@google.com>, Evgenii Stepanov <eugenis@google.com>, Branislav Rankov <Branislav.Rankov@arm.com>, Kevin Brodsky <kevin.brodsky@arm.com>, kasan-dev@googlegroups.com, linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov <andreyknvl@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210306_000603_217285_F86C827B X-CRM114-Status: GOOD ( 14.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
[v3,1/2] kasan: initialize shadow to TAG_INVALID for SW_TAGS
|
expand
|
diff --git a/include/linux/kasan.h b/include/linux/kasan.h index b91732bd05d7..1d89b8175027 100644 --- a/include/linux/kasan.h +++ b/include/linux/kasan.h @@ -30,7 +30,8 @@ struct kunit_kasan_expectation { /* Software KASAN implementations use shadow memory. */ #ifdef CONFIG_KASAN_SW_TAGS -#define KASAN_SHADOW_INIT 0xFF +/* This matches KASAN_TAG_INVALID. */ +#define KASAN_SHADOW_INIT 0xFE #else #define KASAN_SHADOW_INIT 0 #endif
Currently, KASAN_SW_TAGS uses 0xFF as the default tag value for unallocated memory. The underlying idea is that since that memory hasn't been allocated yet, it's only supposed to be dereferenced through a pointer with the native 0xFF tag. While this is a good idea in terms on consistency, practically it doesn't bring any benefit. Since the 0xFF pointer tag is a match-all tag, it doesn't matter what tag the accessed memory has. No accesses through 0xFF-tagged pointers are considered buggy by KASAN. This patch changes the default tag value for unallocated memory to 0xFE, which is the tag KASAN uses for inaccessible memory. This doesn't affect accesses through 0xFF-tagged pointer to this memory, buut this allows KASAN to detect wild and large out-of-bounds invalid memory accesses through otherwise-tagged pointers. This is a prepatory patch for the next one, which changes the tag-based KASAN modes to not poison the boot memory. Signed-off-by: Andrey Konovalov <andreyknvl@google.com> --- include/linux/kasan.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)