From patchwork Fri Oct 6 15:18:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: andrey.konovalov@linux.dev X-Patchwork-Id: 13411685 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A911E81E05 for ; Fri, 6 Oct 2023 15:19:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 170D88D00C7; Fri, 6 Oct 2023 11:18:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 024BD8D00CB; Fri, 6 Oct 2023 11:18:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D6B348D00C7; Fri, 6 Oct 2023 11:18:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id C5DF18D00C9 for ; Fri, 6 Oct 2023 11:18:54 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 93F161C9CBC for ; Fri, 6 Oct 2023 15:18:54 +0000 (UTC) X-FDA: 81315394188.22.71EDFC7 Received: from out-204.mta0.migadu.com (out-204.mta0.migadu.com [91.218.175.204]) by imf10.hostedemail.com (Postfix) with ESMTP id C4A88C001A for ; Fri, 6 Oct 2023 15:18:52 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=vlDt89zq; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf10.hostedemail.com: domain of andrey.konovalov@linux.dev designates 91.218.175.204 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1696605532; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=d2bfkEo5JYZuK7Cv8VAKlPll7M52jynkOgAjxxr9P8w=; b=RODapNuFS1l1t78O8wCGvzknl5DOAMOs/y0ljr9p3pwP1pZYxYeD4o25ncClL+lFtub+5Q XDEbHk7CiGkzTYpi7YW5GHvzLFeN2uEugy3Hp9bMK1mS18C7vyVr54GkHmawAZufTh4hfb gZIvuxoRy7Uz2hxQuGcWz6QReX3ISxA= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=vlDt89zq; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf10.hostedemail.com: domain of andrey.konovalov@linux.dev designates 91.218.175.204 as permitted sender) smtp.mailfrom=andrey.konovalov@linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1696605532; a=rsa-sha256; cv=none; b=pvujgnERG2OHvXBRKKyjqh3micXjy1O/NcsXpzE5wyKXkKbWeMRccUvwJdWVMUim8FlqTB ZS26VBC3rIuR3X6z8liGjiD92wUobN6R6LkcSPTMNU1Ado+bHuyc+8Nw+eu3jQWaXMk+x1 OZ17MzT0/Hfy1O0k1Pcx7qtpjnBVcWQ= 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=1696605531; 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=d2bfkEo5JYZuK7Cv8VAKlPll7M52jynkOgAjxxr9P8w=; b=vlDt89zqqnculRELuSeD9jLjZvKkTm/HiU3ElzO3T+fxatuKvM2A4E2SdhRUNGBH2xbgro 3wvtsb368B03sIGwZKqVO5PGL8PxfVJNm+p51ld6CPnb10yOlBCdGxfsf4fknSSnhps7S3 EcII2j00X56lu2ZTTlQlFbk3V+F7v2Y= From: andrey.konovalov@linux.dev To: Marco Elver , Alexander Potapenko Cc: Andrey Konovalov , Dmitry Vyukov , Andrey Ryabinin , kasan-dev@googlegroups.com, Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Subject: [PATCH 3/5] kasan: use unchecked __memset internally Date: Fri, 6 Oct 2023 17:18:44 +0200 Message-Id: <6f621966c6f52241b5aaa7220c348be90c075371.1696605143.git.andreyknvl@google.com> In-Reply-To: References: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Rspamd-Queue-Id: C4A88C001A X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: jpwg1knyjm5jeuu8rk5b4udnm3amwdro X-HE-Tag: 1696605532-856839 X-HE-Meta: U2FsdGVkX19/ZnHDKN4xE0oekWEPNkTCc5k57nB4HlEbtFuXbzsxAf3dMT8ow6PWZFsiBTt5P0FP5PtmhU8T3BBAW105AYi3htrER0LSzhzTsdCCAU/d4HUz5z0SZrU5lsRbkadzmAY+RIN4gLw7lK2bPuorXU5oosDeGKvveiqlqyhmvryFlQiV9NqEDXZ0suNovf+gTEwmFVA0fCMvnDifRMR+178hKilhje0OUuVeFtooI7LKAk5Z0hAKgL0n1yByI/4M1RFZyq483pf2eXmHs+c6YiyzYItwtfbrc+u8qiZzjzHm2oOUjMnjXnz6zy/ALfZAA/YJB/2Ndxk5V/6ag0bmOmWb+PwkVKJj/1BLDdOGr17eeJE6JhsAkPPUGi4rTg9YellYlqKFyAvRZFRjke29bq3UwRoNieEmsxD8sh5ADcLvR4UuAXVdsESmwihf4uvtvUZnPvHIp2XOKBwHQLn7XPstN3wo7tRSutbcN+MKv0mzFuNu833Z3qdQFnld3YxclYAvfpPsIhddlT8U2NEqdHbPiLoFhxMl4MzEZYCdPcTbVO+qnyfzila79OgwlA6k2H/2qyFcQ0R/hoeI6H+kS3YX560EXQhFv3ybQ4smYGRLe15fxagngd5uG4lyOA5tandHmMVeRzdTyOs898Ys4fEfQembEj65+lx81N4/U3hAJ78waAHFEyMDaWFCEXtx7LymdkpsbBS90OMYaw/6863yuZ5WhnZQykWi0x3/zVNhlL+/5tXop6/Lsgx+oRn5ET0IyZifhiyBSPjjKI/Ez5Qa/oe5+Nb4+lStxdwSaQZgTgY3HdEIkVrQIXQEbNHii9J6xXsYVIfh6GINbzN3QBasBGa/C1gyqu3GsCw8sb5CGeTaPhQ1Bx0w+1BxdvFewMG6EEjsn5WbBQGeBsOW6e/59EF4PAA0WNf9oCehRPtABETL3fxG2QwGD9AJUNW2exRvnOcxL1+ 08DkfpJJ vlurHyxE4gkbco5UOMLre8HxS1I3jtn/+a2TRBYceZjVuZ4/VLusP2O6cvq3dsd2vNjZj/RM59R32ZGeD14OBkmhAtb3Co+GTD9e1NX5hN6oqXdq18hkC0otviK3PA4aTb1N3yZh94A1zzlAWujfuJFJtAjXOleXwdlGdscy5jFsXRQkokjQMrHmzmaRQ03SdE+VuzhJKVaE6VfLqkfGo8YXQ7g== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Andrey Konovalov KASAN code is supposed to use the unchecked __memset implementation when accessing its metadata. Change uses of memset to __memset in mm/kasan/. Signed-off-by: Andrey Konovalov Reviewed-by: Marco Elver --- mm/kasan/report.c | 4 ++-- mm/kasan/shadow.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/kasan/report.c b/mm/kasan/report.c index ca4b6ff080a6..12557ffee90b 100644 --- a/mm/kasan/report.c +++ b/mm/kasan/report.c @@ -538,7 +538,7 @@ void kasan_report_invalid_free(void *ptr, unsigned long ip, enum kasan_report_ty start_report(&flags, true); - memset(&info, 0, sizeof(info)); + __memset(&info, 0, sizeof(info)); info.type = type; info.access_addr = ptr; info.access_size = 0; @@ -576,7 +576,7 @@ bool kasan_report(const void *addr, size_t size, bool is_write, start_report(&irq_flags, true); - memset(&info, 0, sizeof(info)); + __memset(&info, 0, sizeof(info)); info.type = KASAN_REPORT_ACCESS; info.access_addr = addr; info.access_size = size; diff --git a/mm/kasan/shadow.c b/mm/kasan/shadow.c index dd772f9d0f08..d687f09a7ae3 100644 --- a/mm/kasan/shadow.c +++ b/mm/kasan/shadow.c @@ -324,7 +324,7 @@ static int kasan_populate_vmalloc_pte(pte_t *ptep, unsigned long addr, if (!page) return -ENOMEM; - memset((void *)page, KASAN_VMALLOC_INVALID, PAGE_SIZE); + __memset((void *)page, KASAN_VMALLOC_INVALID, PAGE_SIZE); pte = pfn_pte(PFN_DOWN(__pa(page)), PAGE_KERNEL); spin_lock(&init_mm.page_table_lock);