Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp3421251ybf; Tue, 3 Mar 2020 05:47:53 -0800 (PST) X-Google-Smtp-Source: ADFU+vvFTv++ZwPP3EUtmc4qXEcEkKsuFmzNfzJPT5LLkYuXnCtvhgOIYrmuuoebB6nPwLjOrg0z X-Received: by 2002:a05:6830:145:: with SMTP id j5mr3293941otp.242.1583243273006; Tue, 03 Mar 2020 05:47:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583243272; cv=none; d=google.com; s=arc-20160816; b=occ22P+E7hZpf+S6Cjsu+v4vUz/551w28QFXdpeJmlgRR3gCU/tnKh8kar2x8QLhUh tSKUbPpEPgUfbkUUDRZdcuYKqV9tRkZVybeeB08gEb5zToVlElW2U9ergG8HAWJAjEm9 POLtNw0x5pUhNt2khYgm2mWwtH2qULciEF6GxcGDjwl2nhItsE0mgWWWpKrzwNKkDCCw +pWzvVCEVYJw4Nu00RfXpL4Hh6dT6DIxn7vujg8pxJqaqk1UKDaxSGSv2Jdw7k0F6kwl zrDTH7SWE3aGpPAF0pHa/hZ4CprJr+P5pq3W4PQdwc7n+8OaSlSgnuvItQqd1XQgWqUw SezA== 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 :dkim-signature; bh=PtBUSuq4jNgJwA7RUiddFNdLC0AfrASA2BsHDZEwZls=; b=SW7C1BOhx37PlAfyk72027jc/SSxXPcdfZpA3nRyKiRg9lXZDHkkEfSmAz+KIJb3Rc AWzXacqSyQjWU7L6INUvbpxNfB6fMprPZXPXpqHNFWY9zH1eyKZuBsB87XQ1eSUS6u4Q vCqTX2p3XqzzaBk4cAmCgpAEf5+4Q4QAYokFZ4YbXCSjg4cysStIAFGlwGQE4dRF3Ud9 LgQu/aP0spzT1GHd1s3C7MftndkOx/NSEDqvTA2YLuqVunOAclK8nJPMxBhUFofn1wcm 4tEv0ihyfcRNWsPsOEh6KH7h88P75NTBnb8F444zaZ02UvpB3ZhDO6ACe1rC64EXA1ss BQ/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="m7D5oAe/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w22si6853500otl.29.2020.03.03.05.47.40; Tue, 03 Mar 2020 05:47:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="m7D5oAe/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727050AbgCCNnT (ORCPT + 99 others); Tue, 3 Mar 2020 08:43:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:36714 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725932AbgCCNnT (ORCPT ); Tue, 3 Mar 2020 08:43:19 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F1B9920717; Tue, 3 Mar 2020 13:43:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583242998; bh=LsmV8M+K1WrR+kQz2BjN3GavRyic/105fmJ2fgu+v8U=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=m7D5oAe/mXB81Q5EvjErelrC7dcsVBIPlqYjg6/7QzcJLcJ3NbAvNfXd3CFPL5um0 +/1agyp/hxBRzSbvRXJ6fahy0JKexFlR14u3ius8X6CtWTU5Lhh8Y4Ph9lig8GzK2K NrYTrB/5QWEVLaOOgkSyz7gGmo8JmuLbfyUY0Phs= Date: Tue, 3 Mar 2020 14:43:16 +0100 From: Greg Kroah-Hartman To: Miklos Szeredi Cc: Karel Zak , David Howells , Ian Kent , Christian Brauner , James Bottomley , Steven Whitehouse , Miklos Szeredi , viro , Christian Brauner , Jann Horn , "Darrick J. Wong" , Linux API , linux-fsdevel , lkml Subject: Re: [PATCH 00/17] VFS: Filesystem information and notifications [ver #17] Message-ID: <20200303134316.GA2509660@kroah.com> References: <107666.1582907766@warthog.procyon.org.uk> <0403cda7345e34c800eec8e2870a1917a8c07e5c.camel@themaw.net> <1509948.1583226773@warthog.procyon.org.uk> <20200303113814.rsqhljkch6tgorpu@ws.net.home> <20200303130347.GA2302029@kroah.com> <20200303131434.GA2373427@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 03, 2020 at 02:34:42PM +0100, Miklos Szeredi wrote: > On Tue, Mar 3, 2020 at 2:14 PM Greg Kroah-Hartman > wrote: > > > > Unlimited beers for a 21-line kernel patch? Sign me up! > > > > > > Totally untested, barely compiled patch below. > > > > Ok, that didn't even build, let me try this for real now... > > Some comments on the interface: Ok, hey, let's do this proper :) > O_LARGEFILE can be unconditional, since offsets are not exposed to the caller. Good point. > Use the openat2 style arguments; limit the accepted flags to sane ones > (e.g. don't let this syscall create a file). Yeah, I just added that check to my local version: /* Mask off all O_ flags as we only want to read from the file */ flags &= ~(VALID_OPEN_FLAGS); flags |= O_RDONLY | O_LARGEFILE; > If buffer is too small to fit the whole file, return error. Why? What's wrong with just returning the bytes asked for? If someone only wants 5 bytes from the front of a file, it should be fine to give that to them, right? > Verify that the number of bytes read matches the file size, otherwise > return error (may need to loop?). No, we can't "match file size" as sysfs files do not really have a sane "size". So I don't want to loop at all here, one-shot, that's all you get :) Let me actually do this and try it out for real. /me has no idea what he is getting himself into... thanks, greg k-h