Received: by 10.213.65.68 with SMTP id h4csp523174imn; Fri, 6 Apr 2018 04:37:53 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+UmWdNeQN745ch0WWO1lXn2L7eMxxCniNqy10w77RpEhjwmDv7yWVZNov4oq9jmtHjUTq7 X-Received: by 10.167.132.132 with SMTP id u4mr2239519pfn.17.1523014673601; Fri, 06 Apr 2018 04:37:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523014673; cv=none; d=google.com; s=arc-20160816; b=zYP0leyE1XXe8IoZ/eTJPYSsLRVaBXL8bKbnHNiAnh6gT/FHh4Bf//6KpuypGwMKzg xB3t4kcJAwluUiYl+KAVwjLUTCNT9LuzqoAOEdsci775aStRX4EtfOGIfUXk5UM3O+i8 tB3iIzF+BsdXlvS3lhFem4jPqfeLZLn/U5QzM+RN96E1O6SpPsFfgMNK+VpVFbTAuxwb RMQDABcN6QFPzl9wyEc+VsoBTd7hPMQ83HgImeBkJ60JprjlEKgUI9tth2u+HqDxK9IM lWqokQyFWldQjQ1Cq4IeYAntTpsZ5XtTw75k33i8oXczwJj4U7PNO5LqKYD3q3LUKbIu 5Dag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:arc-authentication-results; bh=sfeyfF1xtHPyS0WcnodkzNHz0ap+oqjYcbcOw7Uagb0=; b=j1N8tWpf3twXeqEnMVvUTlc7m3r+DzI4+p3Wafp7Cqx0Gsk7fHz5AnAZtJFngF6QjQ YUgRK67L117HXaWRbeR4zrUonz/1yN00/0TyOA+Ir6Ee/C2wvkr5I3z4rIlGQTdBaB9W ZJZsZEpIF9MAdKSMP0YvlTZYlSHLSKdEP2ulW8LK/2uwy60tmFcRiVyNkWVCqc9pXg9W krEEtXf7/m16ZhqDW3XPoktAlLCwHxHcv5J4INKAIHNHSHbavjp5sVGgp+E//M5Kd3P9 6ZmCr9xIh0vrrjKWXPJzmeL3psOwdZXBKorsHrB/0wZNxKX/dW3aDeNBbhiN6dVVLLdN A4Jw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y16si3875302pfm.142.2018.04.06.04.37.39; Fri, 06 Apr 2018 04:37:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752129AbeDFLgX (ORCPT + 99 others); Fri, 6 Apr 2018 07:36:23 -0400 Received: from www.llwyncelyn.cymru ([82.70.14.225]:54210 "EHLO fuzix.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751492AbeDFLgV (ORCPT ); Fri, 6 Apr 2018 07:36:21 -0400 Received: from alans-desktop (82-70-14-226.dsl.in-addr.zen.co.uk [82.70.14.226]) by fuzix.org (8.15.2/8.15.2) with ESMTP id w36BZj1S003520; Fri, 6 Apr 2018 12:35:45 +0100 Date: Fri, 6 Apr 2018 12:35:45 +0100 From: Alan Cox To: "Michael S. Tsirkin" Cc: Linus Torvalds , Al Viro , Linux Kernel Mailing List , stable , syzbot+6304bf97ef436580fede@syzkaller.appspotmail.com, linux-mm , "Kirill A. Shutemov" , Andrew Morton , Huang Ying , Jonathan Corbet , Peter Zijlstra , Thomas Gleixner , Thorsten Leemhuis Subject: Re: [PATCH] gup: return -EFAULT on access_ok failure Message-ID: <20180406123545.24953eb4@alans-desktop> In-Reply-To: <20180405211945-mutt-send-email-mst@kernel.org> References: <1522431382-4232-1-git-send-email-mst@redhat.com> <20180405045231-mutt-send-email-mst@kernel.org> <20180405171009-mutt-send-email-mst@kernel.org> <20180405211945-mutt-send-email-mst@kernel.org> Organization: Intel Corporation X-Mailer: Claws Mail 3.15.1-dirty (GTK+ 2.24.31; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > so an error on the 1st page gets propagated to the caller, > and that get_user_pages_unlocked eventually calls __get_user_pages > so it does return an error sometimes. > > Would it be correct to apply the second part of the patch then > (pasted below for reference) or should get_user_pages_fast > and all its callers be changed to return 0 on error instead? 0 isn't an error. As SuS sees it (ie from the userspace end of the pile) returning the number you asked for means it worked returning a smaller number means it worked partially and that much was consumed (or in some cases more and the rest if so was lost - depends what you are reading/writing) returning 0 means you read nothing as you were at the end of file returning an error code means it broke, or you should try again (EAGAIN/EWOULDBLOCK) The ugly bit there is the try-again semantics needs to exactly match the attached poll() behaviour or you get busy loops. Alan