Page MenuHomeFreeBSD

Revert revision 254095
ClosedPublic

Authored by marcel on Mar 3 2019, 6:13 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 5 2024, 10:40 AM
Unknown Object (File)
Jan 16 2024, 6:09 PM
Unknown Object (File)
Dec 20 2023, 4:05 AM
Unknown Object (File)
Dec 19 2023, 5:36 AM
Unknown Object (File)
Dec 11 2023, 3:01 AM
Unknown Object (File)
Nov 15 2023, 1:54 AM
Unknown Object (File)
Nov 5 2023, 1:45 AM
Unknown Object (File)
Oct 19 2023, 3:23 AM
Subscribers

Details

Summary

In revision 254095, gpt_entries is not set to match the on-disk
hdr_entries, but rather is computed based on available space.
There are 2 problems with this:

  1. The GPT backend respects hdr_entries and only reads and writes that number of partition entries. On top of that, CRC32 is computed over the table that has hdr_entries elements. When the common code works on what is possibly a larger number, the behaviour becomes inconsistent and problematic. In particular, it would be possible to add a new partition that on a reboot isn't there anymore.
  2. The calculation of gpt_entries is based on flawed assumptions. The GPT specification does not dictate that sectors are layed out in a particular way that the available space can be determined by looking at LBAs. In practice, implementations do the same thing, because there's no reason to do it any other way. Still, GPT allows certain freedoms that can be exploited in some form or shape if the need arises.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

I have no objection. AFAIR, the main goal of this change was the adding ability to extend number of entries for some tables, that have very little number of partition entries, e.g. 1 or 2.
I think if you revert this change, then you will not able to add new partitions for these tables, even if there are enough space to keep them.

This revision was not accepted when it landed; it landed in state Needs Review.Mar 5 2019, 4:15 AM
Closed by commit rS344790: Revert revision 254095 (authored by marcel). · Explain Why
This revision was automatically updated to reflect the committed changes.
In D19438#416304, @ae wrote:

I have no objection. AFAIR, the main goal of this change was the adding ability to extend number of entries for some tables, that have very little number of partition entries, e.g. 1 or 2.
I think if you revert this change, then you will not able to add new partitions for these tables, even if there are enough space to keep them.

Yeah, my bug report (bug 229977) was about adding new partitions to a memstick image with 2 partitions. The new partition would get created in memory, but would silently disappear after a reboot (i.e. wouldn't persist), which was extremely surprising and unexpected.