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=-3.8 required=3.0 tests=BAYES_00, 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 E1536C433ED for ; Sat, 17 Apr 2021 20:35:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B2D456108D for ; Sat, 17 Apr 2021 20:35:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237063AbhDQUfw (ORCPT ); Sat, 17 Apr 2021 16:35:52 -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.