Page MenuHomeFreeBSD

loader: chain load relocate data declaration is bad
ClosedPublic

Authored by tsoome on Jun 23 2017, 9:12 AM.
Tags
None
Referenced Files
F82140677: D11321.diff
Thu, Apr 25, 9:27 PM
Unknown Object (File)
Sun, Apr 7, 6:03 PM
Unknown Object (File)
Wed, Apr 3, 7:24 AM
Unknown Object (File)
Dec 20 2023, 4:29 AM
Unknown Object (File)
Nov 26 2023, 1:36 AM
Unknown Object (File)
Nov 11 2023, 12:55 AM
Unknown Object (File)
Nov 6 2023, 7:15 AM
Unknown Object (File)
Oct 23 2023, 1:08 AM
Subscribers

Details

Summary

The implementation is using fixed size array allocated in asm module,
need to use proper array declaration for C source.

CID 1376405 - Memory corruption.

Diff Detail

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

Event Timeline

kib added inline comments.
sys/boot/i386/libi386/libi386.h
78 ↗(On Diff #29986)

If you explicitely specify array size in the extern declaration, you do not need relocater_size and can use nitems(). In revertse, if you use relocater_size, [] is enough in extern declaration. The later has the benefit of automatically catching updates.

Why it is relocatEr and not relocator ?

sys/boot/i386/libi386/libi386.h
78 ↗(On Diff #29986)

Yep, and in any case both will do for declaration.

The E versus O, I actually do not mind either way really - this code was written quite some time ago, considering the variables below, I probably just did mix up;)

Anyhow, I'll collect more feedback and then will likely have some update - the same bits are posted for illumos review.

This revision is now accepted and ready to land.Jun 23 2017, 3:08 PM
tsoome edited edge metadata.

Use the struct based array.

This revision now requires review to proceed.Jun 28 2017, 6:27 PM
sys/boot/i386/libi386/libi386.h
77 ↗(On Diff #30184)

Should this still be an array, or just a singular struct or struct pointer?

sys/boot/i386/libi386/libi386.h
77 ↗(On Diff #30184)

Ah right, I keep forgetting.. This feature actually has secondary consumer as well - but I haven't yet set the change/review up; the secondary consumer is the syslinux based software support - like freedos boot image with firmware update tools and things like that - and the extra slots are for it. If it is clear that we do not care about such functionality for freebsd, then it is reasonable to have just one structure instance. Otherwise the syslinux load needs all 3 slots.

This revision is now accepted and ready to land.Jun 28 2017, 11:37 PM
This revision was automatically updated to reflect the committed changes.