Received: by 2002:a05:7412:d008:b0:f9:6acb:47ec with SMTP id bd8csp219131rdb; Tue, 19 Dec 2023 14:37:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IEyvHpu3cbSd1v1GoBmqL5VKosnFebGwQqbNhgxxWNc8mZ6YLWFSRp37fyXOlFkfxjyRZYK X-Received: by 2002:a05:6358:c613:b0:170:17eb:1eb with SMTP id fd19-20020a056358c61300b0017017eb01ebmr9825420rwb.46.1703025478625; Tue, 19 Dec 2023 14:37:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703025478; cv=none; d=google.com; s=arc-20160816; b=iZ/HTZyU7YJUwk5BQLPSSQ38ZQ0RilbUE8eeXrgLNRL+Ap53qYco8u+GfILX67agOJ H6s/qwvVnIIx485jQ/Zgf+E8e5DzruodC9u7dWgy61+YOsBsnicdiKGYLCYD/F1WZcrn X6S9tRGiBPiwaWldzvYQi+tdM4a8yj+AODwpj7Dh63Ryzwum7JifYQTVv5htC45PDv2I Mb+HOyEIz2qjfGUfoa2U4fV+UCLxPQPnt1hf//Hy000ajKQk59STIgcIyf7uQCbwBO5I hdccK4uO68LR4Of3TP3cSCZ1KeK2WT6jg0E4liWgWJVQVngke/hahPAMb3PoWTy+IMMg iMWA== 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=EPGVjwO+qP/d7FcuwPK2D6CcDKWjvT42oG4AsVrb0Go=; fh=AIzsiqkKUtrB7QnM+XRgAblgvDINIC5pDvD0mg8EzrU=; b=cGyvJkBABettmtOCNm8Qxw3ILXYl5RaV8fXDfDhu32Msr1fusg2waRAuKpzJlYgsHE N/2LntvrdqqBRv5fNukruoWq1E/ob7yadPOsYkbOgp9qy5To6JfncG96H1JbZjuOYCLg N4eDYhkPKArfTrt5/O4FYpfVKnleI3RnoJ5HoGvqN/XELR2IUbS/jzhiadWzYYQBaicu m3QmRu/GK/MTGEL6CI7Vmy6BIME50Lyise6yWMKEu2fuv+TuuoceyjQSaSXRcTXeAuhp gvP8itURMSiCqRxnEsibZmsTxJOiBT7XctDADC4qszNpEwA53GoVbKFXDmplZXQVjMyO Hj2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="PVS7/Vp9"; spf=pass (google.com: domain of linux-kernel+bounces-6063-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6063-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id fc12-20020a056a002e0c00b006d287b61384si7741976pfb.175.2023.12.19.14.37.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 14:37:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-6063-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="PVS7/Vp9"; spf=pass (google.com: domain of linux-kernel+bounces-6063-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6063-linux.lists.archive=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 542EDB23E43 for ; Tue, 19 Dec 2023 22:35:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D07F04D596; Tue, 19 Dec 2023 22:32:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="PVS7/Vp9" X-Original-To: linux-kernel@vger.kernel.org Received: from out-189.mta1.migadu.com (out-189.mta1.migadu.com [95.215.58.189]) (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 1C8C54CB34 for ; Tue, 19 Dec 2023 22:32:32 +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=1703025150; 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=EPGVjwO+qP/d7FcuwPK2D6CcDKWjvT42oG4AsVrb0Go=; b=PVS7/Vp9rKcCStvahkmREEOMnuEX6kau1z/8KUeJ+M+L9oh0S/muURork3hPcDgoR/5lvV ReB2LpYutwX5p3c63FdFGnocPloJeeIBz+IrzYNEY41q/t2SiRz0dp5ZLm4EF8f/mEHnF3 IzsuSBbMxsPovIvvYoBbisxMLMXLZwo= From: andrey.konovalov@linux.dev To: Marco Elver , Alexander Potapenko Cc: Andrey Konovalov , Dmitry Vyukov , Andrey Ryabinin , kasan-dev@googlegroups.com, Evgenii Stepanov , Breno Leitao , Alexander Lobakin , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Subject: [PATCH mm 21/21] io_uring: use mempool KASAN hook Date: Tue, 19 Dec 2023 23:29:05 +0100 Message-Id: In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT From: Andrey Konovalov Use the proper kasan_mempool_unpoison_object hook for unpoisoning cached objects. A future change might also update io_uring to check the return value of kasan_mempool_poison_object to prevent double-free and invalid-free bugs. This proves to be non-trivial with the current way io_uring caches objects, so this is left out-of-scope of this series. Signed-off-by: Andrey Konovalov --- io_uring/alloc_cache.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/io_uring/alloc_cache.h b/io_uring/alloc_cache.h index 8de0414e8efe..bf2fb26a6539 100644 --- a/io_uring/alloc_cache.h +++ b/io_uring/alloc_cache.h @@ -33,7 +33,7 @@ static inline struct io_cache_entry *io_alloc_cache_get(struct io_alloc_cache *c struct io_cache_entry *entry; entry = container_of(cache->list.next, struct io_cache_entry, node); - kasan_unpoison_range(entry, cache->elem_size); + kasan_mempool_unpoison_object(entry, cache->elem_size); cache->list.next = cache->list.next->next; cache->nr_cached--; return entry; -- 2.25.1