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=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham 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 A8335ECDFBB for ; Wed, 18 Jul 2018 20:04:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 36F112084E for ; Wed, 18 Jul 2018 20:04:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 36F112084E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ZenIV.linux.org.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730573AbeGRUnn (ORCPT ); Wed, 18 Jul 2018 16:43:43 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:39708 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726909AbeGRUnn (ORCPT ); Wed, 18 Jul 2018 16:43:43 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.87 #1 (Red Hat Linux)) id 1ffsgF-0004Ga-O3; Wed, 18 Jul 2018 20:04:11 +0000 Date: Wed, 18 Jul 2018 21:04:11 +0100 From: Al Viro To: Linus Torvalds Cc: Miklos Szeredi , Stephen Rothwell , linux-fsdevel , Linux Kernel Mailing List Subject: Re: [RFC] call_with_creds() Message-ID: <20180718200411.GW30522@ZenIV.linux.org.uk> References: <20180718025636.GA26175@ZenIV.linux.org.uk> <20180718132955.2bf185b7@canb.auug.org.au> <20180718124340.GS30522@ZenIV.linux.org.uk> <20180718181252.GU30522@ZenIV.linux.org.uk> <20180718194637.GV30522@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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, Jul 18, 2018 at 12:53:48PM -0700, Linus Torvalds wrote: > On Wed, Jul 18, 2018 at 12:46 PM Al Viro wrote: > > > > Huh? Nevermind ->write(), what about open()? > > What about open? > > At open time, file->f_cred is the same as current_cred(). int cachefiles_write_page(struct fscache_storage *op, struct page *page) { ... file = dentry_open(&path, O_RDWR | O_LARGEFILE, cache->cache_cred); int ecryptfs_privileged_open(struct file **lower_file, struct dentry *lower_dentry, struct vfsmount *lower_mnt, const struct cred *cred) ... (*lower_file) = dentry_open(&req.path, flags, cred); /* Derived from fs/exec.c:flush_old_files. */ static inline void flush_unauthorized_files(const struct cred *cred, struct files_struct *files) ... devnull = dentry_open(&selinux_null, O_RDWR, cred); (granted, here we don't care much, /dev/null being what it is) In mainline: struct file *filp_clone_open(struct file *oldfile) { ... retval = vfs_open(&oldfile->f_path, file, oldfile->f_cred);