Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3676381rdb; Wed, 13 Sep 2023 21:48:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFWs7qnRymzRpmtLpo0xYEp2ei2wII59W3JEicr5w1RZA/ClYahcVaswPO/HUbCL5aI73dC X-Received: by 2002:a05:6870:3749:b0:1d5:3fd3:390a with SMTP id a9-20020a056870374900b001d53fd3390amr4565944oak.49.1694666923101; Wed, 13 Sep 2023 21:48:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694666923; cv=none; d=google.com; s=arc-20160816; b=tpeRXByr6qcH9THpuzmnk9tWz/VjSV0S6D8pXGE7DOHEFXqvWsxaGicmTIFzoKjFo1 u5tlFx3n6w7WFytb6mpv0MrB/OoGnXuHEOWZ5mYhMy4TwxQ4OidNXlA2tWyg6Ljr/kgh r3ohiKiZ7V3yA6ma3iv/bE3Ay80TwJrdwbMKTToJkmDLYtL5KcJw+Moi+Qk6/UzS/LVV tSnWbhinNmx3n2Jh13WTAE/q73H2Nj0qMk7Q79xR3zSNUJvR4avIQ9XR8mYndt30z4+b aLk1hkEGYWqshdkLedK0lV/Wg+qQGrrkvWnfypPGeCRSVrOOgUQlrYTl7GsJFBGtRN0L OLkw== 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=gGKJxtryqSg7zyzOR+J62w3w1hKrmZ/huaWffkkgHB8=; fh=nfQSbTp1dWHt2Ier1Up8UhVNdXOqoJJLNvTrpT3jJEk=; b=RAhJqh4Z2q3+XxTWKSEOB2DgxOjAMa+TntACN0PET+UDUrXf6anhgtynFXHIFZrKJw d8hyOkecI0HdiN0amVy0Eq9RUay8SAgghMA3eVJK0POCnK3nwIAWylJJbFX9lsBOAWSv 8XM7LhOK30vpchTYDNUjLlhX3R8yfISa1lu8SQ6s4NIcd5QJpyTk0aVvT88G5mjMjjH7 jW9eeT+J1L9ETekii9U5Yi+3bKLxS1tKpqJp9GskwVWevqPnCqUibhvbjd+lStwZ7qxJ DGkUI7N0E0WLjUFDrJj6j0ot+aBIWENZKZic9SsZyvZJrMB5EaAQ7ArOn9ePaCfjRipu 5piQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=Kykiqu4a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id u1-20020a63d341000000b00577646e2b6bsi721549pgi.206.2023.09.13.21.48.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 21:48:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=Kykiqu4a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id D22B4817C3E1; Wed, 13 Sep 2023 10:18:59 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231775AbjIMRSt (ORCPT + 99 others); Wed, 13 Sep 2023 13:18:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231202AbjIMRSd (ORCPT ); Wed, 13 Sep 2023 13:18:33 -0400 Received: from out-227.mta1.migadu.com (out-227.mta1.migadu.com [95.215.58.227]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64A0A1FD4 for ; Wed, 13 Sep 2023 10:18:06 -0700 (PDT) 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=1694625484; 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=gGKJxtryqSg7zyzOR+J62w3w1hKrmZ/huaWffkkgHB8=; b=Kykiqu4aZApYf03YebHa3Dl/Iiz3dyOXmVXrrBHmpydAQBwIdJhL3HLDTzwCu05bpW7SeU 7532l7l5s0ccuWBVga6HibBP/hh1Jt3T/r7Xexqvuo0EKwyd5lqVv2v2D3IiN0BK5IbTfw g5lfY7rNPM1SE6bV/kcFjLK6Jf0r1ds= From: andrey.konovalov@linux.dev To: Marco Elver , Alexander Potapenko Cc: Andrey Konovalov , Dmitry Vyukov , Vlastimil Babka , kasan-dev@googlegroups.com, Evgenii Stepanov , Oscar Salvador , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Subject: [PATCH v2 18/19] kasan: check object_size in kasan_complete_mode_report_info Date: Wed, 13 Sep 2023 19:14:43 +0200 Message-Id: <293d73bcd89932bc026263d3df8ee281ad3f621f.1694625260.git.andreyknvl@google.com> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 13 Sep 2023 10:19:00 -0700 (PDT) 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 autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email From: Andrey Konovalov 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. Signed-off-by: Andrey Konovalov --- Changes v1->v2: - This is a new patch. --- mm/kasan/report_tags.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/kasan/report_tags.c b/mm/kasan/report_tags.c index 78abdcde5da9..98c238ba3545 100644 --- a/mm/kasan/report_tags.c +++ b/mm/kasan/report_tags.c @@ -58,7 +58,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) { -- 2.25.1