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=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 D7A7FC4320E for ; Sat, 28 Aug 2021 22:23:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B900260EAF for ; Sat, 28 Aug 2021 22:23:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232902AbhH1WYl (ORCPT ); Sat, 28 Aug 2021 18:24:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230253AbhH1WYj (ORCPT ); Sat, 28 Aug 2021 18:24:39 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF473C061756; Sat, 28 Aug 2021 15:23:48 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1630189426; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=j5baxkRt6FRyNR9NaORfg0w1u2EC3Afc4IwvC+mzssI=; b=ya9EcwyYkE0CPACg9mqhH69MrCoxvtcfYUqNOVM5q3ehhgRT3td05EBy3ZMp+PuTVhWJ40 rpBKMkXq8TOmt8hAhbT9I474UC9yxt8ZXBNTulUXkY6MMAI7yUNjYmhVDjm4x4n3Gkc92H RPnf0SXPrlkAATkwqwysNabdzj4SD4bb/xR63ZXeenc4qyrxnoX2V4GXGpoja2q879+xvc gxD4bhWix+AZYVS0Bc450GsWtEJckAKsZphfE5giSRbgSlSXT6d5+ZeeDC8rw+pVAbfunX zmjdEFurBUUmQDqirdvPzSCKutMacgLTmoJpBeKM/YYOAxUUOvw9ApnnnSMzKg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1630189426; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=j5baxkRt6FRyNR9NaORfg0w1u2EC3Afc4IwvC+mzssI=; b=qq8/oe9XX24Pwfmj4Nd8xIS/Zne8QvcBxBVYjviiFrqkveI5UkPagjOqx75vs02MlVC/pz L1isaALRXnikNZAA== To: Al Viro Cc: "Luck, Tony" , Linus Torvalds , Andreas Gruenbacher , Christoph Hellwig , "Darrick J. Wong" , Jan Kara , Matthew Wilcox , cluster-devel , linux-fsdevel , Linux Kernel Mailing List , ocfs2-devel@oss.oracle.com, Borislav Petkov , x86@kernel.org Subject: Re: [PATCH v7 05/19] iov_iter: Introduce fault_in_iov_iter_writeable In-Reply-To: References: <20210827164926.1726765-6-agruenba@redhat.com> <20210827232246.GA1668365@agluck-desk2.amr.corp.intel.com> <87r1edgs2w.ffs@tglx> Date: Sun, 29 Aug 2021 00:23:45 +0200 Message-ID: <87o89hgqdq.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Aug 28 2021 at 22:04, Al Viro wrote: > On Sat, Aug 28, 2021 at 11:47:03PM +0200, Thomas Gleixner wrote: > >> /* Try to handle #PF, but anything else is fatal. */ >> if (ret != -EFAULT) >> return -EINVAL; > >> which all end up in user_insn(). user_insn() returns 0 or the negated >> trap number, which results in -EFAULT for #PF, but for #MC the negated >> trap number is -18 i.e. != -EFAULT. IOW, there is no endless loop. >> >> This used to be a problem before commit: >> >> aee8c67a4faa ("x86/fpu: Return proper error codes from user access functions") >> >> and as the changelog says the initial reason for this was #GP going into >> the fault path, but I'm pretty sure that I also discussed the #MC angle with >> Borislav back then. Should have added some more comments there >> obviously. > > ... or at least have that check spelled > > if (ret != -X86_TRAP_PF) > return -EINVAL; > > Unless I'm misreading your explanation, that is... Yes, that makes a lot of sense.