[Top][All Lists]

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

Re: Compiling grub2 on *BSD?

From: Robert Millan
Subject: Re: Compiling grub2 on *BSD?
Date: Wed, 30 Jan 2008 15:00:17 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

On Wed, Jan 30, 2008 at 05:51:43AM -0800, walt wrote:
> > 
> > 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.

This seems to be related to kernel<->user interaction.  Not much of our
concern I think.

Our problem, AFAICT, is that gcc/libgcc in NetBSD wants to rely on system
facilities to enable executable stack, but that operation is unnecessary
for freestanding code (unless someone setup paging and the NX bit?).

What happens if you define the missing symbols somewhere?  Any part of
the GRUB kernel will do (e.g. kern/main.c).  Just add them as empty

__sysctl (void)

mprotect (void)

and check if that works.

Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call… if you are unable to speak?
(as seen on /.)

reply via email to

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