Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3542199pxb; Mon, 24 Jan 2022 11:49:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJz+U7ZYSThSa2jcC0M1jdFLdV2slPPTZTYJFRQS/L13ygbEXfzy/zlqxgtI44YozT4Vby9n X-Received: by 2002:a17:902:e5cd:b0:14b:b3e:cdb6 with SMTP id u13-20020a170902e5cd00b0014b0b3ecdb6mr15450840plf.33.1643053755131; Mon, 24 Jan 2022 11:49:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643053755; cv=none; d=google.com; s=arc-20160816; b=UzseUXmQex2W2YEyMef/fwi4SbAKWrY6xEvH7gwZjLEcZ9bY2NcPr97Qu3CA86jam4 b2sDqirQKLJ7dQ85riS/UvWFwN+X02JPAse8Yakg8x+WYDV2nAi10e00i5vzNTejgVPm E/pcnM94v20j02iifL/VaYYJAeGpXPIP1e2fUPNYC7sTHvV9HHF7HLIdTCg78iEmMVD7 +ItqNG4BeRdp/x8ZjjtA33Z3qWhj/gHox3iQbrPOzAE/6TvRPDWmfpOwjCKcTb2wxkq8 088cGiGHdVYn0JSDyx+DLhIyPCC7Q0dOmOKggWhF9FsD3LP1j1LqXAuf/DDmIJhP4br/ lpkA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=28nrHGgMyGK55v/Rjfsypuf+W8Mz9cvlkAPr7bWxb48=; b=sRgiKYxMqw4sDWO7333IKWAi9/e5gPrBqqunUx9UtsudH76vWEsVyS5xoaMooNs6mt 2FKWtANqG2dMIYkGkZMZkDHnI4E99qR9LkHBvdRAfWZW1cIjOOywvQQtJpiAA2I2On8Q s+J0aGM971r2IeJsHXWTpgSspJ44jGvMiHrBs60FGqerTS+OzYK/k3seStOyBBOaCOb7 vQd3KlfbZ80UQpAjT/A7uJXdBqwSbGSTAuH//5KRf5vUC1wsjgB/OgwEVBwSi1SWToyn wHsAopjqP9vreeLOftSV84ddQ1UY0My1TQmFnqA8aYfqqimX1at+MU4iUAxlhs4jYDrl xZGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=fFDtB2KD; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u12si4054761pgb.821.2022.01.24.11.49.03; Mon, 24 Jan 2022 11:49:15 -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; dkim=pass header.i=@linux.dev header.s=key1 header.b=fFDtB2KD; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244989AbiAXSEW (ORCPT + 99 others); Mon, 24 Jan 2022 13:04:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244910AbiAXSEI (ORCPT ); Mon, 24 Jan 2022 13:04:08 -0500 Received: from out2.migadu.com (out2.migadu.com [IPv6:2001:41d0:2:aacc::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7AC7FC06173B for ; Mon, 24 Jan 2022 10:04:07 -0800 (PST) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1643047446; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=28nrHGgMyGK55v/Rjfsypuf+W8Mz9cvlkAPr7bWxb48=; b=fFDtB2KDwFbcEENCkw/8vc4GY+6LJfkdVAPQUtLwY81rGhcfffeiO8X1oggyWxFg/7KuhZ 8GM8tTPROF3c30ccsKKSW7CrIL69KUwrv36N6NfYYU0hjZzO1/Eg/MMrzqsd5kwB97XpiF gO400E0HvSdPO/Wu/9oY3GEZ0mg8r3c= From: andrey.konovalov@linux.dev To: Andrew Morton Cc: Andrey Konovalov , Marco Elver , Alexander Potapenko , Dmitry Vyukov , Andrey Ryabinin , kasan-dev@googlegroups.com, linux-mm@kvack.org, Vincenzo Frascino , Catalin Marinas , Will Deacon , Mark Rutland , linux-arm-kernel@lists.infradead.org, Peter Collingbourne , Evgenii Stepanov , linux-kernel@vger.kernel.org, Andrey Konovalov Subject: [PATCH v6 15/39] kasan: clean up metadata byte definitions Date: Mon, 24 Jan 2022 19:02:23 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andrey Konovalov Most of the metadata byte values are only used for Generic KASAN. Remove KASAN_KMALLOC_FREETRACK definition for !CONFIG_KASAN_GENERIC case, and put it along with other metadata values for the Generic mode under a corresponding ifdef. Signed-off-by: Andrey Konovalov Reviewed-by: Alexander Potapenko --- mm/kasan/kasan.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mm/kasan/kasan.h b/mm/kasan/kasan.h index c17fa8d26ffe..952cd6f9ca46 100644 --- a/mm/kasan/kasan.h +++ b/mm/kasan/kasan.h @@ -71,15 +71,16 @@ static inline bool kasan_sync_fault_possible(void) #define KASAN_PAGE_REDZONE 0xFE /* redzone for kmalloc_large allocations */ #define KASAN_KMALLOC_REDZONE 0xFC /* redzone inside slub object */ #define KASAN_KMALLOC_FREE 0xFB /* object was freed (kmem_cache_free/kfree) */ -#define KASAN_KMALLOC_FREETRACK 0xFA /* object was freed and has free track set */ #else #define KASAN_FREE_PAGE KASAN_TAG_INVALID #define KASAN_PAGE_REDZONE KASAN_TAG_INVALID #define KASAN_KMALLOC_REDZONE KASAN_TAG_INVALID #define KASAN_KMALLOC_FREE KASAN_TAG_INVALID -#define KASAN_KMALLOC_FREETRACK KASAN_TAG_INVALID #endif +#ifdef CONFIG_KASAN_GENERIC + +#define KASAN_KMALLOC_FREETRACK 0xFA /* object was freed and has free track set */ #define KASAN_GLOBAL_REDZONE 0xF9 /* redzone for global variable */ #define KASAN_VMALLOC_INVALID 0xF8 /* unallocated space in vmapped page */ @@ -110,6 +111,8 @@ static inline bool kasan_sync_fault_possible(void) #define KASAN_ABI_VERSION 1 #endif +#endif /* CONFIG_KASAN_GENERIC */ + /* Metadata layout customization. */ #define META_BYTES_PER_BLOCK 1 #define META_BLOCKS_PER_ROW 16 -- 2.25.1