Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5481400imm; Tue, 18 Sep 2018 10:10:27 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdb1/vwbJe74svXGfkleoT+E1Ojb2uaDumNSBMIOW1/0BU1RlMkutO2P3KZeDEP3xIowxMhO X-Received: by 2002:a63:a319:: with SMTP id s25-v6mr27949649pge.199.1537290626979; Tue, 18 Sep 2018 10:10:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537290626; cv=none; d=google.com; s=arc-20160816; b=LErfkiKwXo70HotxSW/7maL8ZY9WRNEtJpGB0qP6IoPT+/3qj8cRTTBd6aTpgUNT5q eT5CWJuXO29lshDRZsikKjILoLvpZYA1oHn5qwqCvR1bZw/ASsFGoMc+S7IU7w697mk2 2NLdUlbevkGja1E4sLuTK6RxJ4CuzD5Qkpdq4sGN6rMUL8Ahu8E+UaYqeE//TYQsNOb2 /mg3C7Sq5FGh71734YdTzY+ojhLBuC6JuespSBPW3+BdfVtfLS4km3h/2qfsE9kcZnD+ biHArrWVx/o1fjLHIBYzZxe/+4Hf28LXYsXmp3IJCB/uo+5gX7xPHEb8EC0adT6g0YvV aV3g== 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 :references:in-reply-to:mime-version:dkim-signature; bh=pUKdOE3Y16h6545zaISUxKO9AusnuLo4zm5dn+P7adE=; b=WbCPR9IKpZmypFLTCfxSIjXZdNVU851e3zBdIcAvglgAj4HYnS8wQ72DIirFlg5aVk MNNTbXfhzYDZ3U/ySyB3Ag/7besPGClBoNCLBvf5MBvHkztYZOapubN2v5LiJYKPGEQK ChHzC5m8ujfL1lm2V2gTD+cfCefOerzL9QEpPnaMaaxreGFLKkOF2s4C4HQgFRL7za7N 6ZggQ8TeOyo+FK8DorDs97zPHjkGqTp/6t4kIPp/2aNSk6za1m4wTQrNk4HMzprd8shP bCLUVs6mi3PpgzVLZ/r8Rn86yNxmfTHli/OAfJ1Q8m5w5/sR+1i0lnYFPZwTnIfdFRQL 9vwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=C0uNsreN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id k6-v6si15786097pls.426.2018.09.18.10.10.11; Tue, 18 Sep 2018 10:10:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=C0uNsreN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1730262AbeIRWmy (ORCPT + 99 others); Tue, 18 Sep 2018 18:42:54 -0400 Received: from mail-it0-f68.google.com ([209.85.214.68]:50185 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730075AbeIRWmy (ORCPT ); Tue, 18 Sep 2018 18:42:54 -0400 Received: by mail-it0-f68.google.com with SMTP id j81-v6so4338180ite.0 for ; Tue, 18 Sep 2018 10:09:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=pUKdOE3Y16h6545zaISUxKO9AusnuLo4zm5dn+P7adE=; b=C0uNsreNAMljFxjNIys+dCasy4mqL6VgTLuydxYwxb066BXxAiZscXj+AFbzomIbsu m9bczDEEE07ZNmYj7GaHnzYEFZeeM6qeilHPnkzNq8KqMnNJNLHC0VzsfFmmjoQaECiE UtUk2GB0FyHFvKKYGwfqbJrEKZk9HqNH0Owbt3tqGua2TplKRrGSBwv7S5HSd+TeE8DR EjaiDgQiNvKyemuiH1P5sf7KPRWW+qqOTzgMBuofUd6yLZ3o43Hs8QWmsdIw1tkUa+J1 kmZ4gbgLZxW7JiBmONHre5OPejBQPX4GjwTrxaOvZW51atc7sjTMGP2dfPV7CoyjNzr2 JRSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=pUKdOE3Y16h6545zaISUxKO9AusnuLo4zm5dn+P7adE=; b=q994gbdgTigwPAZFxKo110cqNXYSnTzKbndNICTgAKSafZ679eVBjQ5AZ6GC28Nzr+ 6WyheAmhoAsc686PWA/ouMBq3dQy2cmHgBEg0gHH8ZnhRMqkCQkwsYwjo/scbw8DgaPe czBzbJRsaQy3ptfSNuczizbGnyJ2W8x9fYslZ1oi5kDZwTL/CzcqUUPT5Y0g2gggYYGG gAuPFHgSQCXiRFYybLrlrLdLIRvi7NlC5a1jMDi9JkN+ErQ19sSs+4/eAb9LjdoBiDUZ ix6duRX3rgHWAtKwNXLhk2TUxj+UFMk1eTSCr9iIPU/16s0bdylOdu3FQ41y49BE5a/n Gffg== X-Gm-Message-State: APzg51CrVhCzUp2KlzVB5+bkU9rdJVc1+kpqpAO4Od4TGZh3ElEnai3K TAKNNSD6mxdY2kXDRd7MvP+87K65ytZ6lyo3am547A== X-Received: by 2002:a02:9962:: with SMTP id d31-v6mr28144620jak.1.1537290562857; Tue, 18 Sep 2018 10:09:22 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a02:c54e:0:0:0:0:0 with HTTP; Tue, 18 Sep 2018 10:09:22 -0700 (PDT) In-Reply-To: References: <19d757c2cafc277f0143a8ac34e179061f3487f5.1535462971.git.andreyknvl@google.com> From: Andrey Konovalov Date: Tue, 18 Sep 2018 19:09:22 +0200 Message-ID: Subject: Re: [PATCH v6 06/18] khwasan, arm64: untag virt address in __kimg_to_phys and _virt_addr_is_linear To: Dmitry Vyukov Cc: Andrey Ryabinin , Alexander Potapenko , Catalin Marinas , Will Deacon , Christoph Lameter , Andrew Morton , Mark Rutland , Nick Desaulniers , Marc Zyngier , Dave Martin , Ard Biesheuvel , "Eric W . Biederman" , Ingo Molnar , Paul Lawrence , Geert Uytterhoeven , Arnd Bergmann , "Kirill A . Shutemov" , Greg Kroah-Hartman , Kate Stewart , Mike Rapoport , kasan-dev , "open list:DOCUMENTATION" , LKML , Linux ARM , linux-sparse@vger.kernel.org, Linux-MM , "open list:KERNEL BUILD + fi..." , Kostya Serebryany , Evgeniy Stepanov , Lee Smith , Ramana Radhakrishnan , Jacob Bramley , Ruben Ayrapetyan , Jann Horn , Mark Brand , Chintan Pandya , Vishwath Mohan 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, Sep 12, 2018 at 6:33 PM, Dmitry Vyukov wrote: > On Wed, Aug 29, 2018 at 1:35 PM, Andrey Konovalov wrote: >> +#ifdef CONFIG_KASAN_HW >> +#define KASAN_TAG_SHIFTED(tag) ((unsigned long)(tag) << 56) >> +#define KASAN_SET_TAG(addr, tag) (((addr) & ~KASAN_TAG_SHIFTED(0xff)) | \ >> + KASAN_TAG_SHIFTED(tag)) >> +#define KASAN_RESET_TAG(addr) KASAN_SET_TAG(addr, 0xff) >> +#endif >> + > > > Wouldn't it be better to > #define KASAN_RESET_TAG(addr) addr > when CONFIG_KASAN_HW is not enabled, and then not duplicate the macros > below? That's what we do in kasan.h for all hooks. > I see that a subsequent patch duplicates yet another macro in this > file. While we could use: > > #define __kimg_to_phys(addr) (KASAN_RESET_TAG(addr) - kimage_voffset) > > with and without kasan. Duplicating them increases risk that somebody > will change only the non-kasan version but forget kasan version. Will do in v7.