Message ID | 98a4b1617e8ceeb266ef9a46f5e8c7f67a563ad2.1703024586.git.andreyknvl@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-6053-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp2274211dyi; Tue, 19 Dec 2023 14:33:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IHGhapexIw/+c8f97JRAoeo11dWEUhesS5bhDEvU2QDtW6F6/b/Grn1GZOPiKgi76Sa1ZsZ X-Received: by 2002:a17:906:7fc9:b0:a23:5893:1ac8 with SMTP id r9-20020a1709067fc900b00a2358931ac8mr1819551ejs.27.1703025225598; Tue, 19 Dec 2023 14:33:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703025225; cv=none; d=google.com; s=arc-20160816; b=eXHHuRuXnjXAOyNNALnBz/Fzrp+GeURw9gC1VtOdSb/pyKyYI8DQSWMpb/CF+k4ZQC W+mxVI7x3bqDnZq6+u6ydjpd3jemr5NOBUnU223VRbXDf5x3EMz/8ze4obwmvahNMpj8 jSsruIz4gOImQaQlg1nBNIzOr+4DtrwnGVWy5B+yEq3KcdHsvrvvWpt0/ruj0C5Y3qHN uljf96cGW6BCYHIoxpzxwYM/mFDcuXMZZJ5QYz0sPibulUs5GTAlGeyZLIDtjOoAHfeq 1HDpXrQNtAQLqrlQONAY/VVbaPcQd45qAL0c3nfXnluKkyY0UZnVUDRH7PZFtW2CXCr2 O/oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=KVsX1wYh/u3bsgXc0v6541Y+g0kgoewEBIuD2sVrVOE=; fh=AIzsiqkKUtrB7QnM+XRgAblgvDINIC5pDvD0mg8EzrU=; b=VfJhm28ei0Y3sbftijye0nZQHL16q4jUaKipBae2ou6sbOtdSAF5iN/KP2Zq0pBwBr nHHAdtwz+VpaQ7A5IlDLw239SQs9fU2rEdgGtm3lr60OiGCGEzKyxBegvXfFrRC33Zau Ud7pvaLeJe2tvab8CxLkZPdz8OeeYwGK5QLkYCQs84eKrbECQM7zpt+wxKUgeIKhldzc Pv7Eme+JU56FKRbY3Dx9r3aIZE1gFQiC/0otbgE4B28u9SoXmS6rNzHhd1vMGRumMIpj mKvw5TLZqtsYUzhxt4BKPfU9mpOzlzgQAItq19IlpjJY5V4R7lu/x8pZYVuKgg+fJPBL puZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=Kt1rNfuv; spf=pass (google.com: domain of linux-kernel+bounces-6053-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6053-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id lj11-20020a170906f9cb00b00a235b1d5de0si1898059ejb.440.2023.12.19.14.33.45 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 14:33:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-6053-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=Kt1rNfuv; spf=pass (google.com: domain of linux-kernel+bounces-6053-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6053-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id F35211F263B4 for <ouuuleilei@gmail.com>; Tue, 19 Dec 2023 22:33:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A4BFA4184B; Tue, 19 Dec 2023 22:31:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="Kt1rNfuv" X-Original-To: linux-kernel@vger.kernel.org Received: from out-179.mta0.migadu.com (out-179.mta0.migadu.com [91.218.175.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC21F3D0AB for <linux-kernel@vger.kernel.org>; Tue, 19 Dec 2023 22:31:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev 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=1703025084; 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=KVsX1wYh/u3bsgXc0v6541Y+g0kgoewEBIuD2sVrVOE=; b=Kt1rNfuvx7+wT5H8UNOgwHCeTbOEvaDygKRpZZi3u1FYmus+bD/11ubTVW79B+oIdiaNwz JlwOYJnlQA+xJy+dqmZh3LmC25rgn5CNTohHAkyMco9Blc+/P3IIuddLLDTvM6CJy8A9+O KeuWbai25yfJ/zAiqqyvZxcC5VTNrDs= From: andrey.konovalov@linux.dev To: Marco Elver <elver@google.com>, Alexander Potapenko <glider@google.com> Cc: Andrey Konovalov <andreyknvl@gmail.com>, Dmitry Vyukov <dvyukov@google.com>, Andrey Ryabinin <ryabinin.a.a@gmail.com>, kasan-dev@googlegroups.com, Evgenii Stepanov <eugenis@google.com>, Breno Leitao <leitao@debian.org>, Alexander Lobakin <alobakin@pm.me>, Andrew Morton <akpm@linux-foundation.org>, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov <andreyknvl@google.com> Subject: [PATCH mm 13/21] mempool: skip slub_debug poisoning when KASAN is enabled Date: Tue, 19 Dec 2023 23:28:57 +0100 Message-Id: <98a4b1617e8ceeb266ef9a46f5e8c7f67a563ad2.1703024586.git.andreyknvl@google.com> In-Reply-To: <cover.1703024586.git.andreyknvl@google.com> References: <cover.1703024586.git.andreyknvl@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785751378913517398 X-GMAIL-MSGID: 1785751378913517398 |
Series |
kasan: save mempool stack traces
|
|
Commit Message
andrey.konovalov@linux.dev
Dec. 19, 2023, 10:28 p.m. UTC
From: Andrey Konovalov <andreyknvl@google.com> With the changes in the following patch, KASAN starts saving its metadata within freed mempool elements. Thus, skip slub_debug poisoning and checking of mempool elements when KASAN is enabled. Corruptions of freed mempool elements will be detected by KASAN anyway. Signed-off-by: Andrey Konovalov <andreyknvl@google.com> --- Changes RFC->v1: - This is a new patch. --- mm/mempool.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/mm/mempool.c b/mm/mempool.c index 7e1c729f292b..1fd39478c85e 100644 --- a/mm/mempool.c +++ b/mm/mempool.c @@ -56,6 +56,10 @@ static void __check_element(mempool_t *pool, void *element, size_t size) static void check_element(mempool_t *pool, void *element) { + /* Skip checking: KASAN might save its metadata in the element. */ + if (kasan_enabled()) + return; + /* Mempools backed by slab allocator */ if (pool->free == mempool_kfree) { __check_element(pool, element, (size_t)pool->pool_data); @@ -81,6 +85,10 @@ static void __poison_element(void *element, size_t size) static void poison_element(mempool_t *pool, void *element) { + /* Skip poisoning: KASAN might save its metadata in the element. */ + if (kasan_enabled()) + return; + /* Mempools backed by slab allocator */ if (pool->alloc == mempool_kmalloc) { __poison_element(element, (size_t)pool->pool_data);