From nobody Thu Dec 18 17:44:35 2025 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 C7599198A34 for ; Thu, 27 Jun 2024 15:14:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719501288; cv=none; b=X348Rjfg0+gkBfVCQhWZO6RG9KRIPMcMhmH4F+2Ypx48jugKTTWx7hGQNHF+j9SWzDyD1hYfx2JYuc8NrnyloCa+gmpmUcF8HeYOAsqpPtggY026+O1xsXacEGl8RnJSWyRV/ZCDUYaWmOHrx0b7rkNDedYnz2WeLNRdUzgyj30= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719501288; c=relaxed/simple; bh=f8x7WT5/nA6aNFCsNVrDgMstHK81Z1+toZLwmkwK5t0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=RSy3qngjbw9whV2DL84rt/jjZVNwrJFqT95b+kb+rCvHREjWc75Zo4w9BMa6MUlU18viTClnRjGcalRi8I8KEt0jj3KZEKevgyNe8A/cONj3XQrfxzYtXmzzczwZHIg0I3DYp5RiivOec98jsj4gedZyqFuR45RrvyuGWtFJX6I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=Y5PFjIf5; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="Y5PFjIf5" Received: from pps.filterd (m0353724.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45REuqR1015553; Thu, 27 Jun 2024 15:14:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from :to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:mime-version; s=pp1; bh=9nSO8vQ8Lysld J41kUs8BTYUja1+gnKPMCjMQs//hno=; b=Y5PFjIf5h6Km09SvAKoQtbFtJtQL9 UxKCaUYxKjp/3iayxbso7EzUhUx8yCP/6mkTpD9JErYqUUTM7DCapno8yKjRq6Vl nR9gbuxNUdtGaZ0jdS03iXe8ZEsM2YkM79rd8wE2Z60xBPSaAHNTLl5sRYnGNav4 0N0G1+4wPckEWUF9eEENeUs8nrNpLvIsJ7BLmRZkRRU3qhOsq4M9o/0mIYl1g5dH H3RNUky0n5Xag5d1FtFkfjuq4iChNuBt3qz6mCQ/gFdBYTp6hJwa8Zo2H5YT2jfp QHABQ7AYb07we3mZdwPtAr65nukhNzN2lCIhucxyU/O30YB4Z0b/FUuaA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4015fsrryj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Jun 2024 15:14:40 +0000 (GMT) Received: from m0353724.ppops.net (m0353724.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 45RFEdCP008846; Thu, 27 Jun 2024 15:14:39 GMT Received: from ppma21.wdc07v.mail.ibm.com (5b.69.3da9.ip4.static.sl-reverse.com [169.61.105.91]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 4015fsrryd-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Jun 2024 15:14:39 +0000 (GMT) Received: from pps.filterd (ppma21.wdc07v.mail.ibm.com [127.0.0.1]) by ppma21.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 45RBjA4l019602; Thu, 27 Jun 2024 14:58:02 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma21.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3yx9xqba9g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Jun 2024 14:58:02 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45REvwtr20054466 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 27 Jun 2024 14:58:00 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A80522004B; Thu, 27 Jun 2024 14:57:58 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2346220043; Thu, 27 Jun 2024 14:57:58 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.10.182]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 27 Jun 2024 14:57:58 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Potapenko , Marco Elver , Dmitry Vyukov , Andrew Morton Cc: kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Ilya Leoshkevich , kernel test robot Subject: [PATCH 1/2] kmsan: add missing __user tags Date: Thu, 27 Jun 2024 16:57:46 +0200 Message-ID: <20240627145754.27333-2-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240627145754.27333-1-iii@linux.ibm.com> References: <20240627145754.27333-1-iii@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: -d7cZN-z68hAjVNQeXA7A1nEUn9qEmjC X-Proofpoint-GUID: tjwTrgx4dkgHL1UYAClt-09Hv4Ljjbml Content-Transfer-Encoding: quoted-printable X-Proofpoint-UnRewURL: 0 URL was un-rewritten Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-27_11,2024-06-27_03,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 phishscore=0 impostorscore=0 malwarescore=0 suspectscore=0 priorityscore=1501 lowpriorityscore=0 mlxlogscore=988 spamscore=0 adultscore=0 clxscore=1011 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406270113 Content-Type: text/plain; charset="utf-8" sparse complains that __user pointers are being passed to functions that expect non-__user ones. In all cases, these functions are in fact working with user pointers, only the tag is missing. Add it. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202406272033.KejtfLkw-lkp@int= el.com/ Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko --- mm/kmsan/core.c | 4 ++-- mm/kmsan/kmsan.h | 6 +++--- mm/kmsan/report.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mm/kmsan/core.c b/mm/kmsan/core.c index 81b22220711a..a495debf1436 100644 --- a/mm/kmsan/core.c +++ b/mm/kmsan/core.c @@ -249,8 +249,8 @@ struct page *kmsan_vmalloc_to_page_or_null(void *vaddr) return NULL; } =20 -void kmsan_internal_check_memory(void *addr, size_t size, const void *user= _addr, - int reason) +void kmsan_internal_check_memory(void *addr, size_t size, + const void __user *user_addr, int reason) { depot_stack_handle_t cur_origin =3D 0, new_origin =3D 0; unsigned long addr64 =3D (unsigned long)addr; diff --git a/mm/kmsan/kmsan.h b/mm/kmsan/kmsan.h index 91a360a31e85..29555a8bc315 100644 --- a/mm/kmsan/kmsan.h +++ b/mm/kmsan/kmsan.h @@ -73,7 +73,7 @@ void kmsan_print_origin(depot_stack_handle_t origin); * @off_last corresponding to different @origin values. */ void kmsan_report(depot_stack_handle_t origin, void *address, int size, - int off_first, int off_last, const void *user_addr, + int off_first, int off_last, const void __user *user_addr, enum kmsan_bug_reason reason); =20 DECLARE_PER_CPU(struct kmsan_ctx, kmsan_percpu_ctx); @@ -163,8 +163,8 @@ depot_stack_handle_t kmsan_internal_chain_origin(depot_= stack_handle_t id); void kmsan_internal_task_create(struct task_struct *task); =20 bool kmsan_metadata_is_contiguous(void *addr, size_t size); -void kmsan_internal_check_memory(void *addr, size_t size, const void *user= _addr, - int reason); +void kmsan_internal_check_memory(void *addr, size_t size, + const void __user *user_addr, int reason); =20 struct page *kmsan_vmalloc_to_page_or_null(void *vaddr); void kmsan_setup_meta(struct page *page, struct page *shadow, diff --git a/mm/kmsan/report.c b/mm/kmsan/report.c index 92e73ec61435..94a3303fb65e 100644 --- a/mm/kmsan/report.c +++ b/mm/kmsan/report.c @@ -148,7 +148,7 @@ void kmsan_print_origin(depot_stack_handle_t origin) } =20 void kmsan_report(depot_stack_handle_t origin, void *address, int size, - int off_first, int off_last, const void *user_addr, + int off_first, int off_last, const void __user *user_addr, enum kmsan_bug_reason reason) { unsigned long stack_entries[KMSAN_STACK_DEPTH]; --=20 2.45.2 From nobody Thu Dec 18 17:44:35 2025 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 DDE3A770F9 for ; Thu, 27 Jun 2024 15:14:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719501289; cv=none; b=s5yyXrHUvQ5PRUtabPqPLeVqBpTu9/FvGHfi9vXYXL8aUtzoNghAwQNkYa3MaiRCQKxzT3xstSehLG3HTujNY9Y/cEyD9j0kEXtsxGELmuVxuslDxX6V6Ihv3L3ohqBoOF8C11giIcV1sKplQkN0dWCq0NQH+OTFeVP9IOGnSEA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719501289; c=relaxed/simple; bh=kOASd7UC+j6GNE+MuVEH9Me7wXvBGgFcOXOBnWC7374=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=oiwxHBftVVV+X1ippsHAIMKsT3MjwCOv6uZPpVIMB3uTFJKUjRzs29gWEbyf5INHAHUTvim0kQjDia9prkcDp1Iihd6dXYMDD958n1MjGQKc7PxBgHIEc6fLGFE+O3lWsAr3s/LHbL2g+NZBmXJ9J/NGNInimNsJigfN+2nS8Q0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=HYol0NrL; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="HYol0NrL" Received: from pps.filterd (m0353725.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 45RExQfU013827; Thu, 27 Jun 2024 15:14:41 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from :to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:mime-version; s=pp1; bh=V66HzH9oSR/Si SXR4ViDL5nQK43Lz5hHmVXw8cMBNuw=; b=HYol0NrLDGcv8wIfLxnjT5kNzFtU8 6ijvy00JM8Ynf2cqI01FLnIyAD79Tukg+x/nIxesnHpXF+ZEqKX4XLA1gF+D21Ch O0Ovk1gTYLx9XRZH5oMGk/sEUnxeKshqZqzIg7c1VO7K9RJkPYqo4uMUwNAXJALQ vzx3AVJTeQChub8JBBeUdfONGwnyvmXKFyb2n8nAXWfqDSeP59WMmEYEcF6W3219 cluGfFuEUYJHKqJgKsVDUz8JyCjDwqOhjsouG5aTrGwOSLsNoeyaEaVzmn8CaN3w Vk98bCjyjN83n6V84GD53sO9QZpxRSDzi5vTgJe8ZfRfIi8751b+mxOhA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 401aagr19w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Jun 2024 15:14:41 +0000 (GMT) Received: from m0353725.ppops.net (m0353725.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 45RFEffv005834; Thu, 27 Jun 2024 15:14:41 GMT Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 401aagr19m-10 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Jun 2024 15:14:41 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 45REWkbs008183; Thu, 27 Jun 2024 14:58:03 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 3yx9b13fea-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 27 Jun 2024 14:58:03 +0000 Received: from smtpav07.fra02v.mail.ibm.com (smtpav07.fra02v.mail.ibm.com [10.20.54.106]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 45REw0Ot54133066 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 27 Jun 2024 14:58:02 GMT Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E340E2004E; Thu, 27 Jun 2024 14:57:59 +0000 (GMT) Received: from smtpav07.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5F12420043; Thu, 27 Jun 2024 14:57:59 +0000 (GMT) Received: from heavy.ibm.com (unknown [9.171.10.182]) by smtpav07.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 27 Jun 2024 14:57:59 +0000 (GMT) From: Ilya Leoshkevich To: Alexander Potapenko , Marco Elver , Dmitry Vyukov , Andrew Morton Cc: kasan-dev@googlegroups.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Ilya Leoshkevich , kernel test robot Subject: [PATCH 2/2] kmsan: do not pass NULL pointers as 0 Date: Thu, 27 Jun 2024 16:57:47 +0200 Message-ID: <20240627145754.27333-3-iii@linux.ibm.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240627145754.27333-1-iii@linux.ibm.com> References: <20240627145754.27333-1-iii@linux.ibm.com> X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: mcPDNdB_CcP6JYr2AQf9iTbwGMyHfuTJ X-Proofpoint-GUID: db94Zo-DaWkLUU5XH6LyXhk3sy8TGMD3 Content-Transfer-Encoding: quoted-printable X-Proofpoint-UnRewURL: 0 URL was un-rewritten Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-27_11,2024-06-27_03,2024-05-17_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=968 spamscore=0 bulkscore=0 suspectscore=0 mlxscore=0 phishscore=0 clxscore=1015 priorityscore=1501 lowpriorityscore=0 adultscore=0 malwarescore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2406140001 definitions=main-2406270113 Content-Type: text/plain; charset="utf-8" sparse complains about passing NULL pointers as 0. Fix all instances. Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202406272033.KejtfLkw-lkp@int= el.com/ Signed-off-by: Ilya Leoshkevich Reviewed-by: Alexander Potapenko --- mm/kmsan/hooks.c | 15 ++++++++------- mm/kmsan/instrumentation.c | 4 ++-- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/mm/kmsan/hooks.c b/mm/kmsan/hooks.c index 26d86dfdc819..3ea50f09311f 100644 --- a/mm/kmsan/hooks.c +++ b/mm/kmsan/hooks.c @@ -303,7 +303,8 @@ void kmsan_handle_urb(const struct urb *urb, bool is_ou= t) if (is_out) kmsan_internal_check_memory(urb->transfer_buffer, urb->transfer_buffer_length, - /*user_addr*/ 0, REASON_SUBMIT_URB); + /*user_addr*/ NULL, + REASON_SUBMIT_URB); else kmsan_internal_unpoison_memory(urb->transfer_buffer, urb->transfer_buffer_length, @@ -316,14 +317,14 @@ static void kmsan_handle_dma_page(const void *addr, s= ize_t size, { switch (dir) { case DMA_BIDIRECTIONAL: - kmsan_internal_check_memory((void *)addr, size, /*user_addr*/ 0, - REASON_ANY); + kmsan_internal_check_memory((void *)addr, size, + /*user_addr*/ NULL, REASON_ANY); kmsan_internal_unpoison_memory((void *)addr, size, /*checked*/ false); break; case DMA_TO_DEVICE: - kmsan_internal_check_memory((void *)addr, size, /*user_addr*/ 0, - REASON_ANY); + kmsan_internal_check_memory((void *)addr, size, + /*user_addr*/ NULL, REASON_ANY); break; case DMA_FROM_DEVICE: kmsan_internal_unpoison_memory((void *)addr, size, @@ -418,8 +419,8 @@ void kmsan_check_memory(const void *addr, size_t size) { if (!kmsan_enabled) return; - return kmsan_internal_check_memory((void *)addr, size, /*user_addr*/ 0, - REASON_ANY); + return kmsan_internal_check_memory((void *)addr, size, + /*user_addr*/ NULL, REASON_ANY); } EXPORT_SYMBOL(kmsan_check_memory); =20 diff --git a/mm/kmsan/instrumentation.c b/mm/kmsan/instrumentation.c index 94b49fac9d8b..02a405e55d6c 100644 --- a/mm/kmsan/instrumentation.c +++ b/mm/kmsan/instrumentation.c @@ -315,8 +315,8 @@ void __msan_warning(u32 origin) if (!kmsan_enabled || kmsan_in_runtime()) return; kmsan_enter_runtime(); - kmsan_report(origin, /*address*/ 0, /*size*/ 0, - /*off_first*/ 0, /*off_last*/ 0, /*user_addr*/ 0, + kmsan_report(origin, /*address*/ NULL, /*size*/ 0, + /*off_first*/ 0, /*off_last*/ 0, /*user_addr*/ NULL, REASON_ANY); kmsan_leave_runtime(); } --=20 2.45.2