Skip to contentSkip to conversation

silo fails to build with recent ext2fs libraries

DISCUSSION Jurij Smakov 3 participants 11 messages Jan 15, 2012 – Jan 23, 2012

lore
Share & tools
lore
#0 lore raw

Hello,

Recently I've discovered that silo fails to build with recent ext2fs libraries. Debian bug report [0] shows the relevant part of the build log. Someone also reported the same problem on gentoo forum just a few days ago [1].

As far as I can understand, the problem arises because newer ext2fs library versions introduced additional symbols, depending on libc functions not implemented in silo, into the same object files which contain the symbols used by the second stage. Since linker operates on object file level, it pulls in these symbols along with needed ones, then fails to resolve their dependencies because they are not implemented in silo and we are not linking against libc.

I was hoping that I can create a reduced ext2fs library containing only necessary symbols, but later recognized that this would require compiling and maintaining an explicit list of such symbols and their dependencies, which would be pretty tedious and error prone. I've also tried pruning the symbols causing the failure from the original library, however it's not possible in some cases, as some of them are mentioned in relocation entries. Another option would be to start linking against libc to work around this problem, but I don't know why it was not done in the first place, some size constraints perhaps?

[0] http://bugs.debian.org/655897
[1] http://forums.gentoo.org/viewtopic-p-6923830.html?sidtbeb3b8188dd2e6f33a39b6503479c4

Best regards,

Signature · 2 lines
Jurij Smakov                                           [email protected]
Key: http://www.wooyd.org/pgpkey/                      KeyID: C99E03CC
#1 lore raw

From: Jurij Smakov <[email protected]>
Date: Sun, 15 Jan 2012 14:09:39 +0000

Quoted 3 lines

Another option would be to start linking against libc to work around this problem, but I don't know why it was not done in the first place, some size constraints perhaps?

Not only size, but you then have to audit every symbol libext2fs uses in libc to make sure the code in libc doesn't directly or indirectly do system calls or other things we can't support in the context of SILO's execution environment.

That's why I suggest we just keep adding whatever routines libext2fs wants into SILO. That way we can audit what it wants, explicitly, and know that our implementation won't have unwanted dependencies upon executing in a real userland environment.

#2 lore raw
In reply to Jurij Smakov

From: Jurij Smakov <[email protected]>
Date: Sun, 15 Jan 2012 14:09:39 +0000

Quoted 4 lines

Recently I've discovered that silo fails to build with recent ext2fs libraries. Debian bug report [0] shows the relevant part of the build log. Someone also reported the same problem on gentoo forum just a few days ago [1].

First of all, the sources used in that package are out of date, current SILO in GIT has a posix_memalign() and it was added exactly one year ago.

So that part of the build failure is just due to an out of date copy of the SILO sources.

I'm looking into the rest.

#3 lore raw
In reply to Jurij Smakov

From: David Miller <[email protected]>
Date: Tue, 17 Jan 2012 12:56:56 -0500 (EST)

Quoted 1 line

I'm looking into the rest.

So just adding the stubs (or your idea, linking with libc) doesn't work at all.

All the new features in libext2 that get linked in cause the second stage bootloader image to grow too large.

I'll just have to extract the parts of libext2 that we actually need into a stripped down local copy in SILO and I guess this will make us immune to this issue showing up again in the future.

#4 lore raw
In reply to Jurij Smakov
Quoted 8 lines · David Miller

From: David Miller <[email protected]>
Date: Tue, 17 Jan 2012 12:56:56 -0500 (EST)

Quoted 1 line

I'm looking into the rest.

So just adding the stubs (or your idea, linking with libc) doesn't work at all.

Quoted 6 lines

All the new features in libext2 that get linked in cause the second stage bootloader image to grow too large.

I'll just have to extract the parts of libext2 that we actually need into a stripped down local copy in SILO and I guess this will make us immune to this issue showing up again in the future.

Would it make sense to get Grub working on Sparc so we can abandon SILO and reduce our maintenance burden to just the Sparc-specific parts of Grub?

Thanks,

Signature · 5 lines
Julian Calaby

Email: [email protected]
Profile: http://www.google.com/profiles/julian.calaby/
.Plan: http://sites.google.com/site/juliancalaby/
#5 lore raw
In reply to Jurij Smakov
Quoted 8 lines · David Miller

From: David Miller <[email protected]>
Date: Tue, 17 Jan 2012 12:56:56 -0500 (EST)

Quoted 1 line

I'm looking into the rest.

So just adding the stubs (or your idea, linking with libc) doesn't work at all.

Quoted 6 lines

All the new features in libext2 that get linked in cause the second stage bootloader image to grow too large.

I'll just have to extract the parts of libext2 that we actually need into a stripped down local copy in SILO and I guess this will make us immune to this issue showing up again in the future.

If you haven't put too much effort into it yet, can you give me a few days to experiment with dropping unnecessary symbols from the built library using objcopy? If it turns out to be simple, I'd rather use this than duplicating code.

Best regards,

Signature · 2 lines
Jurij Smakov                                           [email protected]
Key: http://www.wooyd.org/pgpkey/                      KeyID: C99E03CC
#6 lore raw
In reply to Jurij Smakov

From: Julian Calaby <[email protected]>
Date: Wed, 18 Jan 2012 08:51:01 +1100

Quoted 12 lines · David Miller
Quoted 11 lines

From: David Miller <[email protected]>
Date: Tue, 17 Jan 2012 12:56:56 -0500 (EST)

Quoted 1 line

I'm looking into the rest.

So just adding the stubs (or your idea, linking with libc) doesn't work at all.

All the new features in libext2 that get linked in cause the second stage bootloader image to grow too large.

Quoted 7 lines
Quoted 3 lines

I'll just have to extract the parts of libext2 that we actually need into a stripped down local copy in SILO and I guess this will make us immune to this issue showing up again in the future.

Would it make sense to get Grub working on Sparc so we can abandon SILO and reduce our maintenance burden to just the Sparc-specific parts of Grub?

The sparc64 port is already in there and mostly works but it needs tons of bug fixing and testing.

However the GRUB maintainer is a prick and there is a lot of infighting in the project so I stopped doing GRUB work a very long time ago.

For the time being it's quicker to do add a quick piece of ext2 r/o support code to SILO, and that's what I'm already working on.

#7 lore raw
In reply to Jurij Smakov

From: Jurij Smakov <[email protected]>
Date: Wed, 18 Jan 2012 00:20:08 +0000

Quoted 12 lines · David Miller
Quoted 11 lines

From: David Miller <[email protected]>
Date: Tue, 17 Jan 2012 12:56:56 -0500 (EST)

Quoted 1 line

I'm looking into the rest.

So just adding the stubs (or your idea, linking with libc) doesn't work at all.

All the new features in libext2 that get linked in cause the second stage bootloader image to grow too large.

Quoted 8 lines
Quoted 3 lines

I'll just have to extract the parts of libext2 that we actually need into a stripped down local copy in SILO and I guess this will make us immune to this issue showing up again in the future.

If you haven't put too much effort into it yet, can you give me a few days to experiment with dropping unnecessary symbols from the built library using objcopy? If it turns out to be simple, I'd rather use this than duplicating code.

We've been fighting this problem for years, it only gets worse and all of these various hacks are error prone.

The only real solution is to write something made for a bootloader and that's what I'm already doing. The code isn't that hard at all.

#8 lore raw
In reply to Jurij Smakov
Quoted 19 lines · David Miller

From: Julian Calaby <[email protected]>
Date: Wed, 18 Jan 2012 08:51:01 +1100

Quoted 16 lines · David Miller
Quoted 14 lines

From: David Miller <[email protected]>
Date: Tue, 17 Jan 2012 12:56:56 -0500 (EST)

Quoted 1 line

I'm looking into the rest.

So just adding the stubs (or your idea, linking with libc) doesn't work at all.

All the new features in libext2 that get linked in cause the second stage bootloader image to grow too large.

I'll just have to extract the parts of libext2 that we actually need into a stripped down local copy in SILO and I guess this will make us immune to this issue showing up again in the future.

Quoted 6 lines
Quoted 3 lines

Would it make sense to get Grub working on Sparc so we can abandon SILO and reduce our maintenance burden to just the Sparc-specific parts of Grub?

The sparc64 port is already in there and mostly works but it needs tons of bug fixing and testing.

As everything does.

Quoted 3 lines

However the GRUB maintainer is a prick and there is a lot of infighting in the project so I stopped doing GRUB work a very long time ago.

But it's a GNU project, surely it's full of fairies and unicorns and rainbows! .... </sarcasm>

Quoted 2 lines

For the time being it's quicker to do add a quick piece of ext2 r/o support code to SILO, and that's what I'm already working on.

Fair enough.

Thanks,

Signature · 5 lines
Julian Calaby

Email: [email protected]
Profile: http://www.google.com/profiles/julian.calaby/
.Plan: http://sites.google.com/site/juliancalaby/
#9 lore raw
In reply to Jurij Smakov
Quoted 6 lines · David Miller

We've been fighting this problem for years, it only gets worse and all of these various hacks are error prone.

The only real solution is to write something made for a bootloader and that's what I'm already doing. The code isn't that hard at all.

All right, I'll be watching git tree for commits then :-).

Thanks for taking care of this.

Signature · 2 lines
Jurij Smakov                                           [email protected]
Key: http://www.wooyd.org/pgpkey/                      KeyID: C99E03CC
#10 lore raw
In reply to Jurij Smakov

From: Jurij Smakov <[email protected]>
Date: Wed, 18 Jan 2012 19:53:33 +0000

Quoted 11 lines · David Miller
Quoted 6 lines

We've been fighting this problem for years, it only gets worse and all of these various hacks are error prone.

The only real solution is to write something made for a bootloader and that's what I'm already doing. The code isn't that hard at all.

All right, I'll be watching git tree for commits then :-).

Thanks for taking care of this.

Ok, I commited my work, but be careful.

I tested it on a SunBlade-2500 running squeeze, with disks on the onboard MPT Fusion controller.

Make backups and have a way to netboot or CD boot your test machine if things go wrong.

Let me know how it goes.