Skip to contentSkip to conversation

modules size in mkimage

DISCUSSION Andrei Borzenkov 2 participants 4 messages Oct 31, 2015 – Nov 4, 2015

lore
Share & tools
lore
#0 lore raw

mkimage sets module size to aligned value; later it is used to actually process it which /may/ lead to inconsistency (as any comparison is against stored aligned size, not actual module size).

Same applies to all other embedded types actually. The only one that does it right is pubkey.

Just to make sure I do not miss something obvious; otherwise I'll make a patch.

#1 lore raw
Quoted 2 lines · Andrei Borzenkov

mkimage sets module size to aligned value; later it is used to actually

process it which /may/ lead to inconsistency (as any comparison is against stored aligned size, not actual module size).

Quoted 1 line

Which inconsistency do you have in mind?

Quoted 1 line

Same applies to all other embedded types actually. The only one that does

it right is pubkey.

Quoted 2 lines

Just to make sure I do not miss something obvious; otherwise I'll make a

patch.

Quoted 5 lines

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel

#2 lore raw

04.11.2015 14:21, Vladimir 'phcoder' Serbinenko пишет:

Quoted 7 lines · Andrei Borzenkov
Quoted 2 lines

mkimage sets module size to aligned value; later it is used to actually

process it which /may/ lead to inconsistency (as any comparison is against stored aligned size, not actual module size).

Quoted 1 line

Which inconsistency do you have in mind?

  if (size < e->e_shoff + e->e_shentsize * e->e_shnum)
    {
      grub_error (GRUB_ERR_BAD_OS, "ELF sections outside core");
#3 lore raw
Quoted 4 lines · Andrei Borzenkov

04.11.2015 14:21, Vladimir 'phcoder' Serbinenko пишет:

Quoted 1 line

Le 31 oct. 2015 8:02 AM, "Andrei Borzenkov" <[email protected]> a

écrit :

Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

mkimage sets module size to aligned value; later it is used to actually

process it which /may/ lead to inconsistency (as any comparison is

against

Quoted 10 lines
Quoted 4 lines

stored aligned size, not actual module size).

Quoted 2 lines

Which inconsistency do you have in mind?

  if (size < e->e_shoff + e->e_shentsize * e->e_shnum)
    {
      grub_error (GRUB_ERR_BAD_OS, "ELF sections outside core");

This is just to avoid accessing unallocated data. In this case the memory is allocated. So it's a minor issue. I'm more concerned with some module iterator breaking

Quoted 8 lines

_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel