From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91101C433E0 for ; Tue, 30 Jun 2020 14:47:50 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5AFD120663 for ; Tue, 30 Jun 2020 14:47:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="fOv261Zn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5AFD120663 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=mudwvI7Zre8LFbJmd4ybyZdtLbN8GkS5sOKd1IcpAy0=; b=fOv261Zn7Xsj64yIFVFcxSvoe EL9/RLjQfAEAAb/5GBirnUUSP/KzW48yAPjtfNe6oxxBZJehyjvCIiWDLigyOD0zNKYCEvKb1M0Eu 8OHZrAzciDzhRyh3Vz1Sf2cdM16z0fRNldLXL2Q1nXktAhqybZmT0f6g/djbB7G4dqAlialmZ61iv cS+yK45hcpa+OZfcwlDvQ5q6Xb0q0RqX+3XHavsOmNOdbshPcKaStqILZjukMPBn0zTeenJVzT9a3 euYO7+JJIkL43hKn88jK550GhVqk+aYnlVH/FEVtVkneGV5W3sDrr+TRsYQHK/t0l0KmqPZHDjfIL xyxwK06pA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqHWT-0006D6-0C; Tue, 30 Jun 2020 14:46:09 +0000 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqHWQ-0006CP-Ow for linux-arm-kernel@lists.infradead.org; Tue, 30 Jun 2020 14:46:07 +0000 Received: from pps.filterd (m0187473.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 05UEXCca075212; Tue, 30 Jun 2020 10:45:49 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 31x1rvv7av-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 30 Jun 2020 10:45:47 -0400 Received: from m0187473.ppops.net (m0187473.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 05UEXRL3076948; Tue, 30 Jun 2020 10:45:45 -0400 Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 31x1rvv748-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 30 Jun 2020 10:45:45 -0400 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 05UEU11p022017; Tue, 30 Jun 2020 14:45:30 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma05fra.de.ibm.com with ESMTP id 31wwr89rve-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 30 Jun 2020 14:45:30 +0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 05UEjSA01114434 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 30 Jun 2020 14:45:28 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6006F42059; Tue, 30 Jun 2020 14:45:27 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 429B34203F; Tue, 30 Jun 2020 14:45:26 +0000 (GMT) Received: from linux.ibm.com (unknown [9.148.202.137]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Tue, 30 Jun 2020 14:45:26 +0000 (GMT) Date: Tue, 30 Jun 2020 17:45:24 +0300 From: Mike Rapoport To: Linus Walleij Subject: Re: [PATCH 4/5 v10] ARM: Initialize the mapping of KASan shadow memory Message-ID: <20200630144524.GB2500444@linux.ibm.com> References: <20200615090247.5218-1-linus.walleij@linaro.org> <20200615090247.5218-5-linus.walleij@linaro.org> <20200615143316.GA28849@linux.ibm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-06-30_06:2020-06-30, 2020-06-30 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 cotscore=-2147483648 lowpriorityscore=0 phishscore=0 spamscore=0 bulkscore=0 adultscore=0 mlxlogscore=999 suspectscore=1 clxscore=1015 malwarescore=0 mlxscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006300106 X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Florian Fainelli , Arnd Bergmann , Abbott Liu , Russell King , kasan-dev , Alexander Potapenko , Dmitry Vyukov , Andrey Ryabinin , Ard Biesheuvel , Linux ARM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Jun 30, 2020 at 03:22:19PM +0200, Linus Walleij wrote: > Hi Mike! > > First a BIG THANKS for your help! With the aid of your review comments > and the further comments from Russell I have really progressed with this > patch set the last few days. > > On Mon, Jun 15, 2020 at 4:33 PM Mike Rapoport wrote: > > > > -#define pud_populate(mm,pmd,pte) BUG() > > > - > > > +#ifndef CONFIG_KASAN > > > +#define pud_populate(mm, pmd, pte) BUG() > > > +#else > > > +#define pud_populate(mm, pmd, pte) do { } while (0) > > > > Hmm, is this really necessary? Regardless of CONFIG_KASAN pud_populate() > > should never be called for non-LPAE case... > > It is necessary because the generic KASan code in > mm/kasan/init.c unconditionally calls pud_populate() and act as > if pud's always exist and need to be populated. > > Possibly this means that pud_populate() should just be turned > into do { } while (0) as well (like other functions called unconditionally > from the VMM) but I'll leave this in for now. Yes, making pud_populate() a NOP will match the "generic" implementation in asm-generic/pgtable-nopmd.h. If this patchset will get to v12, maybe it would be worth doing that :) > > cpu_switch_mm(tmp_pgd_table, &init_mm); > > > > And, why do we need a context switch here at all? > > This is really just a way of reusing that function call to replace > the master page table pointer TTBR0 (Translation Table Base Register) > while setting up the shadow memory. Right, but is this really necessary to create the shadow page table? If I remember correctly, the mm parameter is anyway not used by ARM page table manpulators and pgd_offset_k() can be replaced by pgd_offset_pgd(tmp_pgd_table, ...). > Yours, > Linus Walleij -- Sincerely yours, Mike. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel