Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp962223pxu; Fri, 23 Oct 2020 18:49:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz13jnVrkkKWYpZIQWgrPafMgXEE9OBy0zs6LcL8YutKV7jHEyJEbuiP1/HQAQgQQgTDpQm X-Received: by 2002:a17:906:bb14:: with SMTP id jz20mr4919689ejb.424.1603504142453; Fri, 23 Oct 2020 18:49:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603504142; cv=none; d=google.com; s=arc-20160816; b=g1Poui/kBxg3qCh8i45n1ptoOKMUG9xaqRIqfRBMagB+GFfFus1nEyabX+IW/nX3jh ymyPn1moNfDhvEiO/NHG2A3QFBzMTbuC/q5Db/p1AaMaQYG0ehB0QrzgoaX0lMOyfnFc IuwVE7hFeuSvnLnU/Ceo4euKJiXJrkbmKrXf+oreLYOANKdewue9aOT7Wx0b8vfT31fm ZPLO5m+MFt4aM9SCsdCgV1oevkTF6bDDlusRhX1u7z0xEckIieF6EtkAU2/tVsNM3tRU vRu+C30dQB5g5+5Of9HwjVSK5hkcUM5x49Y83qqPG558br7y7JPyiWv/6Q/7su/Rzl3Z uvBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:from:cc:to:subject :content-transfer-encoding:mime-version:references:in-reply-to :user-agent:date:dkim-signature:dkim-filter; bh=xs7I8/gVse4gEGgN1UPUZ5pidIDY93X/cDXaJPe3IHI=; b=VBLhIWJWn4PqFSLQP0k2r0LxoFOHnjVX1N8laI85/JSDg+QA43TG+SAAPU8d/rudwn nwcsYz7Jn3vfzDMyFRvF4C5UkvFjXWneSWlLyG9YbAfJAFmRd19j64ttA+Ag4mWF3/4T lMr7mnYV+hKE3SQ96/PzfoozQvixV06B0+E58DT0f89yKyVyWYDMS/4zvL2zOFuSi/oh sRacO4uFkXsQxQn8hG97EwctZHTiCTAWc2UKqOdbBw5KsVtjn3LWZS7Q/569nYOISo2Y jQl3QBAhqqy1ql2nj9TZ6FjQJSPpxcyvVeoB/SoW0UYJJgfspQ5aJOCevNle414EYUyP Mcxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@zytor.com header.s=2020092401 header.b=fEyUymfL; 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=fail (p=NONE sp=NONE dis=NONE) header.from=zytor.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q16si36485edt.287.2020.10.23.18.48.40; Fri, 23 Oct 2020 18:49:02 -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=fail header.i=@zytor.com header.s=2020092401 header.b=fEyUymfL; 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=fail (p=NONE sp=NONE dis=NONE) header.from=zytor.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758773AbgJWXkI (ORCPT + 99 others); Fri, 23 Oct 2020 19:40:08 -0400 Received: from terminus.zytor.com ([198.137.202.136]:52977 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758769AbgJWXkI (ORCPT ); Fri, 23 Oct 2020 19:40:08 -0400 Received: from wld181.hos.anvin.org (c-24-6-168-49.hsd1.ca.comcast.net [24.6.168.49]) (authenticated bits=0) by mail.zytor.com (8.15.2/8.15.2) with ESMTPSA id 09NNdmko4027135 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Fri, 23 Oct 2020 16:39:49 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 09NNdmko4027135 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2020092401; t=1603496390; bh=xs7I8/gVse4gEGgN1UPUZ5pidIDY93X/cDXaJPe3IHI=; h=Date:In-Reply-To:References:Subject:To:CC:From:From; b=fEyUymfLPdEmDFJqxGGHZXooSsKNiRyv4V5jNNRdk5L0faMhyx04NG6dyaP4PqFOk HO/YrJ7CRZt+FASviYZQl7o4X4VfsL9RQLpXY47nvQ0Y7xEMRugkFkZGW1zXPxC/7x s9gNYnPwG4OxvvqwVG6tleFp6r0XpJm18zROHN0tc/EXqm4AfkfZgsBqqljX9TXxC/ RNff/je/pwsxsR3QPq1i0AYSHkfhCBUZCpObx7QW9n9Xxy5QdYeevc1+2+gtcX22fZ QU0nFMs9qT+f78tYctJdPmWGDAaS3VphOvAZg4mDa+ADH1JJc8hVkMD3BmjsREDojM XM8ib9rSxAH0Q== Date: Fri, 23 Oct 2020 16:39:46 -0700 User-Agent: K-9 Mail for Android In-Reply-To: References: <20201023203154.27335-1-linux@rasmusvillemoes.dk> <8820745F-E761-42E6-8A70-7B04EE70692C@zytor.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: RE: [PATCH] x86/uaccess: fix code generation in put_user() To: David Laight , "'Linus Torvalds'" CC: Rasmus Villemoes , Thomas Gleixner , Ingo Molnar , Borislav Petkov , the arch/x86 maintainers , Sean Christopherson , Naresh Kamboju , Linux Kernel Mailing List From: hpa@zytor.com Message-ID: <3F1D3946-E7B8-4F77-9189-D49E1ECE0B0D@zytor.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On October 23, 2020 2:52:16 PM PDT, David Laight wrote: >From: Linus Torvalds >> Sent: 23 October 2020 22:11 >>=20 >> On Fri, Oct 23, 2020 at 2:00 PM wrote: >> > >> > There is no same reason to mess around with hacks when we are >talking about dx:ax, though=2E >>=20 >> Sure there is=2E >>=20 >> "A" doesn't actually mean %edx:%eax like you seem to think=2E >>=20 >> It actually means %eax OR %edx, and then if given a 64-bit value, it >> will use the combination (with %edx being the high bits)=2E >>=20 >> So using "A" unconditionally doesn't work - it gives random behavior >> for 32-bit (or smaller) types=2E >>=20 >> Or you'd have to cast the value to always be 64-bit, and have the >> extra code generation=2E >>=20 >> IOW, an unconditional "A" is wrong=2E >>=20 >> And the alternative is to just duplicate things, and go back to the >> explicit size testing, but honestly, I really think that's much worse >> than relying on a documented feature of "register asm()" that gcc >> _documents_ is for this kind of inline asm use=2E > >Could do_put_user() do an initial check for 64 bit >then expand a different #define that contains the actual >code passing either "a" or "A" for the constriant=2E > >Apart from another level of indirection nothing is duplicated=2E > > David > >- >Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, >MK1 1PT, UK >Registration No: 1397386 (Wales) Maybe #define ASM_AX64 or some such=2E --=20 Sent from my Android device with K-9 Mail=2E Please excuse my brevity=2E