Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp64487imm; Wed, 4 Jul 2018 17:53:06 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdqXYDPcl13KNfxasIz6Z+DJzP0c0cPGQyLVkUW9hc7/eYZUXkCXMYiloxHvr0fxjKBk6Ef X-Received: by 2002:a62:152:: with SMTP id 79-v6mr4208308pfb.74.1530751986652; Wed, 04 Jul 2018 17:53:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530751986; cv=none; d=google.com; s=arc-20160816; b=mYb84e9x8BfK2Z+5YqJo/SqP+hbRdqC36WG1dtvmXfDrZnoWrt8P/SFbwI51zByeCX +PuOUEsEXOsR5wcN4V4CKG+iyBpaL/ghvjbzjkz2QcqCv36NUsO+MDHAg7l350jxSNmA 2Aj1qLAac5Znv2X5Y/TaHWX+JBsiHPlivUS0IaiJOr2ncXtXsGA5XonS5xnNS8rItjlh qZmRpUQkwPqjELLWdMIV3VxlZj1W4ouTrF+TWR40pOHF6ZYp7MarwrsC4kiW4VpVBJPK 9elY2iKMlM8+wE127tn90eett1Tvt25UGvuiKT41JZHnKcIuVZ1y4k+kz0VRjUc0soQY BGmA== 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:arc-authentication-results; bh=KJgzxmgrZpuLX5bhq/CZMTDVGwVKebD+R6JtcDYDqO0=; b=C+3qrfJ5FcSRtjz4YmmcBnTjfTSSyW79Jzxp4PUWjQEtyNqYlGbTbQyftMAR9+50AO 4GcbdWbyeqT9K2BQ0aoBLX72IMfOeWFSxrtGJ6nFXoNNOAcc87LW4IFwnEqCZoLnIuAz wVJWaa0ZfVBgJ43kGd4FyrzMjEvNFr4acqLI/2bnmPw2e+lfW2c1eU5r+pK3WU3e21Mh Ju0sqw4hWaQzJnVDTVhEZbV5fDSq0g6qO2qk/fwJf6OrU/D4DKZt66D/zdqmRkw5CGbz iozONWL5rAEl61xIq73RBpacSn86XRTFKC9qnNqeieuJpvMUB13cVj2oZ4heId4oz7wc l34A== 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 34-v6si4638723plz.479.2018.07.04.17.52.51; Wed, 04 Jul 2018 17:53:06 -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 S1753143AbeGEAwO (ORCPT + 99 others); Wed, 4 Jul 2018 20:52:14 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:51004 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752999AbeGEAwM (ORCPT ); Wed, 4 Jul 2018 20:52:12 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.87 #1 (Red Hat Linux)) id 1fasVB-0004MO-Qg; Thu, 05 Jul 2018 00:52:05 +0000 Date: Thu, 5 Jul 2018 01:52:05 +0100 From: Al Viro To: Linus Torvalds Cc: Seung-Woo Kim , Greg Kroah-Hartman , Linux Kernel Mailing List , Andrew Morton , stable , lwn@lwn.net, Jiri Slaby Subject: Re: Linux 3.18.111 Message-ID: <20180705005205.GC30522@ZenIV.linux.org.uk> References: <20180530073211.GA22422@kroah.com> <20180703032456epcas1p29c4570ae3f6bb3f8d7c2d475e1ba4658~9vfIpgNT51989519895epcas1p2d@epcas1p2.samsung.com> <20180703043655.GA9793@kroah.com> <20180703044302epcas1p4ff5961129c010a2df3548cf678b6274c~9wjUy-vFW2959129591epcas1p4p@epcas1p4.samsung.com> 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 Mon, Jul 02, 2018 at 10:01:25PM -0700, Linus Torvalds wrote: > On Mon, Jul 2, 2018 at 9:43 PM Seung-Woo Kim wrote: > > > > I think the commit itself is required. Simple, but not reliable, > > workaround fix is like below: > > > > diff --git a/fs/dcache.c b/fs/dcache.c > > index a34d401..7c751f2 100644 > > --- a/fs/dcache.c > > +++ b/fs/dcache.c > > @@ -1879,6 +1879,8 @@ void d_instantiate_new(struct dentry *entry, > > struct inode *inode) > > BUG_ON(!hlist_unhashed(&entry->d_u.d_alias)); > > BUG_ON(!inode); > > lockdep_annotate_inode_mutex_key(inode); > > + /* WORKAROUND for calling security_d_instantiate() */ > > + entry->d_inode = inode; > > security_d_instantiate(entry, inode); > > spin_lock(&inode->i_lock); > > __d_instantiate(entry, inode); > > Ugh. That looks horrible even if it might avoid the oops. > > I think a much better solution is to back-port commit b296821a7c42 > ("xattr_handler: pass dentry and inode as separate arguments of > ->get()") to older kernels. Then the inode is passed down all the way, > and you don't have people try to get it from the (not yet initialized) > dentry. > > But there might be other parts missing too, and I didn't look at how > easy/painful that backport would be. > > Al - comments? This is all because of commit 1e2e547a93a0 ("do > d_instantiate/unlock_new_inode combinations safely") being marked for > stable, and various cases of security_d_instantiate() calling down to > getxattr. Which used to not get the inode at all, so those older > kernels use d_inode(dentry), which doesn't work in this path since > dentry->d_inode hasn't been instantiated yet.. You also want b96809173e94 and ce23e6401334 there...