Your message dated Tue, 28 Mar 2006 18:32:10 -0800
with message-id <[EMAIL PROTECTED]>
and subject line Bug#293722: fixed in grub 0.97-6
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--- Begin Message ---
Package: grub
Version: 0.95+cvs20040624-12
Severity: important

When using Linux 2.6.10, grub's 'install' command segfaults on new
hardware that has the NX bit available (e.g. AMD64, and I think also new
Pentium 4 systems). This turns out to be because:

  * grub's Unix shell allocates a region of memory part of which is used
    as a simulated stack;

  * the 'install' command uses a nested function which causes GCC to
    emit a stack trampoline requiring an executable stack;
    
  * malloc()ed memory is only PROT_READ|PROT_WRITE by default;

  * 2.6.10 sets noexec=on by default, thereby assuming that pages
    without PROT_EXEC set can be treated as non-executable, and this is
    enforced on hardware with the NX bit available.

The attached patch corrects this problem (tested), and I believe should
be harmless on older systems. Please apply. Most of it came from the
mprotect() man page and/or is probably too obvious/short to be
copyrightable, but if I need to sign an assignment to have this go
upstream then I'll be happy to do so.

Thanks,

-- 
Colin Watson                                       [EMAIL PROTECTED]
--- grub-0.95+cvs20040624.orig/grub/asmstub.c
+++ grub-0.95+cvs20040624/grub/asmstub.c
@@ -42,6 +42,12 @@
 #include <sys/time.h>
 #include <termios.h>
 #include <signal.h>
+#include <sys/mman.h>
+
+#include <limits.h>
+#ifndef PAGESIZE
+#define PAGESIZE 4096
+#endif
 
 #ifdef __linux__
 # include <sys/ioctl.h>                /* ioctl */
@@ -142,6 +148,22 @@
   assert (grub_scratch_mem == 0);
   scratch = malloc (0x100000 + EXTENDED_MEMSIZE + 15);
   assert (scratch);
+
+  {
+    char *p;
+    int ret;
+
+    /* Align to a multiple of PAGESIZE, assumed to be a power of two. */
+    p = (char *) (((long) scratch) & ~(PAGESIZE - 1));
+
+    /* The simulated stack needs to be executable, since GCC uses stack
+     * trampolines to implement nested functions.
+     */
+    ret = mprotect (p, 0x100000 + EXTENDED_MEMSIZE + 15,
+                   PROT_READ | PROT_WRITE | PROT_EXEC);
+    assert (ret == 0);
+  }
+
   grub_scratch_mem = (char *) ((((int) scratch) >> 4) << 4);
 
   /* FIXME: simulate the memory holes using mprot, if available. */

--- End Message ---
--- Begin Message ---
Source: grub
Source-Version: 0.97-6

We believe that the bug you reported is fixed in the latest version of
grub, which is due to be installed in the Debian FTP archive:

grub-disk_0.97-6_all.deb
  to pool/main/g/grub/grub-disk_0.97-6_all.deb
grub-doc_0.97-6_all.deb
  to pool/main/g/grub/grub-doc_0.97-6_all.deb
grub_0.97-6.diff.gz
  to pool/main/g/grub/grub_0.97-6.diff.gz
grub_0.97-6.dsc
  to pool/main/g/grub/grub_0.97-6.dsc
grub_0.97-6_i386.deb
  to pool/main/g/grub/grub_0.97-6_i386.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to [EMAIL PROTECTED],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Otavio Salvador <[EMAIL PROTECTED]> (supplier of updated grub package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [EMAIL PROTECTED])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.7
Date: Tue, 28 Mar 2006 23:12:45 -0300
Source: grub
Binary: grub-disk grub grub-doc
Architecture: source i386 all
Version: 0.97-6
Distribution: unstable
Urgency: low
Maintainer: Grub Maintainers <[EMAIL PROTECTED]>
Changed-By: Otavio Salvador <[EMAIL PROTECTED]>
Description: 
 grub       - GRand Unified Bootloader
 grub-disk  - GRUB bootable disk image
 grub-doc   - Documentation for GRand Unified Bootloader
Closes: 254475 293722 341106 341995 342590 353691 353725 355870 357286 357287
Changes: 
 grub (0.97-6) unstable; urgency=low
 .
   [ Otavio Salvador ]
   * Applied patch from Colin Watson <[EMAIL PROTECTED]> to fix segfaults
     in hardware that has NX bit available (amd64, for example).
     (closes: #293722)
   * Remove comment from grub-reboot since we'll have savedefault --once
     back :-D
   * Applied patch from Frans Pop <[EMAIL PROTECTED]> to invert
     convert_kernel26 logic. (closes: #353725)
   * Change build-dependencie for amd64. (closes: #357287, #357286)
 .
   [ Leandro Dorileo ]
   * Reimplementation of savedefault --once. Now it reads and writes to
     /boot/grub/default.
     (closes: #254475, #341106, #341995, #353691, #355870, #342590)
Files: 
 241ba38731a93b52a520ea3dc3f20446 934 admin optional grub_0.97-6.dsc
 3517a7dba99e920408be0bb07a38952d 61082 admin optional grub_0.97-6.diff.gz
 49a4681dab9378585420b2cc2722965a 365796 admin optional grub_0.97-6_i386.deb
 7383ad7d939fef98ed27c6a5aaecc365 236698 admin optional grub-disk_0.97-6_all.deb
 0d547baae2dedb1068bbd9f4d5808a2e 267276 doc optional grub-doc_0.97-6_all.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)

iD8DBQFEKe1wLqiZQEml+FURAvdSAKCAGvC1zW6IxMF/kFYPfTa45fHVkACePBLG
RsyrLitg8M+6iVUpejMJ0Lw=
=Q7wk
-----END PGP SIGNATURE-----


--- End Message ---

Reply via email to