Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp1759847rdb; Mon, 9 Oct 2023 01:46:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IENFLzE+MnP0o5fAHsIyFuv8k7EY0hMBjyM1iivdzHHs3MmYfBKYnWQg5prF6r6gBtPlQc3 X-Received: by 2002:a17:90a:e611:b0:26f:6f2a:a11 with SMTP id j17-20020a17090ae61100b0026f6f2a0a11mr18883754pjy.12.1696841206883; Mon, 09 Oct 2023 01:46:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696841206; cv=none; d=google.com; s=arc-20160816; b=iWdyvPwxhQH0kGCMbXvMXUs/6G8Vdl2CUDUxyUZhtlH+oEKX0pOtJhbWxGEh7JVtOD V4zq0pS+Sy0U4xUpfRLPJUi2k1tmLupJ9M2et8a0tx+gL+gmR+KCmWqtubaZLXZ4uVN+ 3PJCMafhYL/njD99aSHw88BHHyfZ33Z2g4lAiU6K+ptexBt4Yn/p1/7fD+8g7b6G2uSw Z2t1VH+TqcrOE1kLtkUnwftJJ2OD5GYHaKaJIzR5n9RwWzMwfma47vZ1cAVDQDjAr4u6 T0GM0sePnpLu8xMEPK4pcnjNXTBt1+ps+KDYUIPrmqySkPUm9Y/SdRReCPoNQny4mSW8 QUtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=z2RpbvMTdKoZ2zJiAZ7Z5I3rvjdlk66rFfj4n9j6rj0=; fh=PAMwWFIyYDX+NdZBJdEl/NRibBpELs9BvAUsR3hyWOM=; b=QJUxcD7v5oyEEcF4YPHpwMBVoXfwEBLOXM4AybyiEAkgC4uSee+91WrKssNLljGMgn VINJdPW/nBnU/nykc7uUzo42SEFxj6bSAnu/wzPzgGChxJb2LyYE1FaAy8gzW5qNT58A 8vfrxI6bd6vBe4NaXQ8ggH/ItuzK7OZxYBuT0fUQ/vXWso4K2Q1yHM7q9vCPsYge81EP 7IWDMp/QE6gQvzTawtC6M4pfvTJvFUSf7AZ6Rl1zWbXlA7GIG3AZNa6MqOAAllhB0qeC 5HDZ8sbGWSHMF/opUypYhMXejAqusfjZaxZdSQ9S2FFzK0dJKKEDPmxqGqjqRv7hCHfS xjIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=yPf7GajX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id pc6-20020a17090b3b8600b00278f58e6bbcsi12172059pjb.181.2023.10.09.01.46.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 01:46:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=yPf7GajX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id C4471802138E; Mon, 9 Oct 2023 01:46:44 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345503AbjJIIqX (ORCPT + 99 others); Mon, 9 Oct 2023 04:46:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345520AbjJIIqT (ORCPT ); Mon, 9 Oct 2023 04:46:19 -0400 Received: from mail-ua1-x92d.google.com (mail-ua1-x92d.google.com [IPv6:2607:f8b0:4864:20::92d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B288D10B for ; Mon, 9 Oct 2023 01:46:17 -0700 (PDT) Received: by mail-ua1-x92d.google.com with SMTP id a1e0cc1a2514c-7b07719089aso2815741241.0 for ; Mon, 09 Oct 2023 01:46:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1696841176; x=1697445976; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=z2RpbvMTdKoZ2zJiAZ7Z5I3rvjdlk66rFfj4n9j6rj0=; b=yPf7GajXw5eWqO+Vv0bkQbvHayGDGg1WKvif8A1srRedjaInPe3G10YcV3cd1xt206 DRRm+Fbh08s3kMnzo7y1mgDkmJuKTnKckRy4UL8Ml+/Wgv2Xz43cfISW5uWqlEwCQbCl gPAa4tG9fbLUNS0JI7FheTguZiZati6DTG/Zf5vZpPTMQQCQTGgDiCntaSfWJ7oM+0jj 3IBHmlvXk5MBwe0pzTroNvIEfecb2PS8c/kBWYHPoYnhfNuDEs0Q/WqnIEAT97ALYX2J sLJNm2OzL5daQkSTdf9fT0t6VmwcuBh4QFu0mGkLi0u1g6lduQJIdUBvNn+SPeihSZVv ot5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696841176; x=1697445976; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=z2RpbvMTdKoZ2zJiAZ7Z5I3rvjdlk66rFfj4n9j6rj0=; b=xAYvJD2vGJTiUjchlozYDRfoSM5uHgemvJsFVm/TCZpwEl/WVcS0xmqVxKaeknIjjv amtcM8rOQthr3qTfn9PNS+zBh2qXi8bVvWv9BXbxl65audZfkXBob+XeGsRjYn3rPZ6N vBUO6lHSORfBEhv9mtAsJuGAud+XIuUErXRMOBaWsBBLEagtGTkIgn0DwhZZD4el3BcY v8uFBv+0zAskcUGMeMLhMW99OmiDI+qVJWJURqPpP40YWKFZD/OaFPkFncmx8DxXztFD SxtP1ytHznzOb40HU+bGZsKAozeE47f/0xuIBcWlItOB6APKaDXw5fxl/mMGDZyvwiSa sf6A== X-Gm-Message-State: AOJu0Yxi5ZqQ3MdML0hvEWw67KE3t27tFgiyUmIOvLpmdh7Jj5sFHyey XJU8WYptLFYT4FGa0jghWnjQ2BUGtCo1Faj8SdvOlw== X-Received: by 2002:a1f:6d44:0:b0:494:63f7:4e7f with SMTP id i65-20020a1f6d44000000b0049463f74e7fmr6815444vkc.2.1696841176576; Mon, 09 Oct 2023 01:46:16 -0700 (PDT) MIME-Version: 1.0 References: <6f621966c6f52241b5aaa7220c348be90c075371.1696605143.git.andreyknvl@google.com> In-Reply-To: <6f621966c6f52241b5aaa7220c348be90c075371.1696605143.git.andreyknvl@google.com> From: Marco Elver Date: Mon, 9 Oct 2023 10:45:40 +0200 Message-ID: Subject: Re: [PATCH 3/5] kasan: use unchecked __memset internally To: andrey.konovalov@linux.dev Cc: Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Andrey Ryabinin , kasan-dev@googlegroups.com, Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrey Konovalov Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-4.8 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email 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 (morse.vger.email [0.0.0.0]); Mon, 09 Oct 2023 01:46:44 -0700 (PDT) On Fri, 6 Oct 2023 at 17:18, wrote: > > 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 Do we need a "Fixes" tag? 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); > -- > 2.25.1 >