[syslinux] Using *Syslinux 6.02* on *BTRFS* volumes corrupts the superblock.

H. Peter Anvin
2013-10-16T16:00:03Z

On 10/15/2013 01:40 PM, Raphael S Carvalho wrote:
> BTRFS file systems will be corrupted on 6.02 (mainstream) and some
> previous versions.
>
> DYNAMIC_DEBUG makes the core larger than the allowed.
> Even before its introduction, building Syslinux with DEBUG_PORT
> enabled would probably corrupt BTRFS images (IIRC) *if* ldlinux.sys
> surpasses the maximum allowed size.
>
> Besides, the installer isn't safe at all... The check could be easily
> made there to avoid overwriting BTRFS superblocks. It simply install
> ldlinux.sys blindly even when it could be done otherwise (Not good in
> my opinion).
>
> I compiled Syslinux with several options in order to analyze how the
> size of ldlinux.sys behaves. Follow the log:
>
> DYNAMIC_DEBUG DISABLED & DEBUG_PORT DISABLED:  60474 bytes
> DYNAMIC_DEBUG ENABLED & DEBUG_PORT DISABLED: 67114 bytes
> DYNAMIC_DEBUG DISABLED & DEBUG_PORT ENABLED: 65673 bytes
> DYNAMIC_DEBUG ENABLED & DEBUG_PORT ENABLED: 65774 bytes
>
> PS: ldlinux.sys can currently be at most 64000 bytes (ADV_SIZE: 512).
> PS: Strangely, '*DYNAMIC_DEBUG ENABLED* WITH *DEBUG_PORT DISABLED*'
> makes the core larger than with both options enabled.
>
> Any comments on the matter *or not =) * would be really appreciated.
> --
> Raphael S. Carvalho
>

We should error out the build if ldlinux.sys is too large, this is
something that is in the works I believe.  But yes, an extra check in
the installer would not be a bad thing.

With DEBUG_PORT disabled, the debug output goes to the primary console,
which requires a bit more code.

	-hpa