Message ID | 68c6948175aadd7e7e7deea61725103d64a4528f.1700502145.git.andreyknvl@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2b07:b0:403:3b70:6f57 with SMTP id io7csp108221vqb; Mon, 20 Nov 2023 09:52:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IFGD5wkc4x+CdHA+HOkHW9fUWCbpww5kV6hi31m+EbL1enaOkrURonFKd3h1hfXQ9IT4xv9 X-Received: by 2002:a05:6a21:6d9b:b0:187:5302:4b20 with SMTP id wl27-20020a056a216d9b00b0018753024b20mr7445334pzb.41.1700502756692; Mon, 20 Nov 2023 09:52:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700502756; cv=none; d=google.com; s=arc-20160816; b=iPLiD/lwddy12OVWKhkSaORyRJigELyvez+ICitrhIANRbQadv/++L7hEBpzLmMsJG hYHhw3GNuE8zVcsvx/P9VagF2R1SxaL+jpaiayA1+e22A6xN8PnNaDnn2Oxqm2vd1ayF 85h9rJNkeCogKUNXMepGfgvMLsYXFHPE9tcjM6gI6sJrFyVUu0GJOfOdKt1s9dHqV+AJ 1iZQr/w6VasGNR3cw8RJ4ZHzGXZ+aJqHE2NXjUIH54WmS6wvCE+P6KlMwEjt7wFqWJ+c 20SQRHtnVTALVYu9TG9t/wHgGRiDK0kFez0GHNgMouwSdCSn/l0sA6G8bU2MbG0voxJs q3sg== 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=uhMrVBrzgAoT1gwViC8KxLkH9OMZhix/uhvoEc70W98=; fh=qWoxmPN1zRqnLSoCWGpfFsDtzJsx/SGdqx98lbP+Uho=; b=SGF/aka9fYd6MctDvjFktR/ZpMnm6vAAODKUe0sdtWWBw0coXv+8i8sjvlNa5Wj6b1 //WUezRXNsOEksV/Tnx6VeTTo3cfeiELI4ma3YgqaKMAV3zIk5BAS6LGYsbSksKy49eq oizZgg7e1Sc4AsWFQY3dr8tg1gXvXXkMA/ZlolDstyCz6ab07klt/AfzvMC5Zmxpn/No 7Ay1Hp/WYKp57tcTD2yEbQd1aHPCMsb+xuJfGYDoCmslDG7P6XNayF0QO/4fmirwhV3w 8cdjMt6SVsAwhRdlx0JsTlOXe92PBkRWBysKuyw4aaD25W3669AX1JlWHE+unewoXvXw O3Xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=lATFUJLN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id u128-20020a627986000000b006935df301a3si8213236pfc.8.2023.11.20.09.52.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 09:52:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=lATFUJLN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 38CE8803D8C8; Mon, 20 Nov 2023 09:52:32 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231132AbjKTRv4 (ORCPT <rfc822;heyuhang3455@gmail.com> + 27 others); Mon, 20 Nov 2023 12:51:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234295AbjKTRvX (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 20 Nov 2023 12:51:23 -0500 Received: from out-182.mta1.migadu.com (out-182.mta1.migadu.com [95.215.58.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73EDED45 for <linux-kernel@vger.kernel.org>; Mon, 20 Nov 2023 09:50:45 -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=1700502643; 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=uhMrVBrzgAoT1gwViC8KxLkH9OMZhix/uhvoEc70W98=; b=lATFUJLNYsof+QZ6G2sBXsnC9Q+wIKDyc8lFVJDjx9RK2nGA9FoeQs6kQO+6hjM8HBefIP eURADnY2Rf+gcAsebe+mW3WuHxDxbtNbYaSjhKQqLHNAk7mVow4Kb9CTZdG5zssygETF+r BwY3IBxnt51rdnlRs7VhwlO0TNcSVR8= From: andrey.konovalov@linux.dev To: Andrew Morton <akpm@linux-foundation.org> Cc: Andrey Konovalov <andreyknvl@gmail.com>, Marco Elver <elver@google.com>, Alexander Potapenko <glider@google.com>, Dmitry Vyukov <dvyukov@google.com>, Vlastimil Babka <vbabka@suse.cz>, kasan-dev@googlegroups.com, Evgenii Stepanov <eugenis@google.com>, Oscar Salvador <osalvador@suse.de>, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov <andreyknvl@google.com> Subject: [PATCH v4 19/22] kasan: check object_size in kasan_complete_mode_report_info Date: Mon, 20 Nov 2023 18:47:17 +0100 Message-Id: <68c6948175aadd7e7e7deea61725103d64a4528f.1700502145.git.andreyknvl@google.com> In-Reply-To: <cover.1700502145.git.andreyknvl@google.com> References: <cover.1700502145.git.andreyknvl@google.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 20 Nov 2023 09:52:32 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783106378400463305 X-GMAIL-MSGID: 1783106378400463305 |
Series |
stackdepot: allow evicting stack traces
|
|
Commit Message
andrey.konovalov@linux.dev
Nov. 20, 2023, 5:47 p.m. UTC
From: Andrey Konovalov <andreyknvl@google.com> Check the object size when looking up entries in the stack ring. If the size of the object for which a report is being printed does not match the size of the object for which a stack trace has been saved in the stack ring, the saved stack trace is irrelevant. Reviewed-by: Alexander Potapenko <glider@google.com> Signed-off-by: Andrey Konovalov <andreyknvl@google.com> --- Changes v2->v3: - Added missing "../slab.h" include for accessing a kmem_cache field. Changes v1->v2: - This is a new patch. --- mm/kasan/report_tags.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/mm/kasan/report_tags.c b/mm/kasan/report_tags.c index 78abdcde5da9..55154743f915 100644 --- a/mm/kasan/report_tags.c +++ b/mm/kasan/report_tags.c @@ -7,6 +7,7 @@ #include <linux/atomic.h> #include "kasan.h" +#include "../slab.h" extern struct kasan_stack_ring stack_ring; @@ -58,7 +59,8 @@ void kasan_complete_mode_report_info(struct kasan_report_info *info) entry = &stack_ring.entries[i % stack_ring.size]; if (kasan_reset_tag(entry->ptr) != info->object || - get_tag(entry->ptr) != get_tag(info->access_addr)) + get_tag(entry->ptr) != get_tag(info->access_addr) || + info->cache->object_size != entry->size) continue; if (entry->is_free) {