Received: by 2002:a05:7412:d008:b0:f9:6acb:47ec with SMTP id bd8csp215738rdb; Tue, 19 Dec 2023 14:29:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IHn1jeKwbM92lCiiHs6mGzBS+XRQ+lDrVrZz9Qg53ZlukCVjTfZWMG9u7YeUGNpXSZdNRkj X-Received: by 2002:a50:cc88:0:b0:553:5609:3341 with SMTP id q8-20020a50cc88000000b0055356093341mr1254776edi.35.1703024990554; Tue, 19 Dec 2023 14:29:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703024990; cv=none; d=google.com; s=arc-20160816; b=NoZplzo2emEp2bpXUi2iUML2wFVOePnrAxo6DyJbCoBDA0fqqth86bYIRCYyM6Kqkj FiD4mBoeR1YZ1iRrjRPzRgxQkBvYnwMcHBg2KktxFgZXiytungS3I9BbME/uBnhef6fo 1xQr94ySwryllmSv3RfzulHAqp91yEyX1b1tohc0PAGHEyv+zkYzKFFpq1Q6gSrZ4jOh QWQrYvQ9fCwSvE1lIABl87vsPtsMPc2kTCHjkh1ELlMYtOD88GGFF9F/a1kk5AZcD6M7 mTRPWgHDZsMPTcQpxXOATNV9UC09fbFzrkRnsOTWflZWHp+p8OzDn/ZMlSOatJoE/KBs wnLQ== 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=nDVhwjjwJnVTlqgIL3b0i6xOOMbmQ8bjgeF5HzBvdls=; fh=AIzsiqkKUtrB7QnM+XRgAblgvDINIC5pDvD0mg8EzrU=; b=0hHLCmGjS29zOHNNU1IJ9jIf1+i4mfdis0sBhFEXgXdSBuja2u/ucYHe3gufhjtDTn qRoA/ArLnO3cee6IJ5vjrfMlTUQI8InQthPsnR3perc+ZvDisHxza148VswudZDzBIJP twlFMeyJFiA95i4IAcA6fCnOaOkxYg1yA9o/VJv+lOrPSL8ACOndmrEPr0U57Fydid8Y LzphOr0MwU5OaX5Uul50dZcXcCm06b/h9ghp24dYEaG2Q/ZkFmgQqpE2fFjk8Eot2Cec EdifqTtfHdB5o8D8RSJM0o+2UPdtIUXQeY46wJyxF/bKUndyaZtffn8aD7T+q408UxAs YmaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=C4rzmgvl; spf=pass (google.com: domain of linux-kernel+bounces-6045-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6045-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id v6-20020a056402348600b0054c943a07bfsi11634724edc.373.2023.12.19.14.29.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 14:29:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-6045-linux.lists.archive=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=C4rzmgvl; spf=pass (google.com: domain of linux-kernel+bounces-6045-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-6045-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 50B6E1F24A96 for ; Tue, 19 Dec 2023 22:29:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 537723FB08; Tue, 19 Dec 2023 22:29:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="C4rzmgvl" X-Original-To: linux-kernel@vger.kernel.org Received: from out-184.mta1.migadu.com (out-184.mta1.migadu.com [95.215.58.184]) (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 ABD083D0B3 for ; Tue, 19 Dec 2023 22:29:15 +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=1703024953; 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=nDVhwjjwJnVTlqgIL3b0i6xOOMbmQ8bjgeF5HzBvdls=; b=C4rzmgvlL10DUVbNDtuc0Rxs46Curn42ZGKpKom91VOpoIt4fpkrs/ypbw6AsjfsBn5cAV f4+a7vAj+bLJwhOfAkOj0ot52A4kwU/QGW9g6mUQ3jTBsZTJ9qMcuEm6y1mZK7xk4PDRQ1 qJLgEpIfbiitBegq2Oh+ysHOy3abWJw= 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 03/21] kasan: document kasan_mempool_poison_object Date: Tue, 19 Dec 2023 23:28:47 +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 Add documentation comment for kasan_mempool_poison_object. Signed-off-by: Andrey Konovalov --- include/linux/kasan.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/include/linux/kasan.h b/include/linux/kasan.h index 0d1f925c136d..bbf6e2fa4ffd 100644 --- a/include/linux/kasan.h +++ b/include/linux/kasan.h @@ -213,6 +213,24 @@ static __always_inline void * __must_check kasan_krealloc(const void *object, } void __kasan_mempool_poison_object(void *ptr, unsigned long ip); +/** + * kasan_mempool_poison_object - Check and poison a mempool slab allocation. + * @ptr: Pointer to the slab allocation. + * + * This function is intended for kernel subsystems that cache slab allocations + * to reuse them instead of freeing them back to the slab allocator (e.g. + * mempool). + * + * This function poisons a slab allocation without initializing its memory and + * without putting it into the quarantine (for the Generic mode). + * + * This function also performs checks to detect double-free and invalid-free + * bugs and reports them. + * + * This function operates on all slab allocations including large kmalloc + * allocations (the ones returned by kmalloc_large() or by kmalloc() with the + * size > KMALLOC_MAX_SIZE). + */ static __always_inline void kasan_mempool_poison_object(void *ptr) { if (kasan_enabled()) -- 2.25.1