From: Ruediger Meier <sweet_f_a@gmx.de>
To: Karel Zak <kzak@redhat.com>
Cc: util-linux@vger.kernel.org
Subject: Re: [PATCH] libfdisk: fix gpt for 32bit systems
Date: Thu, 6 Apr 2017 12:43:39 +0200 [thread overview]
Message-ID: <201704061243.39827.sweet_f_a@gmx.de> (raw)
In-Reply-To: <20170406102838.l6hz22ky3rtgdrew@ws.net.home>
On Thursday 06 April 2017, Karel Zak wrote:
> On Wed, Apr 05, 2017 at 07:58:00PM +0200, Ruediger Meier wrote:
> > > + ssz = read(cxt->dev_fd, ret, sz);
> >
> > The read(2) Linux manpage says: "If count is greater than SSIZE_MAX
> > (signed!), the result is unspecified."
> >
> > So maybe we should limit gpt_sizeof_ents() regarding SSIZE_MAX
> > rather than SIZE_MAX. I guess that even smwaller sizes would not be
> > possible to load into memory.
>
> OK, I have added SSIZE_MAX check before the read.
>
> > I'm also not sure that such big-reads (without using read() in a
> > loop) are portable at all.
>
> The area on disk is pretty small, and we read the entries array after
> header checksum verification. So, the read(2) should no be affected
> by corrupted disk and if someone has 44+ millions partitions then a
> random read(2) issue is probably the smallest issue in his live...
> (we can use read_all() from include/all-io.h, but I think it's
> overkill).
Yes, no real problem I guess. I'm just curious what would happen if we
have at least a few thousand partitions. Or whether we shouldn't make
the limit much smaller somehow to avoid OOM killer in case somebody
reads a corrupted gpt table.
BTW we could also generally add more tests for broken devices using
scsi_debug or libfiu. Maybe I will try this when I feel boring next
time. But I'm already stuck with these fuzzing tests.
cu,
Rudi
next prev parent reply other threads:[~2017-04-06 10:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-05 9:56 [PATCH] libfdisk: fix gpt for 32bit systems Ruediger Meier
2017-04-05 10:50 ` Karel Zak
2017-04-05 11:14 ` Ruediger Meier
2017-04-05 16:50 ` Karel Zak
2017-04-05 17:58 ` Ruediger Meier
2017-04-06 10:28 ` Karel Zak
2017-04-06 10:43 ` Ruediger Meier [this message]
2017-04-06 11:32 ` Karel Zak
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=201704061243.39827.sweet_f_a@gmx.de \
--to=sweet_f_a@gmx.de \
--cc=kzak@redhat.com \
--cc=util-linux@vger.kernel.org \
/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