Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp994069ybj; Thu, 7 May 2020 12:14:24 -0700 (PDT) X-Google-Smtp-Source: APiQypLXEMhdByiD34MZUPe1dRZw52ObJtKBm0dG7+q+mQwnyG/xxsEWbPJuKZnlWNonxf2Csf3c X-Received: by 2002:a50:d98b:: with SMTP id w11mr12490589edj.196.1588878863899; Thu, 07 May 2020 12:14:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588878863; cv=none; d=google.com; s=arc-20160816; b=ShztyAhQMseaB5IkzCUTi1/lI20RHVEMH6tVcP9XBTdMbnqoe0oSyHEmPo5p+5P19u CxWzX5sdgRIR504OwqZ/DS5g2txyqTo/5noI3JKSoTsl4h+v7zACMadORRBSjNLCm0kK x5uV5m5HCBLUBQzZo7dFmLqD4ex5WTtPmoz1+zTKirOgQodq1qFY8odNqRgQ9CLiP+Y7 5444nfBLzuu034qltM+myRR+NO5SyYtWF+rsvEDAI23wOTR2q+Rhiu/HEo0WuaACQKdd wA4wks2DodMzS0GDUtPw7q7uuMEPYiZRUfL8PMUR5786ccEt2DULh1zfczTQd39y41Ex k5Dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=6js9AvhjnjNWTiEdeOiWCsPNQ5jc6wwNO07r15EMD98=; b=k3NntUK/D/5b7F23Pohs89gSLGIVoNKAcC2lFkiVz/W1WLfEHdq/AwfVDyUwl6mZoI q6EQOKNU5/zFeBAU5W/wDOVWVDIr+CK+vvINoq9g/6sDX4Se83WKKlW07amOSL9sjeGy 9kIbEbOsEeAUVb8tP9B+qzF5JNn9TqSQOY5Ic+rKrB3CqH2OXXDYV2hPKa9bGf/lL8CF jUy3lZ9PHVRHqgJbKZqsPAK2JZBSdIJlT4aLLUHxBIPyJcCh3gbLMcXZSNCk9/xzmVs3 /ABaxORxlFzImNBQaNbV/4aA1AV7wIENUILBTLXR+3umdydYGJpMVCAI2wHeuYP4OiRc Qgvg== 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 u19si3624099edd.364.2020.05.07.12.13.59; Thu, 07 May 2020 12:14:23 -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 S1728328AbgEGTMa (ORCPT + 99 others); Thu, 7 May 2020 15:12:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728273AbgEGTM3 (ORCPT ); Thu, 7 May 2020 15:12:29 -0400 X-Greylist: delayed 651 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 07 May 2020 12:12:28 PDT Received: from nibbler.cm4all.net (nibbler.cm4all.net [IPv6:2001:8d8:970:e500:82:165:145:151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3D21C05BD09 for ; Thu, 7 May 2020 12:12:28 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by nibbler.cm4all.net (Postfix) with ESMTP id 99C4EC0225 for ; Thu, 7 May 2020 21:12:27 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at nibbler.cm4all.net Received: from nibbler.cm4all.net ([127.0.0.1]) by localhost (nibbler.cm4all.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id monGuX-xYEi4 for ; Thu, 7 May 2020 21:12:27 +0200 (CEST) Received: from zero.intern.cm-ag (zero.intern.cm-ag [172.30.16.10]) by nibbler.cm4all.net (Postfix) with SMTP id 7A805C01D4 for ; Thu, 7 May 2020 21:12:27 +0200 (CEST) Received: (qmail 3684 invoked from network); 7 May 2020 22:28:44 +0200 Received: from unknown (HELO rabbit.intern.cm-ag) (172.30.3.1) by zero.intern.cm-ag with SMTP; 7 May 2020 22:28:44 +0200 Received: by rabbit.intern.cm-ag (Postfix, from userid 1023) id 4E1C8461450; Thu, 7 May 2020 21:12:27 +0200 (CEST) Date: Thu, 7 May 2020 21:12:27 +0200 From: Max Kellermann To: Jens Axboe Cc: Al Viro , Max Kellermann , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] fs/io_uring: fix O_PATH fds in openat, openat2, statx Message-ID: <20200507191227.GA16101@rabbit.intern.cm-ag> References: <20200507185725.15840-1-mk@cm4all.com> <20200507190131.GF23230@ZenIV.linux.org.uk> <4cac0e53-656c-50f0-3766-ae3cc6c0310a@kernel.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4cac0e53-656c-50f0-3766-ae3cc6c0310a@kernel.dk> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/05/07 21:05, Jens Axboe wrote: > On 5/7/20 1:01 PM, Al Viro wrote: > > On Thu, May 07, 2020 at 08:57:25PM +0200, Max Kellermann wrote: > >> If an operation's flag `needs_file` is set, the function > >> io_req_set_file() calls io_file_get() to obtain a `struct file*`. > >> > >> This fails for `O_PATH` file descriptors, because those have no > >> `struct file*` > > > > O_PATH descriptors most certainly *do* have that. What the hell > > are you talking about? > > Yeah, hence I was interested in the test case. Since this is > bypassing that part, was assuming we'd have some logic error > that attempted a file grab for a case where we shouldn't. Reproduce this by patching liburing/test/lfs-openat.c: - int dfd = open("/tmp", O_RDONLY | O_DIRECTORY); + int dfd = open("/tmp", O_PATH); $ ./test/lfs-openat io_uring openat failed: Bad file descriptor GH PR: https://github.com/axboe/liburing/pull/130 Max