[LinuxBIOS] patch: extending LAR, and removing elf from linuxbios (it is not needed)

Carl-Daniel Hailfinger c-d.hailfinger.devel.2006 at gmx.net
Tue Aug 28 17:26:38 CEST 2007


On 28.08.2007 17:12, ron minnich wrote:
> On 8/28/07, Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net> wrote:
> 
>> Can we change the MAGIC to some less likely string, perhaps even with
>> version info? A lot of filesystems have mixed-case magic strings, for
>> example ReiserFS has "ReIsErFs" or "ReIsEr2Fs" or "ReIsEr3Fs". Nobody is
>> going to include such a string by accident in his code.
> 
> That's not the real problem. The real problem is that if you do this:
> char *c = MAGIC;
> 
> Then that string is in the data space of linuxbois. If it ever gets to
> be 16-byte aligned, the find_file in lar will think it has found  a
> header. I just realized stefan's fix might solve the problem. But we
> can add his fix later.

Can't we do that in an easier way? Idea:
struct {
	char misalign[1];
        char magic[8];
} lar_magic __attribute__ ((aligned(16))) = {
	0, "LARCHIVE"
};

That should guarantee the string to be always misaligned.

Regards,
Carl-Daniel




More information about the coreboot mailing list