Summary: | sys-boot/grub-0.97 segfaults with >=sys-devel/gcc-4.1 SSP | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Magnus Granberg <zorry> |
Component: | Hardened | Assignee: | Gentoo's Team for Core System packages <base-system> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | hardened, netbox253 |
Priority: | High | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
URL: | http://hardened.gentooexperimental.org/trac/secure/ticket/20 | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: |
emerge --info
Fix the segfault on grub with gcc > 4.* and SSP Isolates where the problem occurs Use va_list, va_start, va_arg instead of dataptr++ for variadic functions |
Description
Magnus Granberg
![]() Created attachment 199500 [details]
emerge --info
The patch is on the URL ticket. Magnus, thank you for filing this bug. Please attach the patch here too. In the future should inline emerge --info rather than attach it. Created attachment 200565 [details, diff]
Fix the segfault on grub with gcc > 4.* and SSP
Is that patch okey? Created attachment 219567 [details]
Isolates where the problem occurs
The problem occurs in the grub_printf function between lines 179 to 214 in char_io.c. The attachment works as expected on non-hardened systems but fails on hardened with a seg fault.
Created attachment 219645 [details, diff]
Use va_list, va_start, va_arg instead of dataptr++ for variadic functions
The above patch removes all instances of dataptr in favor of va_list, va_start, va_arg. (Thank you klondike.) You have to make sure that stdarg.h is in the include path when compiling, so use something like -I/usr/lib64/gcc/x86_64-pc-linux-gnu/4.4.3/include. It fixes the seg fault.
that looks much saner ... thanks for looking into it guys ive queued the patch in the grub dir, but i'm not going to push out -r10 because there is a patch (300_all_grub-0.97-pie-safety.patch) that needs addressing first in bug 139277 -r10 was stabilized today, and grub segfaults in the same way. But this bug is marked as fixed ? +1 with netfab This bug need to be reopened for 0.97-r10 version. (In reply to comment #10) > +1 with netfab > This bug need to be reopened for 0.97-r10 version. > This bug is about -fstack-protector(-all) thats in newer >=gcc-4.1, that we enable in newer >=gcc-4.4.3-r3 in the hardenede profile so it don't have any thing to do with that error. For i can't get -r10 to segfault that way in the hardened profile. The sefault look the same but is not the same error. netfab is on default profile and have gcc-4.4.3-r2, He do not hit this error with -fstack-protector(-all). Will have this bug as fixed. |