Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp455135rdb; Fri, 6 Oct 2023 08:19:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHp66e80wvKnf/PQpS7l1afJFQSXzJcpKr22W9O29b3LfNbS7t6CcPKLuwakeq9hj2kiGo0 X-Received: by 2002:a05:6a20:a110:b0:161:3013:b499 with SMTP id q16-20020a056a20a11000b001613013b499mr9995670pzk.60.1696605552504; Fri, 06 Oct 2023 08:19:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696605552; cv=none; d=google.com; s=arc-20160816; b=RWGXfpcoJ8/cU2/XheUKL/tnw9fCwL5i3YUSS1lW/GJe3nyWK2jXqZv7H8A2f0darp 3tOqbnkYUZnKFrQ93iBxVqpLRqCAZURUUDUZTQEs2CTVvx7MUzBmWJqDdRqsviBoAJwS spe95bX4JpFwfMIdm2xOredmmoeNwZPuKgPUQca9lYgYzwc8VDqUn/5O/JJ1gmVULmcr XEdE7GfsRhM4H/gdOj70mcXRmeG5sxOAFjx4ExfX/8B4Vbj2mRf/voAv1wPjHGGKy/YK diGkKXvGNpBXybXhAV3IZsYeTsJcED9OTNk9MmQHtePg4ay1DfaVObKM/71Axn/mkZJv CSJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=d2bfkEo5JYZuK7Cv8VAKlPll7M52jynkOgAjxxr9P8w=; fh=MvduW7TtfFJGfZiC/W6aaLQjI7EqApwiKAwimfBfFME=; b=Bygr/LaZDuNq3aKnHkuuj+m+imdS8DpshKWMURhsk88VmR7RgF3ittZ/iKwgBTPyNx eUu/zCBqSvMbsiRdLC7NMaRehaaprVeKYNGeTSje027jFxpkpbz8jvBsTZs0c8IzVSRs ZVnB/g3D5EWcnHJZg0vDMvOyuzxncAx4HwBndUtiTkF5zANfJv8bM5rvI9q1ze8AxLa0 JkzDGdDD0evYW6MTU1gwS4p07zKiQ9zibIlDZQbIPDPg5oxCwFz6JsgzNoHhowondJuJ fMwsA+h7AWP0mtru7NJBw+0/X3GoJimL9iLnV+wrWQJ8urXUWCyOqBFBfCNOn4FAU0YB LWfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=vlDt89zq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id q12-20020a635c0c000000b00563d9ff5158si3786301pgb.350.2023.10.06.08.19.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 08:19:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=vlDt89zq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 86A6380294C3; Fri, 6 Oct 2023 08:19:11 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232832AbjJFPTB (ORCPT + 99 others); Fri, 6 Oct 2023 11:19:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232833AbjJFPS5 (ORCPT ); Fri, 6 Oct 2023 11:18:57 -0400 Received: from out-204.mta0.migadu.com (out-204.mta0.migadu.com [91.218.175.204]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E51E5EB for ; Fri, 6 Oct 2023 08:18:55 -0700 (PDT) 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 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Fri, 06 Oct 2023 08:19:11 -0700 (PDT) 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 --- 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