From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-f194.google.com ([209.85.214.194]:39739 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728575AbeIRTjq (ORCPT ); Tue, 18 Sep 2018 15:39:46 -0400 Subject: Re: [PATCH 14/33] vfs: Implement a filesystem superblock creation/configuration context [ver #11] To: Sergey Senozhatsky Cc: David Howells , viro@zeniv.linux.org.uk, torvalds@linux-foundation.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Steven Rostedt References: <20180911220743.GA13208@roeck-us.net> <20180911174641.GA15149@roeck-us.net> <153313703562.13253.5766498657900728120.stgit@warthog.procyon.org.uk> <153313714181.13253.304098108512966976.stgit@warthog.procyon.org.uk> <27113.1536702746@warthog.procyon.org.uk> <32382.1536707855@warthog.procyon.org.uk> <20180911235403.GA10107@roeck-us.net> <20180918090722.GA463@jagdpanzerIV> From: Guenter Roeck Message-ID: <80eb1ec0-7b61-debe-9e93-0176d3e2c76a@roeck-us.net> Date: Tue, 18 Sep 2018 07:06:58 -0700 MIME-Version: 1.0 In-Reply-To: <20180918090722.GA463@jagdpanzerIV> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On 09/18/2018 02:07 AM, Sergey Senozhatsky wrote: > Hi, > > On (09/11/18 16:54), Guenter Roeck wrote: >> On Wed, Sep 12, 2018 at 12:17:35AM +0100, David Howells wrote: >>> Guenter Roeck wrote: >>> >>>> [ 8.507672] RIP: 0010:reconfigure_super+0x47/0x210 >>> >>> Can you tell me the file and line this corresponds to? >>> >> I don't know, but some debugging shows that fc->ops == NULL. > > This NULL derefs linux-next. > > Emergency (sysrq remount/reboot): > > emergency_remount() > do_emergency_remount() > do_emergency_remount_callback() > reconfigure_super() > > At fc->ops dereference: > > 981 if (fc->ops->reconfigure) { > ^^^^^^^^^ > 982 retval = fc->ops->reconfigure(fc); > 983 if (retval == 0) { > 984 security_sb_reconfigure(fc); > > > So the check either better be > > if (fc->ops && fc->ops->reconfigure) > Since there are multiple instances of fs_context where fc->ops isn't set, this check would be needed wherever fc->ops is dereferenced. Guenter > Or, we need to set ->ops properly. But I'm not sure if invoking > ->init_fs_context() from emergency-reboot path is going to work > well all the time. > > --- > > fs/super.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/fs/super.c b/fs/super.c > index efb0567c8389..e2e03c47c817 100644 > --- a/fs/super.c > +++ b/fs/super.c > @@ -1017,6 +1017,7 @@ int reconfigure_super(struct fs_context *fc) > static void do_emergency_remount_callback(struct super_block *sb) > { > struct fs_context fc = { > + .ops = &legacy_fs_context_ops, > .purpose = FS_CONTEXT_FOR_EMERGENCY_RO, > .fs_type = sb->s_type, > .root = sb->s_root, > > --- > > -ss >