Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1774998ybt; Thu, 2 Jul 2020 13:36:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8ryOOBK2MV8CLMujObPQ5Ga9Jzhp9lRbqO5nQkyUvoIUQvyr8uX6r3Faeb0Mr2tuC4p5B X-Received: by 2002:a17:906:2799:: with SMTP id j25mr16143440ejc.466.1593722163302; Thu, 02 Jul 2020 13:36:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593722163; cv=none; d=google.com; s=arc-20160816; b=U7AFhvxew+mtBBV4hD1OBAEMSl2Rg+7fiH1rWGIpnQ095QnzIPtLEJ3Nw13patBt0U 7gLBRYJakU671bCQ0y8xA3WaueBJUYqiNSqREXQb+72pzWGE9U5TAi7MuAPiY9YaWhXl QtL6OSg9CSTEG9XCSJnDQt2jDkkc3KQPWtcBHkg61ppBOIyLdYifkO0rW4W9CoxBFeqw qwZh60wQAEWxicZcTKyaiXMdvxBtgsE7Dj1jRrgF9/xM+53Fyaw7byizfmNCCXEDJJca TIrGvp6kRnvf9kn2wDQM0wNCZ0cyWAINlf4lG6SbAr16kVYbPBsRA68P+Qnpu4QOurMt 5XlA== 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 :in-reply-to:references:mime-version:dkim-signature; bh=xQt4Y7Wg4ljfGdZh2OetJLFw6rd6e07ATlfmrHRXM+A=; b=dBtAxQe167m9Wuojr3XyHHl0iw4TLjue6Udo8fb6O3R+YnrkJWTXMfXyEEWUfYJ3Ur 1w8V/0CFNBQ79J92P75j2bEjuykWKTa1hJD1CZV69okF6/8048OcJhkLIgPndGRFipIn nu2q5fIoPnzWxNvDk0jzOGGJ3hF9ca5aw2REdqDNbegv3cKG02LMGx9SPO7d1gnD/KNO TN2zzDE8V2uISDbiXvzgrIQp49YmzMJ8b23YnLdHyLeNvjT3xnrWhHp4tB6djKo8nrwU lTrfYEcIc/6WpQzkfjhM3lj4wnau6UmA3+RYNA1NgtOC/NV0l7KfUXKV+u4EzrkvMFtG C3rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=gcVjD9Ma; 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 h1si6530187edv.246.2020.07.02.13.35.39; Thu, 02 Jul 2020 13:36:03 -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=pass header.i=@linux-foundation.org header.s=google header.b=gcVjD9Ma; 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 S1726014AbgGBUcy (ORCPT + 99 others); Thu, 2 Jul 2020 16:32:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725937AbgGBUcy (ORCPT ); Thu, 2 Jul 2020 16:32:54 -0400 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A953C08C5C1 for ; Thu, 2 Jul 2020 13:32:54 -0700 (PDT) Received: by mail-lf1-x131.google.com with SMTP id t74so17028610lff.2 for ; Thu, 02 Jul 2020 13:32:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=xQt4Y7Wg4ljfGdZh2OetJLFw6rd6e07ATlfmrHRXM+A=; b=gcVjD9Ma36Q3V5fPfsWnT5qcRn8AvXXTYRS2Wfm19eCwKx9S5If6uZc8agFQi3jX4f qobnTrteTasYUAvUzRgjS5UHSJuOhW0R1eE6WhQm78il5KQut6kif1vs7jnPaNAA2WDo zXgPX53hZhxMnZTw31GQe99CcJSJftC67hiAE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xQt4Y7Wg4ljfGdZh2OetJLFw6rd6e07ATlfmrHRXM+A=; b=ELtBqCWDDQv25Ly6XXuUf6GQIx06zLDNK0Yh1MQGXuMbTWeGuoQcg0hAesFc0Q20Oe nsRAAcHNydbiVFTy2LbKpjt6t0TcY56O5F8+/MIlfoZLdLPAIuOvmnMgEMg21aqMBzQ9 rOyuhiDkYjJgHFLwgcTHR0iOX6SpLq5pXwSMJ5Hdo+GmpuK6vqayvK0AWtVDyWG12QgN wovda3lrqncMA1QGbaO8DQ42r1FH0x5bCenbcfiVDuqYx14Vg4s1gqGzOrxgxncUGkaU MXrDOnAcw8dVY02AyDmjRkZhWEscRVtAeQQlRJMEv7y54lR89BSXoPKBGUOfrowbkU6Y yOrw== X-Gm-Message-State: AOAM533jp1WGQOTjJXtWZdxi8yfJ9cHvuAwpSTPdqqf9LVJ7ehMbOt6S 6x30NrXMTFSj8hmdzDCH/pPB3y2wL24= X-Received: by 2002:a19:ca48:: with SMTP id h8mr19509572lfj.161.1593721972245; Thu, 02 Jul 2020 13:32:52 -0700 (PDT) Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com. [209.85.208.181]) by smtp.gmail.com with ESMTPSA id w2sm1117545lji.41.2020.07.02.13.32.50 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 02 Jul 2020 13:32:51 -0700 (PDT) Received: by mail-lj1-f181.google.com with SMTP id t25so29321795lji.12 for ; Thu, 02 Jul 2020 13:32:50 -0700 (PDT) X-Received: by 2002:a2e:9b42:: with SMTP id o2mr16882472ljj.102.1593721970505; Thu, 02 Jul 2020 13:32:50 -0700 (PDT) MIME-Version: 1.0 References: <20200701184131.GI2786714@ZenIV.linux.org.uk> <20200701195914.GK2786714@ZenIV.linux.org.uk> <87lfk26nx4.fsf@mpe.ellerman.id.au> <20200702201755.GO2786714@ZenIV.linux.org.uk> In-Reply-To: <20200702201755.GO2786714@ZenIV.linux.org.uk> From: Linus Torvalds Date: Thu, 2 Jul 2020 13:32:34 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: objtool clac/stac handling change.. To: Al Viro Cc: Michael Ellerman , Christophe Leroy , Josh Poimboeuf , Peter Zijlstra , "the arch/x86 maintainers" , Linux Kernel Mailing List 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 Thu, Jul 2, 2020 at 1:18 PM Al Viro wrote: > > stac(); > XSTATE_OP(XSAVE, buf, -1, -1, err); > clac(); > > Rely upon objtool not noticing that we have, in effect, clac() in a state > where AC is already cleared? We could massage that thing to take a label, > but it wouldn't be pretty... Ugh, the above is bad anyway. It doesn't use _ASM_EXTABLE_UA, so it won't warn about the noncanonical cases. Yeah, it would need to be turned into a "jump out" instead of just "jump over". Which it damn well should do anyway., That code should be taken behind a shed and shot. It does so many things wrong that it's not even funny. It shouldn't do stac/clac on its own. At least it could use the "user_insn()" helper, which does it inside the asm itself, has the right might_fault() marking (but not the address check), and which can be trivially changed to have the fixup jump be to after the "ASM_CLAC". Or maybe it could use "asm goto" for that exception handling, because it doesn't have any outputs (except for the error, which is exactly what the goto case is for). But no, at no point should we "rely on objtool not noticing". In fact, I think Josh's patch would have made objtool notice, and it would have been a good thing, because that code is unbelievably ugly and needs to be cleaned up anyway. Am I surprised that we have hacky stuff in our magic FPU/MMX/AVX state handling? No I'm not. I'm getting to the point where I'm thinking maybe all the horrendous mis-steps from Intel over the last years are a good thing, and ARM will take over, and we won't have to deal with this a decade from now. Linus