Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2621194ybt; Fri, 3 Jul 2020 14:06:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwtp6DpChuGu0x5O5rydaIpiycmkn0xVX1vnfOU07yzXGDOgfV2poCEPKunnsXHtlb6uQsX X-Received: by 2002:a17:906:4f09:: with SMTP id t9mr33472139eju.110.1593810392159; Fri, 03 Jul 2020 14:06:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593810392; cv=none; d=google.com; s=arc-20160816; b=zs9zguG63p+9jAwENbFRLdpx5QYsreCJk5JbBcL3QrTXX48B0fefuF6Ab+Yt9Aut4M hkN/tdVDEDkIyGvjNSb3NN3MP1cEE5oIjw0RPfdjGDY5WHXxvob/FeIyGpvwAMiTLe3+ jED28uet6KOPPmrmtOnEp330uOpC6n6Mbp/9aVCZXO24plE1an6nBPsCkxMGy2/OdXEy SIkdfhdM5KtDXxYDjmYd9HUtMFO5bMdYjiQIzzpcYqWvpf0QDDCTyrvVq/BJpr5TUnEz PeWXlBHZqM5hHWX6U1Tsxh18evLHsjHoj1IfoVx/Ke5q+ML0Tr7ZncCg5JfpvTf1qy5m YJ6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=NAvTiU+23qawkt6hY42eGwYBB49tJHjX8fas5ayYb6o=; b=WrRTsLgvpan7WMr1ghuG982Y2RpanqvpIUwz63vXmEJpiFBml+0cJlht0ntNzQzl6k W+xpbKwSuXbHGGdb2y3Ln/6HYPIVMdazYzTy+BSDVV4WLbaUOmiV/BXGg/YqSP3u47TS iH2OSKvaKljL1UyAdAh/Cg6wxAk2ykMXi2cjPITAUns/pASKjXFPB2O6KbpgsjsKi26s D7IZghyNTpXKOrSDTb/u2mxDh84SDNLy6npQvkVfZXHOi/tJxPjDbZ9Af7rUTpu4lzab YOEQqqqfQBNoPxoN80pGd1KDYAGozuAiAhpDcMK2mdX80Ytp525U0wSTv8iEMyYHD091 HXrw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mb7si8582775ejb.316.2020.07.03.14.06.09; Fri, 03 Jul 2020 14:06:32 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726669AbgGCVDD (ORCPT + 99 others); Fri, 3 Jul 2020 17:03:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726379AbgGCVDD (ORCPT ); Fri, 3 Jul 2020 17:03:03 -0400 Received: from ZenIV.linux.org.uk (zeniv.linux.org.uk [IPv6:2002:c35c:fd02::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B57B5C061794 for ; Fri, 3 Jul 2020 14:03:02 -0700 (PDT) Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1jrSpS-004pJE-0P; Fri, 03 Jul 2020 21:02:38 +0000 Date: Fri, 3 Jul 2020 22:02:37 +0100 From: Al Viro To: Linus Torvalds Cc: Michael Ellerman , Christophe Leroy , Josh Poimboeuf , Peter Zijlstra , the arch/x86 maintainers , Linux Kernel Mailing List Subject: Re: objtool clac/stac handling change.. Message-ID: <20200703210237.GS2786714@ZenIV.linux.org.uk> References: <20200701195914.GK2786714@ZenIV.linux.org.uk> <87lfk26nx4.fsf@mpe.ellerman.id.au> <20200702201755.GO2786714@ZenIV.linux.org.uk> <20200702205902.GP2786714@ZenIV.linux.org.uk> <20200703013328.GQ2786714@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200703013328.GQ2786714@ZenIV.linux.org.uk> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 03, 2020 at 02:33:28AM +0100, Al Viro wrote: > On Thu, Jul 02, 2020 at 02:55:19PM -0700, Linus Torvalds wrote: > > > And while XSTATE_OP() is still disgusting, it's > > > > (a) slightly less disgusting than it used to be > > > > (b) now easily fixable if we do the "exceptions clear AC" thing. > > > > so it's an improvement all around. > > > > If it works, that is. As mentioned: IT HAS NO TESTING. > > What about load_unaligned_zeropad()? Normally the caller doesn't > want to know about the exception on crossing into an unmapped > page. Blanket "clear #AC of fixup, don't go through user_access_end() > in case of exception" would complicate the code that calls that sucker. Actually, for more serious problem consider arch/x86/lib/copy_user_64.S In case of an unhandled fault on attempt to read an (unaligned) word, the damn thing falls back to this: SYM_CODE_START_LOCAL(.Lcopy_user_handle_tail) movl %edx,%ecx 1: rep movsb 2: mov %ecx,%eax ASM_CLAC ret _ASM_EXTABLE_UA(1b, 2b) SYM_CODE_END(.Lcopy_user_handle_tail) We could do what alpha, sparc et.al. are doing - have both reads and writes aligned, with every output word being a mix of two input ones. But I would expect that to be considerably slower than the current variants. Sure, we can set AC in .Lcopy_user_handle_tail, but that doesn't look right. And while squeezing every byte on a short copy is not a hard requirement, in situation when the source is one byte before the end of page and destination is aligned, raw_copy_from_user() really must copy at least one byte if it's readable. So I suspect that we need a variant of extable entry that does not clear AC, at least for these fallbacks. PS: I'm still going through the _ASM_EXTABLE... users on x86, so there might be more fun. Will post when I'm done...