[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <80eb1ec0-7b61-debe-9e93-0176d3e2c76a@roeck-us.net>
Date: Tue, 18 Sep 2018 07:06:58 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
Cc: David Howells <dhowells@...hat.com>, viro@...iv.linux.org.uk,
torvalds@...ux-foundation.org, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, Steven Rostedt <rostedt@...dmis.org>
Subject: Re: [PATCH 14/33] vfs: Implement a filesystem superblock
creation/configuration context [ver #11]
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 <linux@...ck-us.net> 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
>
Powered by blists - more mailing lists