Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp1252123pxb; Sat, 17 Apr 2021 11:20:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6ERus0Q2gdAQL96Dg+ZJwxsjdBKt3ConHE7LKrG8Hkf3Sd9OEx2FoypRwfebyuGaGy+ki X-Received: by 2002:a50:9f65:: with SMTP id b92mr17142668edf.19.1618683653924; Sat, 17 Apr 2021 11:20:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618683653; cv=none; d=google.com; s=arc-20160816; b=VY454h+1jxCgjlfwFak9U43j5mlDLQ4/7MEHxGBo2ss7kYx9E2ejQhWTJ4h0qibKoR WvjPczc2EN7WMVqvgt3knoVWpR+ftU3CtnCsbm0C9Oyy7s/I1fX5Y8uguTC/CrEdw9zC QsVrTvpJgPVnVpvRzoCi9h6ow1sODW22j43nP9kMpmqJy8p7+neuS+d2+a3QygVrCexy uIO0+vEkLePU5KS1OYRmzaiNOI9nOz8c0g3Badk1nSxgarsJwGnS0axWKiH8qtOSPESZ Fy3L2LkvtA/vvDvXfBCvZzz/5HPP+3SAeEEJ++AKCM5sVDbGt2a1z1spCa//CYPxEG4j 3K9w== 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=oFVVs430DYWMEQIRcFdvXyCXnMBxu4B82K6UrB3UaSU=; b=jn2cm+N5q58pualIOaz+2DSusx0kkqku5uXKSLPfB4YHUwyo+PlBfucJNUZzIIv5RG zvNWMeykUTqilU41mAr3+H+PVd/Nhfkw5pMiqUuJ1Q1HYh+ElikmTpV/DmtZSGpMUZIa fk0UeRQilc8kydcOcmMA2gDLW/n2zsGJapdAH8PyO08JnSiC95CYCyLgkEvLOxZ+5Ren bJspeIVNtJNk8uFM9oDb+meDvLJavsI+jBWQbUYuFHHYpZuJOtwXnrcoMxzO2M1d5htB NpJ06Q+MlI+hGfnRgEROfERkA0Nz7GcZuOYfvXwKHyjXUaJjfyeb3odf0FnQBMM/l6Io QCnQ== 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 i5si3858809edq.232.2021.04.17.11.20.29; Sat, 17 Apr 2021 11:20:53 -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 S236809AbhDQSTv (ORCPT + 99 others); Sat, 17 Apr 2021 14:19:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236759AbhDQSTu (ORCPT ); Sat, 17 Apr 2021 14:19: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 32330C061574 for ; Sat, 17 Apr 2021 11:09:49 -0700 (PDT) Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94 #2 (Red Hat Linux)) id 1lXpO4-0067B4-1n; Sat, 17 Apr 2021 18:09:44 +0000 Date: Sat, 17 Apr 2021 18:09:44 +0000 From: Al Viro To: Linus Torvalds Cc: Eric Dumazet , Thomas Gleixner , linux-kernel , Eric Dumazet 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 09:27:04AM -0700, Linus Torvalds wrote: > On Sat, Apr 17, 2021 at 9:08 AM Linus Torvalds > wrote: > > > > Side note: I'm, looking at the readdir cases that I wrote, and I have > > to just say that is broken too. So "stones and glass houses" etc, and > > I'll have to fix that too. > > In particular, the very very old OLD_READDIR interface that only fills > in one dirent at a time didn't call verify_dirent_name(). Same for the > compat version. > > This requires a corrupt filesystem to be an issue (and even then, > most/all would have the length of a directory entry in an 'unsigned > char', so even corrupt filesystems would generally never have a > negative name length). > > So I don't think it's an issue in _practice_, but at the same time it > is very much an example of the same issue that put_cmsg() has in > net-next: unsafe user copies should be fully guarded and not have some > "but this would never happen because callers would never do anything > bad". > > Al - fairly trivial patch applied, comments? Should be fine... FWIW, I've a patch in the same area, making those suckers return bool. Seeing that they are only ever called via dir_emit(), dir_emit_dot() and dir_emit_dotdot() and all of those return ->actor(...) == 0... Anyway, that'd be trivial to rebase on top of yours.