mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joseph Qi <joseph.qi@linux.alibaba.com>
To: "Luís Henriques" <lhenriques@suse.de>
Cc: ocfs2-devel@oss.oracle.com, linux-kernel@vger.kernel.org,
	Mark Fasheh <mark@fasheh.com>, Joel Becker <jlbec@evilplan.org>,
	Heming Zhao <heming.zhao@suse.com>
Subject: Re: [PATCH] ocfs2: fix use-after-free when unmounting read-only filesystem
Date: Tue, 23 May 2023 10:41:33 +0800	[thread overview]
Message-ID: <846d9e88-2b66-1941-a791-6b3e286bdb66@linux.alibaba.com> (raw)
In-Reply-To: <87h6s47dxw.fsf@brahms.olymp>



On 5/22/23 8:23 PM, Luís Henriques wrote:
> Joseph Qi <joseph.qi@linux.alibaba.com> writes:
> 
>> On 5/22/23 6:25 PM, Luís Henriques wrote:
>>> It's trivial to trigger a use-after-free bug in the ocfs2 quotas code using
>>> fstest generic/452.  After mounting a filesystem as read-only, quotas are
>>
>> generic/452 is for testing ext4 mounted with dax and ro.
>> But ocfs2 doesn't support dax yet.
> 
> Right, but I think it's still useful to run the 'generic' test-suite in a
> filesystem.  We can always find issues in the test itself or, in this
> case, a bug in the filesystem.
> 
>>> suspended and ocfs2_mem_dqinfo is freed through ->ocfs2_local_free_info().  When
>>> unmounting the filesystem, an UAF access to the oinfo will eventually cause a
>>> crash.
>>
>> In ocfs2_fill_super(), it won't enable quota if is a readonly mount.
>> Do you mean remount as readonly?
> 
> Yes, sorry. Instead of "mounting", the patch changelog should say
> 
>   "After remounting a filesystem as read-only..."
> 
> Cheers,

Okay, look into the code flow, it does have problem when remount with
read-only.
BTW, it seems that we can't call into quota_disable() again, which will
call free_file_info().

Thanks,
Joseph

  parent reply	other threads:[~2023-05-23  2:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-22 10:25 Luís Henriques
2023-05-22 12:01 ` Joseph Qi
2023-05-22 12:23   ` Luís Henriques
2023-05-22 12:36     ` Heming Zhao
2023-05-22 13:22       ` Luís Henriques
2023-05-23  2:43         ` Joseph Qi
2023-05-23  2:41     ` Joseph Qi [this message]
  -- strict thread matches above, loose matches on Subject: below --
2023-05-22 10:24 Luís Henriques
2023-05-22 10:21 Luís Henriques
2023-05-22 10:20 Luís Henriques

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=846d9e88-2b66-1941-a791-6b3e286bdb66@linux.alibaba.com \
    --to=joseph.qi@linux.alibaba.com \
    --cc=heming.zhao@suse.com \
    --cc=jlbec@evilplan.org \
    --cc=lhenriques@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark@fasheh.com \
    --cc=ocfs2-devel@oss.oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®