sparc64 + grsec (kernel 2.6.18.1-cks1)

Discuss and suggest new grsecurity features

sparc64 + grsec (kernel 2.6.18.1-cks1)

Postby jimdigriz » Mon Oct 16, 2006 2:57 pm

Hi,

Obviously someone does not have a sparc64 :)

==============
alex@woodchuck:/usr/src/linux-2.6.18$ make
CHK include/linux/version.h
CHK include/linux/utsrelease.h
CC arch/sparc64/kernel/asm-offsets.s
cc1: error: invalid option `medlow'
cc1: error: unrecognized option `-Wextra'
make[1]: *** [arch/sparc64/kernel/asm-offsets.s] Error 1
make: *** [prepare0] Error 2
===============

This turns out to be due to the diff hunk from grsecurity-2.1.9-2.6.18-200610021833.patch.gz

===============
+++ linux-2.6.18/Makefile 2006-09-22 20:45:03.000000000 -0400
@@ -307,7 +307,7 @@ LINUXINCLUDE := -Iinclude \

CPPFLAGS := -D__KERNEL__ $(LINUXINCLUDE)

-CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
+CFLAGS := -Wall -Wextra -Wno-unused -Wno-sign-compare -Wundef -Wstrict-prototypes -Wno-trigraphs \
-fno-strict-aliasing -fno-common
AFLAGS := -D__ASSEMBLY__

@@ -552,7 +552,7 @@ export mod_strip_cmd
================

The sparc64 branch (/usr/src/linux/arch/sparc64/) uses '-mmedlow' to detect if we are running a new or old version of GCC, by adding '-Wextra' things explode horribly and its impossible to compile a kernel.

Any chance of removing this?

Cheers

Alex

BTW sorry if this is a duplicate bug report, I could not find anything in the forum
jimdigriz
 
Posts: 3
Joined: Mon Oct 16, 2006 2:51 pm

Re: sparc64 + grsec (kernel 2.6.18.1-cks1)

Postby PaX Team » Mon Oct 16, 2006 7:04 pm

jimdigriz wrote:Obviously someone does not have a sparc64 :)
we actually have a sparc64, you're being served this from one, it's just that we don't actually use 2.6 for anything critical.
Any chance of removing this?
does it compile if you rename -Wextra to -W (its old name, pre gcc 3.4 i think)? thing is, there're several useful reports from -Wextra, i'd like to keep it in the future.
PaX Team
 
Posts: 2310
Joined: Mon Mar 18, 2002 4:35 pm

Postby jimdigriz » Tue Oct 17, 2006 4:08 am

> we actually have a sparc64, you're being served this from one,
> it's just that we don't actually use 2.6 for anything critical.
>
okay :)

> does it compile if you rename -Wextra to -W (its old name,
> pre gcc 3.4 i think)? thing is, there're several useful reports
> from -Wextra, i'd like to keep it in the future.
>
We are using Debian Stable so its GCC 3.3 (.5).

Still pukes, but in a different manner:
============
alex@woodchuck:/usr/src/linux-2.6.18$ make
CHK include/linux/version.h
CHK include/linux/utsrelease.h
CHK include/linux/compile.h
CC arch/sparc64/kernel/setup.o
arch/sparc64/kernel/setup.c:64: warning: missing initializer
arch/sparc64/kernel/setup.c:64: warning: (near initialization for `screen_info.lfb_width')
arch/sparc64/kernel/setup.c:220: warning: missing initializer
arch/sparc64/kernel/setup.c:220: warning: (near initialization for `fake_swapper_regs.fprs')
make[1]: *** [arch/sparc64/kernel/setup.o] Error 1
make: *** [arch/sparc64/kernel] Error 2
============

This is after the usual 'make distclean', and the above is the second run of 'make' just to remove the unnecessary verbose output.

Looks like it might be easier to do (straight from Documentation/kbuild/makefiles.txt):
=============
CFLAGS := -Wall -Wno-unused -Wno-sign-compare -Wundef -Wstrict-prototypes -Wno-trigraphs \
-fno-strict-aliasing -fno-common
CFLAGS += $(shell \
if [ $(call cc-version) -ge 0304 ] ; then \
echo "-Wextra"; fi ;)
=============

Cheers
jimdigriz
 
Posts: 3
Joined: Mon Oct 16, 2006 2:51 pm

Postby Hal9000 » Tue Oct 17, 2006 10:44 am

are you aware that you tried to patch the 2.6.18.1 kernel with the patch for 2.6.18?
try this patch: http://www.grsecurity.net/~paxguy1/grse ... 0140.patch
hal
Hal9000
 
Posts: 78
Joined: Wed Jun 16, 2004 2:40 am

Postby jimdigriz » Tue Oct 17, 2006 12:11 pm

> are you aware that you tried to patch the 2.6.18.1
> kernel with the patch for 2.6.18?
>
erm....failed hunks are not mind boggling difficult to fix. 'patch' spits out the failed diff chunk in a unified context which is pretty human readable and nine times out of ten its a very trivial issue.

The only 'iffy' failed hunk in the patch I used hit /arch/i386 which does not affect the sparc64 architecture :P Its like a failed hunk on a fibre channel card, you personally do not care if you don't actually use fibre channel and can ignore the failed hunk.

If you look at the thread the issue is with the '-Wextra' flag being passed to gcc pre-3.4....or at least thats my take on it. This is why when my suggestion is applied it works dandly, of course there is question if its the 'right' thing to do.

Cheers

==========
[edit for the 'record' and all :P]

Applied the 'new' patch, a 'make -j2' spits out:

[snipped]
GEN usr/initramfs_data.cpio.gz
AS usr/initramfs_data.o
LD usr/built-in.o
CC arch/sparc64/kernel/process.o
CC arch/sparc64/kernel/setup.o
arch/sparc64/kernel/setup.c:64: warning: missing initializer
arch/sparc64/kernel/setup.c:64: warning: (near initialization for `screen_info.lfb_width')
arch/sparc64/kernel/setup.c:220: warning: missing initializer
arch/sparc64/kernel/setup.c:220: warning: (near initialization for `fake_swapper_regs.fprs')
make[1]: *** [arch/sparc64/kernel/setup.o] Error 1
make: *** [arch/sparc64/kernel] Error 2
alex@woodchuck:/usr/src/moo/linux-2.6.18$

I notice the 'new' patch uses '-W' instead of '-Wextra' and the effect of this is described earlier in the thread.

Cheers for the suggestion anyhows, its always worth covering the simple cases....its just this is not one of them ;P
==========
jimdigriz
 
Posts: 3
Joined: Mon Oct 16, 2006 2:51 pm

Postby PaX Team » Tue Oct 17, 2006 7:10 pm

jimdigriz wrote:> does it compile if you rename -Wextra to -W (its old name,
> pre gcc 3.4 i think)? thing is, there're several useful reports
> from -Wextra, i'd like to keep it in the future.
>
We are using Debian Stable so its GCC 3.3 (.5).

Still pukes, but in a different manner:
============
alex@woodchuck:/usr/src/linux-2.6.18$ make
CHK include/linux/version.h
CHK include/linux/utsrelease.h
CHK include/linux/compile.h
CC arch/sparc64/kernel/setup.o
arch/sparc64/kernel/setup.c:64: warning: missing initializer
arch/sparc64/kernel/setup.c:64: warning: (near initialization for `screen_info.lfb_width')
arch/sparc64/kernel/setup.c:220: warning: missing initializer
arch/sparc64/kernel/setup.c:220: warning: (near initialization for `fake_swapper_regs.fprs')
make[1]: *** [arch/sparc64/kernel/setup.o] Error 1
make: *** [arch/sparc64/kernel] Error 2
this is due to -Werror added in some sparc64 Makefiles, so that means either fixing the problems or removing either of -W or -Werror ;-).
PaX Team
 
Posts: 2310
Joined: Mon Mar 18, 2002 4:35 pm


Return to grsecurity development

cron