From: Hin-Tak Leung <hintak_leung@yahoo.co.uk>
To: Naohiro Aota <naota@elisp.net>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] hfsplus: Add record offset check
Date: Thu, 14 Jul 2011 09:07:14 +0100 (BST) [thread overview]
Message-ID: <1310630834.622.YahooMailClassic@web29508.mail.ird.yahoo.com> (raw)
In-Reply-To: <87k4blyga3.fsf@elisp.net>
--- On Wed, 13/7/11, Naohiro Aota <naota@elisp.net> wrote:
<snipped>
> hfsplus_bnode_read() which is called from
> hfsplus_bnode_read_u16(), is
> causing the fault. Since hfs_bnode_read_u16() can return
> any u16
> numbers, we cannot assume some value as "error code", so it
> is difficult
> to check the error in hfsplus_bnode_read*(). Actually there
> is no way to
> report the range error to the callers. If we'd like to
> check the range
> and offset in hfsplus_bnode_read(), we need to modify not
> only
> hfsplus_bnode_read() but also all the function callers.
> Would it be a
> better solution? I don't think so.
>
> Even if there is another root cause of this fault here I
> have, it's
> still a big problem. Because 'recoff' is come from disk, it
> is easily
> fuzzed to have invalid out of range value, and it cause the
> fault, and
> make the file system completely unavailable untill the next
> reboot.
>
> About bad-side effects: I don't think there is serious
> bad-side
> effects. Above this patch code, 'recoff' is checked and if
> it is 0 and
> below this patch code, 'retval' (= keylen) is checked to be
> in
> acceptable range. In both case, hfsplus_brec_keylen()
> return 0. My patch
> is just doing additional check. The caller of
> hfsplus_brec_keylen()
> should be able to handle this 0 value as error code. If
> there is some
> bad-side effect, the caller may also fail to handle
> 'recoff' == 0 case
> or too large 'retval' (keylen) case. That should be another
> bug.
<snipped>
> Purpose of this patch is as same as commit
> 9250f925972d03ccc0c0a4dd4e9b794d2ef6d52b. This is a patch
> to handle
> on-disk corruption without oopsing.
>
I am not disputing that the current kernel code is broken - I am disputing your _explanation_ and _appoach_ of it. The most important part of your exposition above to accompany the change proposed is this:
"The caller of hfsplus_brec_keylen() should be able to handle this 0 value as error code."
Something to this effect should be in your initial commit log message, or in the patch itself. (e.g. "/* return error state for caller to handle */").
next prev parent reply other threads:[~2011-07-14 8:07 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-11 18:46 Naohiro Aota
2011-07-13 3:58 ` Hin-Tak Leung
2011-07-13 6:06 ` Pekka Enberg
2011-07-14 5:06 ` Hin-Tak Leung
2011-07-13 22:20 ` Naohiro Aota
2011-07-14 7:30 ` Pekka Enberg
2011-07-14 8:07 ` Hin-Tak Leung [this message]
2011-07-14 14:53 ` Christoph Hellwig
2011-07-17 22:08 ` [PATCH v2] hfsplus: Add additional range check to handle on-disk corruptions Naohiro Aota
2011-07-18 15:12 ` Christoph Hellwig
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=1310630834.622.YahooMailClassic@web29508.mail.ird.yahoo.com \
--to=hintak_leung@yahoo.co.uk \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=naota@elisp.net \
/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
Powered by JetHome