Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp409340ybg; Wed, 10 Jun 2020 04:07:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQCCNhMf/UPsuO42IXvkJ+1aOF0oMHEEVqeiza8H8S7DSITionIii0s0DEwBWnFHUXTSs8 X-Received: by 2002:a17:907:72ca:: with SMTP id du10mr2808933ejc.78.1591787250225; Wed, 10 Jun 2020 04:07:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591787250; cv=none; d=google.com; s=arc-20160816; b=C8UXjpufTZ1ZxYsa+47lR8PFUrlo335xdC9EG+17DbwVvvmA/2fJa7OqIG2Z5z4zV1 tAp0OdX3Y6J44KvKFNt2fTyMgZbe97r/cgO/nkjJiCv3Z+Nh54wDfwOFLPi8B0jmQ9zQ 0ADsS16ChsIkIK51WlX0y6nv2YbrFv1K/2jCj15JgPXXhEeo8JQMxyfyLyttfNhW1AD8 gCcZpYFRO5FcDTr9HLNuBOXEz7FZ92PwQkTyNpSqPmg0Ef70uLzcm5GWCwaKZt9lqjeb p6gnXNZOsB44EcUQ85CpqvNIWjq9eBJlNMTHicPZaKpLNxD8VZor9R2XJgsomuHZ42Pe tNwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=7rhDhb7XG1irEJ3s4PZgrsrHfWLraefC8nvpXB2M8Mc=; b=mP+KR7bp25DGhoaqVFi2opDgkg4z1u6EnRILV6Bc3UF2Mukvwle7JMy+xWhZyakVjK TcwX2tCGi7RrtXH2wLOMuxyzx6dv3L6BkMvPs1NJSHpMKiWrrMS4UPJu3pLDD3JB0dnb BWRW25akowCoRYkzVQEUawcTFmuXuD8ffc4OycNUnEleA5hRJeQeA3mTP0bhY0o+PGx8 EJ84wRX3ursOaP9Evw6kW/eZnV5H3dJSqL98Qcj35DMzWAhL4Jgr1jWtG6lkAIcCiv3v tPAS7EN10FpbhAnbhJHgKe5q+X1RtGNwTX5sbwVgTgD8RvQ4wOuljrm7JEof89xR93NF SHWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="CF/wuS5V"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c16si12514084ejx.310.2020.06.10.04.07.07; Wed, 10 Jun 2020 04:07:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="CF/wuS5V"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728353AbgFJLCV (ORCPT + 99 others); Wed, 10 Jun 2020 07:02:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728304AbgFJLCS (ORCPT ); Wed, 10 Jun 2020 07:02:18 -0400 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08F49C03E96B for ; Wed, 10 Jun 2020 04:02:18 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id u26so4378555wmn.1 for ; Wed, 10 Jun 2020 04:02:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7rhDhb7XG1irEJ3s4PZgrsrHfWLraefC8nvpXB2M8Mc=; b=CF/wuS5VIaKoRFRb1edURv8iEQYjyR3CNEeytRlAMvA21wqwMjjYcRQRDMcvSaZUt5 sIxLF4nAiFukzYUzqFoM9F0M6EEuJnIeUdTzfS0wbtKfeKBl+oMFBvPxFZSnGFuGTJLn SLTnN0OH3CuV5KXtb4twhKhkNGT2rkhLsQdYrg4ECSvDpDw3KYMeiCGxsBnH7TBD/r9B VzJkPzGsPN92P+dzDdnjqTGCgJtXDQyDWZZlbW01anZrpC2hZ6eMvX8D1mJRHzoVfodx i01NcDUjuR3gVvm8teMjg8uDLv1MVDoe2pkZwjgDi1Sx4EmzwBMadua3PgiovyaVXVdW VbvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=7rhDhb7XG1irEJ3s4PZgrsrHfWLraefC8nvpXB2M8Mc=; b=kJ+pnEzAr4hE/Bq0uYfNIFffYum64KfhgH/00yV62A6zix2e3c+2KzuGQIGJzLo9Ag moxJ9Qdy9ehR4kxygieCHMrIDkt2t6hvdfp5lp0q+bSzUIGZOBAAcXUCZOra/gdVfkdW wEHi3kU6AzZYpxFEclpAt2F01aocidP5IEBOXpb8mumZPXBfetV7BTJZOq5Yvxs4g8ND zm4UDUtEkgj7/nwG84oSf3zEnrgpu+AwdJMpEfg/LqnVa71OQC8NdCkyXXzyeqqjC80G hp54gJxbGHMnBe662RQgf6DHzDxk0Uc7BFUmeUD6a7HtmM8zzesuaawyQ0li4tRtkPZY H3uA== X-Gm-Message-State: AOAM531e9h2QSD5nx+XogTXw/b/7eVpLbrctKvyKWHC8qYQG25XOe8KF nFPH4bi50ux9tyPWzXOuihUFPVFWU9jeyFxhaclgQg== X-Received: by 2002:a1c:2082:: with SMTP id g124mr2706952wmg.21.1591786936358; Wed, 10 Jun 2020 04:02:16 -0700 (PDT) MIME-Version: 1.0 References: <20200610052154.5180-1-cai@lca.pw> In-Reply-To: From: Alexander Potapenko Date: Wed, 10 Jun 2020 13:02:04 +0200 Message-ID: Subject: Re: [PATCH] mm/page_alloc: silence a KASAN false positive To: Dmitry Vyukov Cc: Qian Cai , Andrew Morton , Christian Borntraeger , Kees Cook , kasan-dev , Linux-MM , linux-s390 , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 10, 2020 at 7:55 AM Dmitry Vyukov wrote: > > On Wed, Jun 10, 2020 at 7:22 AM Qian Cai wrote: > > > > kernel_init_free_pages() will use memset() on s390 to clear all pages > > from kmalloc_order() which will override KASAN redzones because a > > redzone was setup from the end of the allocation size to the end of the > > last page. Silence it by not reporting it there. An example of the > > report is, > > Interesting. The reason why we did not hit it on x86_64 is because > clear_page is implemented in asm (arch/x86/lib/clear_page_64.S) and > thus is not instrumented. Arm64 probably does the same. However, on > s390 clear_page is defined to memset. Can we define it to __memset() instead? __memset() is supposed to be ignored by KASAN, e.g. KASAN runtime uses it in the places where we don't care about bugs.