Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp6111898ybi; Wed, 29 May 2019 03:04:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqzd5xwElQ3UVE26G6IO4PY1jR37F4/VwbftBJJXPHGxnosqZoHy+0lJX8I5u5FkjJHv+dY8 X-Received: by 2002:a17:90a:c58b:: with SMTP id l11mr11111781pjt.56.1559124276893; Wed, 29 May 2019 03:04:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559124276; cv=none; d=google.com; s=arc-20160816; b=Kxdz4E9e5oUhdk8ypkdzDohQUB5GcAcQJcSsVqg/klAqyBBEmsi506RdlL2/dp5UV5 6ySjoGnszYDvNBa42/Nyk7fouwOSMszJd9/kxtFVRbsZd4NRxaQruM7is13Q4CYzikf+ pqDTKg7nxUWuOPdbyJryCBvqeM2HPeEixu4bf9AiGym7v1tEO3Gv0zecQ31dMdPrQIdW 0Pkq51tDLI7psZy8CC8dmKkKSAdCZHZC9PLQx4MY2wCHjkcC/jXYoCJGO35F2OhZJWbg Sqk8+NnGWbO2NuaJSSdxSYMcAPq1lTCFYavfURhOt/62DgQ09NXwb+cEu7En+KElQyrT TKUA== 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:dkim-signature; bh=kIMbddNkHXghmps6hNcFGND377pg1jMOBcSZ29+JswM=; b=qQa+PRgzKVd46dJ+nBgMa46X5OWbeF1opGPee6+dfJoOK53x2sz1nQnnR4l7DHs/PA 7vNwCLpJRjKPBF1ESPTdsB6NXkYE+4UsSoYnRzPlU6o5AAwMGMJ0ZMmO8IIYq+4asdq+ YxdbvuBN6eEjN/6OANJGud3CyLzvirrWJJ4y4pZ+suP3XPgDF3BCyBrZ8s9JXLKZBaWB QtrRHmC+TkF7z+8CDWImanB9uJ31aDUF4McifhYVHKnkdHz5VLReMM4saB7lTuvxRr/q +6fMSZsoiCphiwhdLVGz4x6HZ+kEk7xGHVz4Dao9TCBQuaSL2bWH0iheLB38ISZA5gMY a5uA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Yzc20FEH; 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 q19si24499183pgj.42.2019.05.29.03.04.18; Wed, 29 May 2019 03:04:36 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=Yzc20FEH; 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 S1726747AbfE2KB1 (ORCPT + 99 others); Wed, 29 May 2019 06:01:27 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:59998 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725861AbfE2KB0 (ORCPT ); Wed, 29 May 2019 06:01:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=kIMbddNkHXghmps6hNcFGND377pg1jMOBcSZ29+JswM=; b=Yzc20FEHVCPJ9ZORtOsdeVIlW qlK1rz6WIzxNj+u1eNT8uCq+HK9lz33KU6hE54Ijh3PH4XyYrRCrrWgDBZhCiqtKX/cjEVJNpkZ8g xwqWSm5zOVGtGn1f5KKdyc3K5p/X8oddDjfRE76L6GdactyMFDnu746NZL0FoZ3SOVm/I8glr0J8w G8NPLiNFloCnHwPpqfHtBvTc73E0/EsVWmOZ6ouDCi12I+gP89tW9WG8UG0ftOFx7/osie8YgFRu7 D2Kx2G6WxqTE+43HJ1ERg/RE3gRKJE/N5cu8Byl+vV01yomxmibTNt4ylwKBKoxH+qErh+4kEc7UP 0dDJ8EyeA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hVvOY-0003zL-7S; Wed, 29 May 2019 10:01:18 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id AB46C20729088; Wed, 29 May 2019 12:01:16 +0200 (CEST) Date: Wed, 29 May 2019 12:01:16 +0200 From: Peter Zijlstra To: Marco Elver Cc: Dmitry Vyukov , Mark Rutland , Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Jonathan Corbet , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , the arch/x86 maintainers , Arnd Bergmann , Josh Poimboeuf , "open list:DOCUMENTATION" , LKML , linux-arch , kasan-dev Subject: Re: [PATCH 3/3] asm-generic, x86: Add bitops instrumentation for KASAN Message-ID: <20190529100116.GM2623@hirez.programming.kicks-ass.net> References: <20190528163258.260144-1-elver@google.com> <20190528163258.260144-3-elver@google.com> <20190528165036.GC28492@lakrids.cambridge.arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 29, 2019 at 11:20:17AM +0200, Marco Elver wrote: > For the default, we decided to err on the conservative side for now, > since it seems that e.g. x86 operates only on the byte the bit is on. This is not correct, see for instance set_bit(): static __always_inline void set_bit(long nr, volatile unsigned long *addr) { if (IS_IMMEDIATE(nr)) { asm volatile(LOCK_PREFIX "orb %1,%0" : CONST_MASK_ADDR(nr, addr) : "iq" ((u8)CONST_MASK(nr)) : "memory"); } else { asm volatile(LOCK_PREFIX __ASM_SIZE(bts) " %1,%0" : : RLONG_ADDR(addr), "Ir" (nr) : "memory"); } } That results in: LOCK BTSQ nr, (addr) when @nr is not an immediate.