Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp797350imm; Fri, 29 Jun 2018 06:36:24 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdzTa5a1TszkTXeglD9ErJA6lt+IAQSynsg6/6a/F8b5ZpZ/MbvNjtQbVQWXw1sOfFnB5cR X-Received: by 2002:aa7:820e:: with SMTP id k14-v6mr14540083pfi.97.1530279384638; Fri, 29 Jun 2018 06:36:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530279384; cv=none; d=google.com; s=arc-20160816; b=sv5FCjFezG79FXa039RrAvkORQkNk5C8ukNxVfDhCzwR1Lgt/LAkjzBOmvtWX3y9GF EDPfWpTOsMeMjz5FQHzl/t3KO+DtSmDKmRrYyddKjGG0VVtA4MFyVhaElWXtNq2GbnPR 6+ge6CdEQop7VMakbXqRmXO95bm0jLhwir/vNaMh9RfPHzUbFUy0J99qkHPHcyX6sIND F/LVgICTGLMF7lbQk4i1ouwZmYE+LakX8ugF2496U/d8iDf287BS2/ysU6h7BuKZqmoE MWCeh73eFpFuQqtn3B8dWqyV7VKqcizDGZ5QRXP5MNwrGCUXhzDomyUHZAq5mz1HB1c3 uLgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=alv/rIHdRbxWU9knBxVPTbmzDs5YL/AU4ktilIL9RWI=; b=rGX6eV8ebeg25kUK1nlzCLE28KyyL02VVeP79Tv08FjOr4huVfZhXiVpsvclqM9leE Ed0CkKscjPX7QewO1Jyou43GA0a9gWNQyFixDCpZxi7zxCCIHw2zpqikWPB5/8YuOupB KnIrU1sTV2EezU2CVY6ZnJTFi6ZpjO7V1EPm3GxVsyk8wpa9hp2B72vhJp/eWxYDpDVO ZFNJs9HLd3sWoQFTp8jLDBQ1hY7tMPElX7Ia8F4VtSNMLjGH9Orz58Zj9yKNUjLMO+yW n1teXViIkXMt+3ky/SBhn4LERuTDY/vtinFECwU4Php8qamYiomsDT/H5KmgF8FPXzb+ 1zTQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e190-v6si5850709pfa.355.2018.06.29.06.36.09; Fri, 29 Jun 2018 06:36:24 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755128AbeF2LGf (ORCPT + 99 others); Fri, 29 Jun 2018 07:06:35 -0400 Received: from foss.arm.com ([217.140.101.70]:59778 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751114AbeF2LGc (ORCPT ); Fri, 29 Jun 2018 07:06:32 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 7324B18A; Fri, 29 Jun 2018 04:06:32 -0700 (PDT) Received: from edgewater-inn.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 424F53F266; Fri, 29 Jun 2018 04:06:32 -0700 (PDT) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id A267F1AE540D; Fri, 29 Jun 2018 12:07:10 +0100 (BST) Date: Fri, 29 Jun 2018 12:07:10 +0100 From: Will Deacon To: Andrey Konovalov Cc: Dave Martin , Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Catalin Marinas , Christoph Lameter , Andrew Morton , Mark Rutland , Nick Desaulniers , Marc Zyngier , 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 , linux-doc@vger.kernel.org, LKML , Linux ARM , linux-sparse@vger.kernel.org, Linux Memory Management List , Linux Kbuild mailing list , Chintan Pandya , Jacob Bramley , Jann Horn , Ruben Ayrapetyan , Lee Smith , Kostya Serebryany , Mark Brand , Ramana Radhakrishnan , Evgeniy Stepanov Subject: Re: [PATCH v4 00/17] khwasan: kernel hardware assisted address sanitizer Message-ID: <20180629110709.GA17859@arm.com> References: <20180628105057.GA26019@e103592.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 28, 2018 at 08:56:41PM +0200, Andrey Konovalov wrote: > On Thu, Jun 28, 2018 at 12:51 PM, Dave Martin wrote: > > On Tue, Jun 26, 2018 at 03:15:10PM +0200, Andrey Konovalov wrote: > >> 1. By using the Top Byte Ignore arm64 CPU feature, we can store pointer > >> tags in the top byte of each kernel pointer. > > > > [...] > > > > This is a change from the current situation, so the kernel may be > > making implicit assumptions about the top byte of kernel addresses. > > > > Randomising the top bits may cause things like address conversions and > > pointer arithmetic to break. > > > > For example, (q - p) will not produce the expected result if q and p > > have different tags. > > If q and p have different tags, that means they come from different > allocations. I don't think it would make sense to calculate pointer > difference in this case. It might not seen sensible, but we could still be relying on this in the kernel and so this change would introduce a regression. I think we need a way to identify such pointer usage before these patches can seriously be considered for mainline inclusion. For example use of '>' and '<' to compare pointers in an rbtree could be affected by the introduction of tags. Will