All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Millan <rmh@aybabtu.com>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: Compiling grub2 on *BSD?
Date: Wed, 30 Jan 2008 15:00:17 +0100	[thread overview]
Message-ID: <20080130140017.GA16576@thorin> (raw)
In-Reply-To: <1201701103.17791.9.camel@k9.localnet>

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
functions:

void
__sysctl (void)
{
}

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	other threads:[~2008-01-30 14:01 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-26 17:08 Compiling grub2 on *BSD? walt
2008-01-26 17:21 ` Robert Millan
2008-01-26 18:15   ` Bean
2008-01-28 10:14     ` Bean
2008-01-28 10:47       ` Robert Millan
2008-01-28 11:15         ` Bean
2008-01-28 12:56         ` Marco Gerards
2008-01-29 11:00           ` Bean
2008-01-26 20:11   ` walt
2008-01-27  8:56     ` Robert Millan
2008-01-29  5:30       ` jakllsch
2008-01-29 13:47         ` Robert Millan
2008-01-30  0:37           ` jakllsch
2008-01-30  8:56             ` Marco Gerards
2008-01-30 13:23             ` Robert Millan
2008-01-30 13:51               ` walt
2008-01-30 14:00                 ` Robert Millan [this message]
2008-01-30 16:38                   ` walt
2008-01-30 18:40                     ` Robert Millan
2008-01-30 19:06                     ` walt
2008-01-30 19:14                       ` Robert Millan
2008-01-30 21:55                       ` jakllsch
2008-01-31 11:03                         ` Robert Millan
2008-02-01 21:11                           ` walt
2008-02-01 21:38                             ` Robert Millan
2008-02-04 15:32                             ` Marco Gerards

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080130140017.GA16576@thorin \
    --to=rmh@aybabtu.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.