From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F135EC432BE for ; Mon, 30 Aug 2021 21:31:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CE27660F3A for ; Mon, 30 Aug 2021 21:31:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233583AbhH3VcL (ORCPT ); Mon, 30 Aug 2021 17:32:11 -0400 Received: from zeniv-ca.linux.org.uk ([142.44.231.140]:45546 "EHLO zeniv-ca.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237171AbhH3VcJ (ORCPT ); Mon, 30 Aug 2021 17:32:09 -0400 Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mKorr-00HP00-D9; Mon, 30 Aug 2021 21:30:59 +0000 Date: Mon, 30 Aug 2021 21:30:59 +0000 From: Al Viro To: Linus Torvalds Cc: Dan Williams , Thomas Gleixner , Borislav Petkov , LKML , the arch/x86 maintainers Subject: Re: [patch 01/10] x86/fpu/signal: Clarify exception handling in restore_fpregs_from_user() Message-ID: References: <20210830154702.247681585@linutronix.de> <20210830162545.374070793@linutronix.de> <87zgsyg0eg.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 30, 2021 at 02:26:12PM -0700, Linus Torvalds wrote: > On Mon, Aug 30, 2021 at 2:07 PM Al Viro wrote: > > > > Incidentally, why do we bother with negation in those? Why not have > > user_insn(), XSTATE_OP() and kernel_insn_err() return 0 or trap number... > > I really wish we didn't have that odd _ASM_EXTABLE_FAULT/ > ex_handler_fault() special case at all. > > It's *very* confusing, and it actually seems to be mis-used. It looks > like the "copy_mc_fragile" code uses it by mistake, and doesn't > actually want that "modify %%rax" behavior of that exception handler > AT ALL. > > If I read that code correctly, it almost by mistake doesn't actually > care, and will overwrite %%rax with the right result, but it doesn't > look like the "fault code in %eax" was ever *intentional*. There's no > mention of it. > > Maybe I'm misreading that code, but I look at it and just go "Whaa?" > > The code in user_insn() clearly *does* use that fault number (and, as > you say, inverts it for some reason), but I wonder how much it really > cares? Could we get rid of it, and just set a fixed error code? > > I only checked one user, but that one didn't actually care which fault > it was, it only cared about fault-vs-no-fault. There's a place where we care about #PF vs. #MC (see upthread)...