Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp14028imm; Thu, 4 Oct 2018 22:13:50 -0700 (PDT) X-Google-Smtp-Source: ACcGV620eq+tdLeCrVuSRCXO9b1ak6tZcU+wnjPaXxDmDkjJmJL8cntOllC59IFz+btPRZm+haVz X-Received: by 2002:a63:69c3:: with SMTP id e186-v6mr8477954pgc.431.1538716430331; Thu, 04 Oct 2018 22:13:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538716430; cv=none; d=google.com; s=arc-20160816; b=MNp4OVAg131B73ohxLP7+kQiaxPEsHaxG+PtsfycgTsZsczKAOmTTudi06N9uByNzg smGFp9IlLDAgUjgd1c6HhiBc7YWbd5xE6NUkdz7QiNHwIJlFsP8azCPDcaDHVZwnfoQc jNvAJzS2jSUASZuN6SSgOfEhoqW/nZDNshvS8wj09IZ8xXsknCfziTJPprZnd6wAboHD F3dbhqY8CsezWXARxsSeLteMmRbM33Alzq0N23oHZ70cBpXC1yoTqDoKI4M8SAexpPIu fxi4FJt4SOet6dvLgznVIun55HKKwS2YHSswdqBX+8oI0Z9+iDBBvTNTM1soaibJuhs4 6PNA== 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=H1CBpeLTntawO70im+OR2sYselGhUSLZ4gFbJk2A0tQ=; b=K97Rkj19pHv/VNJEvWnSoHyUUxEcimqkKyVxgV0gN6w47e3+jZEH2n2AgPYN8BDrBT NNmmMVHF0rAaYCAkvbl4BRxXO/CeCqrD0qquw3cQ7rhyFd5EAWy5amCXdnBEDDoqDXNN AsfiZnp20IFlqDye9Nc/aTJx4TaczrFCn6z8WB53eAEkAae11fbQFta0WgqEl50fVLig hGMNFfbCw/werco3Z7GHo0+c3en+4l5h5exziKTx6UbQviyOpxWcZNRvwM+CHruHNzSo 6nL+nk+MRvWgospbyJKFCbLagEF7KTFhv5o7/zFaeFGJcij49IP/ZXeqLPNZfnNJkd9i 1lCQ== ARC-Authentication-Results: i=1; mx.google.com; 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 h9-v6si7559585pfh.240.2018.10.04.22.13.33; Thu, 04 Oct 2018 22:13:50 -0700 (PDT) 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; 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 S1727566AbeJEMKb (ORCPT + 99 others); Fri, 5 Oct 2018 08:10:31 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:36660 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726939AbeJEMKb (ORCPT ); Fri, 5 Oct 2018 08:10:31 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1g8I0x-0000kr-7l; Fri, 05 Oct 2018 04:46:59 +0000 Date: Fri, 5 Oct 2018 05:46:59 +0100 From: Al Viro To: Alexei Starovoitov Cc: "David S . Miller" , daniel@iogearbox.net, luto@amacapital.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH bpf-next 1/6] bpf: introduce BPF_PROG_TYPE_FILE_FILTER Message-ID: <20181005044659.GU32577@ZenIV.linux.org.uk> References: <20181004025750.498303-1-ast@kernel.org> <20181004025750.498303-2-ast@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181004025750.498303-2-ast@kernel.org> User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 03, 2018 at 07:57:45PM -0700, Alexei Starovoitov wrote: > @@ -15,6 +15,7 @@ > #include > #include > #include > +#include <../fs/mount.h> No. > + struct file *file = NULL; > + struct inode *inode; > + struct super_block *sb; > + struct mount *mnt; Fuck, no. > + case offsetof(struct bpf_file_info, mnt_id): > + /* dst = real_mount(file->f_path.mnt)->mnt_id */ > + mnt = real_mount(LD_1(file->f_path.mnt)); > + LD_n(mnt->mnt_id); NAK. Anything in struct mount is private to just a couple of files in fs/*.c. Don't do that. And keep in mind that internal details can and will be changed at zero notice, so be careful with adding such stuff. Another problem is your direct poking in ->i_ino. It's not something directly exposed to userland at the moment and it should not become such. Filesystem has every right to have ->getattr() set ->ino (== ->st_ino value) in whichever way it likes; the same goes for ->dev.