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=-6.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,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 D3728C5DF9D for ; Tue, 27 Oct 2020 00:05:48 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5572720754 for ; Tue, 27 Oct 2020 00:05:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5572720754 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A293C6B005D; Mon, 26 Oct 2020 20:05:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9E8976B0062; Mon, 26 Oct 2020 20:05:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 876786B0062; Mon, 26 Oct 2020 20:05:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0213.hostedemail.com [216.40.44.213]) by kanga.kvack.org (Postfix) with ESMTP id 54D9B6B005C for ; Mon, 26 Oct 2020 20:05:47 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 00EE7180AD806 for ; Tue, 27 Oct 2020 00:05:47 +0000 (UTC) X-FDA: 77415761934.30.lead98_170be7b27277 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin30.hostedemail.com (Postfix) with ESMTP id D03AF180B3C8B; Tue, 27 Oct 2020 00:05:46 +0000 (UTC) X-HE-Tag: lead98_170be7b27277 X-Filterd-Recvd-Size: 3244 Received: from ZenIV.linux.org.uk (zeniv.linux.org.uk [195.92.253.2]) by imf43.hostedemail.com (Postfix) with ESMTP; Tue, 27 Oct 2020 00:05:46 +0000 (UTC) Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kXCUL-009VwG-7r; Tue, 27 Oct 2020 00:05:21 +0000 Date: Tue, 27 Oct 2020 00:05:21 +0000 From: Al Viro To: Jens Axboe Cc: Kyle Huey , open list , Christoph Hellwig , Robert O'Callahan , Andrew Morton , Arnd Bergmann , David Howells , "moderated list:ARM PORT" , "maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" , linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, "open list:FILESYSTEMS (VFS and infrastructure)" , linux-aio@kvack.org, io-uring@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, keyrings@vger.kernel.org, linux-security-module@vger.kernel.org, Linus Torvalds Subject: Re: [REGRESSION] mm: process_vm_readv testcase no longer works after compat_prcoess_vm_readv removed Message-ID: <20201027000521.GD3576660@ZenIV.linux.org.uk> References: <70d5569e-4ad6-988a-e047-5d12d298684c@kernel.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <70d5569e-4ad6-988a-e047-5d12d298684c@kernel.dk> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Oct 26, 2020 at 05:56:11PM -0600, Jens Axboe wrote: > On 10/26/20 4:55 PM, Kyle Huey wrote: > > A test program from the rr[0] test suite, vm_readv_writev[1], no > > longer works on 5.10-rc1 when compiled as a 32 bit binary and executed > > on a 64 bit kernel. The first process_vm_readv call (on line 35) now > > fails with EFAULT. I have bisected this to > > c3973b401ef2b0b8005f8074a10e96e3ea093823. > > > > It should be fairly straightforward to extract the test case from our > > repository into a standalone program. > > Can you check with this applied? > > diff --git a/mm/process_vm_access.c b/mm/process_vm_access.c > index fd12da80b6f2..05676722d9cd 100644 > --- a/mm/process_vm_access.c > +++ b/mm/process_vm_access.c > @@ -273,7 +273,8 @@ static ssize_t process_vm_rw(pid_t pid, > return rc; > if (!iov_iter_count(&iter)) > goto free_iov_l; > - iov_r = iovec_from_user(rvec, riovcnt, UIO_FASTIOV, iovstack_r, false); > + iov_r = iovec_from_user(rvec, riovcnt, UIO_FASTIOV, iovstack_r, > + in_compat_syscall()); _ouch_ There's a bug, all right, but I'm not sure that this is all there is to it. For now it's probably the right fix, but... Consider the fun trying to use that from 32bit process to access the memory of 64bit one. IOW, we might want to add an explicit flag for "force 64bit addresses/sizes in rvec".