Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1315352pxb; Sat, 17 Apr 2021 13:36:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2bZnsnTUEDh37mV+n+mj5lgoGdvObui8Z5EGm525gHoOnJwF4geNGXtCz7zkDR510+1GN X-Received: by 2002:a17:907:1c01:: with SMTP id nc1mr14507178ejc.283.1618691794465; Sat, 17 Apr 2021 13:36:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618691794; cv=none; d=google.com; s=arc-20160816; b=FdN4fUIPvQ8jy7QJS3NneSwHrcgmt68vmM2LfMd8OBvlId0wXhUOa3YeQJzqKc3kQl VPHaEmuv6lGzbC7H3yxaFQt8Ywuk1HMF1ReIh5QhbuRFKUuu+QvWSpemvKeNoY+08N0t G3gv9PykZYu3HvJSrlba1+v7JfcDzVAv3lFji2hYqDC2DrfCZyYnLeUL/Wj/3gMpKINN XzP09Qdh0AxgAPB4t1ux+yw6Ui/mw1eEFEMSZTLcAcq2oBRQtNGq9iL92zid7jHLISrm qB/f5/DFZKdqh1HAIEMnlg/Kez+Dd0yZ1G3RgwlJgrLnKSQuOpxKdL/D52b6VxRs2evb DDIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=ZefgjG/1pvBIYGPkRKfH8wjYxcjXh98i75FQ/Eia6F0=; b=Wji77ugCF90mHf6kYHs60e+FaUc3nqI4ui8Sz8FKrENZgmWlqDfbnW1p8jHdqmMQ6g 6dpcTTRbMcoy1CRtg7ox/uc6eOZpU5saDiw4+Qd11xg/NM2rWyKr+Q9SaADT5YqzyqDM Cojtzsh2JNUL+hRRALE0u6XzQ+4+M8xgjOIm3+YEbbFddFj2ojVThBM0FcSU3TO9hD6w wM82mtNGNWGh5wVN+02mPuKYuiw2LZILkulxnn4w2Em0uO1EEZqSsaXO2+Q4YmB7T4vj FEw0KyE/oTHX2Wtk8dhWPpT4dE7tao6CAcs5do5Hqtaf0wFDWQCMDOk5h9Z8nvpWLb7x mQMQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p5si8521552edt.42.2021.04.17.13.36.11; Sat, 17 Apr 2021 13:36:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236987AbhDQUfv (ORCPT + 99 others); Sat, 17 Apr 2021 16:35:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236772AbhDQUfu (ORCPT ); Sat, 17 Apr 2021 16:35:50 -0400 Received: from zeniv-ca.linux.org.uk (zeniv-ca.linux.org.uk [IPv6:2607:5300:60:148a::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42A4BC061574 for ; Sat, 17 Apr 2021 13:35:23 -0700 (PDT) Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94 #2 (Red Hat Linux)) id 1lXrew-0068gI-84; Sat, 17 Apr 2021 20:35:18 +0000 Date: Sat, 17 Apr 2021 20:35:18 +0000 From: Al Viro To: Linus Torvalds Cc: Eric Dumazet , Thomas Gleixner , linux-kernel , Eric Dumazet , Theodore Ts'o Subject: Re: [PATCH] x86/uaccess: small optimization in unsafe_copy_to_user() Message-ID: References: <20210416192413.1514419-1-eric.dumazet@gmail.com> 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 Sat, Apr 17, 2021 at 08:30:42PM +0000, Al Viro wrote: > and that thing is still there. However, it does *NOT* do what it might > appear to be doing; it ends up with getdents() returning -EINVAL instead. > What we need is > buf->error = -EINTR; > in addition to that return (in all 3 such places). Do you have any problems with > the following delta? No, wait - we have non-NULL buf->prev_reclen, so we'll hit if (buf.prev_reclen) { struct compat_linux_dirent __user * lastdirent; lastdirent = (void __user *)buf.current_dir - buf.prev_reclen; if (put_user(buf.ctx.pos, &lastdirent->d_off)) error = -EFAULT; else error = count - buf.count; } with buf->error completely ignored. Nevermind.