grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compiling grub2 on *BSD?


From: walt
Subject: Re: Compiling grub2 on *BSD?
Date: Wed, 30 Jan 2008 05:51:43 -0800

On Wed, 2008-01-30 at 14:23 +0100, Robert Millan wrote:
> On Tue, Jan 29, 2008 at 06:37:50PM -0600, address@hidden wrote:
> > > > > > /usr/lib/libgcc.a(_enable_execute_stack.o): In function
> > > > > > `__enable_execute_stack':
> > > > > > _enable_execute_stack.c:(.text+0x40): undefined reference to 
> > > > > > `__sysctl'
> > > > > > _enable_execute_stack.c:(.text+0x6f): undefined reference to 
> > > > > > `mprotect'
> > > > > > 
> > > > > > Both of those symbols are defined in libc.a, so I included that, 
> > > > > > too.
> > > > > > Any ideas?
> > > > > 
> > > > > Do you see this line in ./configure ?
> > > > > 
> > > > >   checking whether `gcc' accepts `-fstack-protector'... yes
> > > > 
> > > > Yes.
> > > > 
> > > > Apparently -fno-stack-protector doesn't actually work the way
> > > > I/we would expect.
> > > > 
> > > > But, I'm surprised that this doesn't affect the building
> > > > of NetBSD's own 'stand' code.
> > > 
> > > Maybe we need another flag?  Could you check the link command in NetBSD's
> > > kernel ?
> > 
> > I couldn't find anything that looked like it would fix this.
> > 
> > I believe the reason that NetBSD's own code isn't affected by this is
> > because they (apparently) do not use nested functions in
> > their stand-alone code.
> 
> Ok, so we need __enable_execute_stack then, I guess.  I find it strange that
> some parts of libgcc can not be used in freestanding code.  Does this happen
> with the unpatched version of GCC too?
> 
> Maybe we'll have add some dummy symbols to make it happy.  I don't think
> any of this will be actually needed when kernel isn't present.

I don't understand much of the above, but I did find this comment in the
NetBSD manpage for gcc:

In traditional UNIX systems, the signal trampoline, also referred to as
the ``sigcode'', is provided by the kernel and copied to the top of the
user's stack when a new process is created or a new program image is
exec'd.

Starting in NetBSD 2.0, the signal trampoline is provided by the system
C library.  This allows for more flexibility when the signal facility 
is extended, makes dealing with signals easier in debuggers, such as 
gdb(1), and may also enhance system security by allowing the kernel to 
disallow execution of code on the stack.

The signal trampoline is specified on a per-signal basis.  The correct
trampoline is selected automatically by the C library when a signal
handler is registered by a process.







reply via email to

[Prev in Thread] Current Thread [Next in Thread]