From patchwork Sun Mar 5 02:10:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Viro X-Patchwork-Id: 64272 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1177669wrd; Sat, 4 Mar 2023 18:11:44 -0800 (PST) X-Google-Smtp-Source: AK7set+p5E2qVPOQ1R1nQoJ5lCLxQR3uG3P3DCgUY8n2YyUGR2DKvaufJIkfroRql8kQ/AJ/XlB9 X-Received: by 2002:a17:906:1643:b0:871:dd2:4af0 with SMTP id n3-20020a170906164300b008710dd24af0mr6980769ejd.26.1677982304695; Sat, 04 Mar 2023 18:11:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677982304; cv=none; d=google.com; s=arc-20160816; b=CM0mOcB4vP6GI7ojoTKkIKsUyWAJwftYSUz9TB10e43r4WQ6/LY2OQwI3iPgzbBPr3 GAMrZxng4sB/8PLK/+i+2eBLyVS7BSNCMnjin7qd5kVxFhT17eD+l14tQ6Q00g3DwYko nxgkmZJLx8cwH9JacUKVrAy5ZXSr9U4x5ILdq7kNt5Rt//GZ4DJWL15kVIQSopbWxxjd Rj64Du8wUN0s4FSQVrIXscQF4U6bnfocpie0CYk8b0kQmYMgjYEdyPhGxUR+2WRluqi0 E4OHHsmT++IqAyHqwZFb457fOFDZkpuCmzqAKGzMNy4d+lr4Dw+KxcbAF0s/P7In0je7 yXoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=3ZoSoAgAc45as1CbqRRfIYjrDgicK0h9/Eydc3y8CvI=; b=JfanrHFkv2x4nuW/0kC6GgDpmMpFUdA6fQWV3KrZSVJwV9Re3lUcqlxZOyyZL59fmk +zsu2pXx16bNgX6FqvySW5b//w+eYYapkMe8xHcSPl9j0QgUK6yBBN40SKVIJdsUCNnv Cb2p8tvuc8X5CqeGL+02bOoFbfAb7Launi6GKICXh+VaUkcCNU+PBT35XgsMANjos9E3 DVVOkPBERDeFOoz6u1a//We+bKhdkwAeitDtPz5uhJp4x3OYjRjsvoXy9PEl5bzyLUzi Hcmv0cOzW81+7oOwInhd4Y7HbdQxJ7dhCzZ89Eo8yUHYN9oWWPLsSNG6iXJ5v8R6RcNY 8QSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=uL31q83o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d10-20020a50fb0a000000b004acda4c9666si6824066edq.225.2023.03.04.18.11.21; Sat, 04 Mar 2023 18:11:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.org.uk header.s=zeniv-20220401 header.b=uL31q83o; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zeniv.linux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229567AbjCECKt (ORCPT + 99 others); Sat, 4 Mar 2023 21:10:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229557AbjCECKr (ORCPT ); Sat, 4 Mar 2023 21:10:47 -0500 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8518713D58; Sat, 4 Mar 2023 18:10:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:Content-Type:MIME-Version: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:In-Reply-To:References; bh=3ZoSoAgAc45as1CbqRRfIYjrDgicK0h9/Eydc3y8CvI=; b=uL31q83onkyvAad/3/HrEjNKCF Q/ch0bwsL0cHBeH6t9o2+jUxC2h8HCgZI/LXxuinBRAoVWnVCYgV6xsqom+okFRwpFHQhX/UEv/dN NqobvNrRa4F1jk9282S6xqaRWr6ROxfsYwDGm0c0hYMI9LcQjBvIRWxehofrjp4ki3r8LvaUc+FRX QOOcyiTIKlmU1xCZEfhsUrryeCOl3HcV2yy6EExlSG+1rHuWkxrV2N/SdNohdYFD/9lrjuABti8M4 80e3bfyd5AANlUga0YQ8UfpARuBHnlx0Ex4W9ThuI/075uHJxTvx7ADxMFxLHjCQuygoxCcamtfrP VmNkyUXQ==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1pYdpi-00E15l-21; Sun, 05 Mar 2023 02:10:42 +0000 Date: Sun, 5 Mar 2023 02:10:42 +0000 From: Al Viro To: Linus Torvalds Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org Subject: [git pull] VM_FAULT_RETRY fixes Message-ID: MIME-Version: 1.0 Content-Disposition: inline Sender: Al Viro X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1759491972834460170?= X-GMAIL-MSGID: =?utf-8?q?1759491972834460170?= The following changes since commit c9c3395d5e3dcc6daee66c6908354d47bf98cb0c: Linux 6.2 (2023-02-19 14:24:22 -0800) are available in the Git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs.git tags/pull-fixes for you to fetch changes up to caa82ae7ef52b7cf5f80a2b2fbcbdbcfd16426cc: openrisc: fix livelock in uaccess (2023-03-02 12:32:44 -0500) ---------------------------------------------------------------- VM_FAULT_RETRY fixes Some of the page fault handlers do not deal with the following case correctly: * handle_mm_fault() has returned VM_FAULT_RETRY * there is a pending fatal signal * fault had happened in kernel mode Correct action in such case is not "return unconditionally" - fatal signals are handled only upon return to userland and something like copy_to_user() would end up retrying the faulting instruction and triggering the same fault again and again. What we need to do in such case is to make the caller to treat that as failed uaccess attempt - handle exception if there is an exception handler for faulting instruction or oops if there isn't one. Over the years some architectures had been fixed and now are handling that case properly; some still do not. This series should fix the remaining ones. Status: m68k, riscv, hexagon, parisc: tested/acked by maintainers. alpha, sparc32, sparc64: tested locally - bug has been reproduced on the unpatched kernel and verified to be fixed by this series. ia64, microblaze, nios2, openrisc: build, but otherwise completely untested. Signed-off-by: Al Viro ---------------------------------------------------------------- Al Viro (10): m68k: fix livelock in uaccess riscv: fix livelock in uaccess hexagon: fix livelock in uaccess parisc: fix livelock in uaccess alpha: fix livelock in uaccess sparc: fix livelock in uaccess ia64: fix livelock in uaccess microblaze: fix livelock in uaccess nios2: fix livelock in uaccess openrisc: fix livelock in uaccess arch/alpha/mm/fault.c | 5 ++++- arch/hexagon/mm/vm_fault.c | 5 ++++- arch/ia64/mm/fault.c | 5 ++++- arch/m68k/mm/fault.c | 5 ++++- arch/microblaze/mm/fault.c | 5 ++++- arch/nios2/mm/fault.c | 5 ++++- arch/openrisc/mm/fault.c | 5 ++++- arch/parisc/mm/fault.c | 7 ++++++- arch/riscv/mm/fault.c | 5 ++++- arch/sparc/mm/fault_32.c | 5 ++++- arch/sparc/mm/fault_64.c | 7 ++++++- 11 files changed, 48 insertions(+), 11 deletions(-)