FS#45320 - [linux-grsec] Compilation with gcc 5.1.0 doesn't work

Attached to Project: Community Packages
Opened by Jean (rfnx) - Saturday, 13 June 2015, 19:05 GMT
Last edited by Daniel Micay (thestinger) - Friday, 19 June 2015, 13:54 GMT
Task Type Bug Report
Category Upstream Bugs
Status Closed
Assigned To Daniel Micay (thestinger)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Hello,

Description:
When I try to compile this kernel with gcc 5.1.0, an error occurs during the compilation. It stops on this line :

"
[...]
CC [M] drivers/net/wireless/rtlwifi/rtl8821ae/sw.o
CC [M] drivers/net/wireless/rtlwifi/rtl8821ae/table.o
CC [M] drivers/net/wireless/rtlwifi/rtl8821ae/trx.o
LD [M] drivers/net/wireless/rtlwifi/rtl8723ae/rtl8723ae.o
LD [M] drivers/net/wireless/rtlwifi/rtl8821ae/rtl8821ae.o
LD drivers/net/wireless/built-in.o
LD drivers/net/built-in.o
Makefile:1019: recipe for target 'drivers' failed
make: *** [drivers] Error 2
==> ERROR: A failure occurred in build().
Aborting...
"


Additional info:
* package version(s) : linux-grsec 4.0.5.201506082251-1
* config and/or log files etc.


Steps to reproduce:
-Update gcc to last version (currently 5.1.0)
-Try to compile this kernel
-Error during compilation
This task depends upon

Closed by  Daniel Micay (thestinger)
Friday, 19 June 2015, 13:54 GMT
Reason for closing:  Fixed
Additional comments about closing:  4.0.5.201506171322-1
Comment by Daniel Micay (thestinger) - Sunday, 14 June 2015, 02:08 GMT
The SIZE_OVERFLOW plugin doesn't work with GCC 5.1 yet so you need to use an older GCC version if the configuration option for it is enabled. The GCC plugin API is not stable, so this is a regular occurrence on major releases of GCC. It's not something that I'm going to work around in the package. It wouldn't make much sense to create a package for the old GCC version after nearly every major release and switch this to it, only to delete it after a few days / weeks.
Comment by Jean (rfnx) - Sunday, 14 June 2015, 03:06 GMT
Thank you for your answer, but I'm not sure to understand.

There was a recent tweet on grsecurity account that says "New patches up, GCC 5.1 support for size_overflow in the test patch, [...]" but you are saying that GCC 5.1 doesn't support this plugin. So what am I doing wrong ? Sorry if this is a stupid question.

Should I stay with GCC 4.9 ? Disable SIZE_OVERFLOW plugin for the moment ? Or another solution ?

EDIT : also the package linux-grsec is compiled with GCC 4.9. What should I do, I'm lost.
Comment by Daniel Micay (thestinger) - Sunday, 14 June 2015, 03:37 GMT
I'm still using 4.9 for the builds because I know it works fine and there aren't significant advantages to new compiler versions for the kernel. I think 5.0 would work fine too. The size overflow plugin hits internal compiler errors (ICEs) with 5.1 which leads to the make error you're seeing. I haven't yet spent the time narrowing down the issue. It could easily be an upstream GCC bug rather than an issue in the PaX plugin code.
Comment by PaX Team (paxteam) - Sunday, 14 June 2015, 12:44 GMT
we did in fact port all our plugins to gcc-5 and tested them with allyes/allmod and some custom configs. it'd be nice to see the actual compile errors and the .config that triggers this. as for the ICEs, as a defensive measure, we often add gcc_unreachable() calls to our plugins when some invariant isn't held or some unexpected/not-yet-seen situation arises and the fix is usually simple but we need a reproducer ;).

PS: for the future, please contact us (Emese for the overflow and initify plugins, spender for randstruct and me for the rest) directly with plugin errors (and at least CC us on bugzilla entries).
Comment by Daniel Micay (thestinger) - Sunday, 14 June 2015, 19:50 GMT
Sadly I don't think this crappy bug tracker supports CC'ing someone. Bugs can be assigned to a limited set of users, and perhaps a new category could be added for upstream devs. I don't have the privs to do that myself.

Here's what error I get with Arch's current GCC 5.1 package, which is really snapshot 5-20150519 (due to critical bugs in the actual release) - the issue might not occur with the actual stable release which is what I was going to figure out first:

nop_expr != convert_expr
_10 = (long int) _9;
cicus.217_175 = (size_overflow_type_TI) _10;
*** WARNING *** there are active plugins, do not report this as a bug unless you can reproduce it without enabling any plugins.
Event | Plugins
PLUGIN_FINISH_TYPE | structleak_plugin constify_plugin
PLUGIN_ATTRIBUTES | structleak_plugin size_overflow_plugin initify_plugin constify_plugin
PLUGIN_START_UNIT | size_overflow_plugin initify_plugin stackleak_plugin constify_plugin
PLUGIN_ALL_IPA_PASSES_START | constify_plugin
drivers/staging/lustre/lnet/lnet/config.c: In function 'lnet_new_text_buf':
drivers/staging/lustre/lnet/lnet/config.c:369:1: internal compiler error: in get_dup_stmt, at tools/gcc/size_overflow_plugin/intentional_overflow.c:874
lnet_new_text_buf(int str_len)
^
0x2ad4f29af219 get_dup_stmt
tools/gcc/size_overflow_plugin/intentional_overflow.c:874
0x2ad4f29af219 unsigned_signed_cast_intentional_overflow(visited*, gassign*)
tools/gcc/size_overflow_plugin/intentional_overflow.c:952
0x2ad4f29acf4c handle_unary_ops
tools/gcc/size_overflow_plugin/size_overflow_transform_core.c:684
0x2ad4f29acf4c expand(visited*, tree_node*)
tools/gcc/size_overflow_plugin/size_overflow_transform_core.c:949
0x2ad4f29ad0e8 handle_unary_rhs
tools/gcc/size_overflow_plugin/size_overflow_transform_core.c:645
0x2ad4f29ad0e8 handle_unary_ops
tools/gcc/size_overflow_plugin/size_overflow_transform_core.c:681
0x2ad4f29ad0e8 expand(visited*, tree_node*)
tools/gcc/size_overflow_plugin/size_overflow_transform_core.c:949
0x2ad4f29ad0e8 handle_unary_rhs
tools/gcc/size_overflow_plugin/size_overflow_transform_core.c:645
0x2ad4f29ad0e8 handle_unary_ops
tools/gcc/size_overflow_plugin/size_overflow_transform_core.c:681
0x2ad4f29ad0e8 expand(visited*, tree_node*)
tools/gcc/size_overflow_plugin/size_overflow_transform_core.c:949
0x2ad4f29a8dfb handle_interesting_stmt
tools/gcc/size_overflow_plugin/size_overflow_transform.c:143
0x2ad4f29a8dfb search_interesting_stmts
tools/gcc/size_overflow_plugin/size_overflow_transform.c:328
0x2ad4f29a8dfb size_overflow_transform(cgraph_node*)
tools/gcc/size_overflow_plugin/size_overflow_transform.c:419
Comment by Daniel Micay (thestinger) - Sunday, 14 June 2015, 19:51 GMT
(it also eats whitespace at the start of a line and has no way to mark code, worst bug tracker ever :P)
Comment by PaX Team (paxteam) - Sunday, 14 June 2015, 21:36 GMT
ok, Emese fixed it, can you guys give it a try? and if there're still similar compilation errors, let us know (and preferably on our own forums, a random distro bugzilla isn't the best place for this ;).

https://github.com/ephox-gcc-plugins/size_overflow/commit/c23e780914b3c61af917699841919022be5a4e30
Comment by Jean (rfnx) - Monday, 15 June 2015, 19:55 GMT
@paxteam : Next time i'll contact you directly on the grsecurity support forum, thanks for the advice.

@all : So what should I do now to help you ? I don't really know how to install gcc 5.1 stable, or how to apply the patch of the github. Should I give you the .config I used ?
Comment by PaX Team (paxteam) - Monday, 15 June 2015, 20:39 GMT
i've already released a new PaX patch with the fix, so the next grsec patch will have it too. after that if you can still reproduce the error, contact us (we'll need .config and compile logs).
Comment by Jean (rfnx) - Wednesday, 17 June 2015, 18:33 GMT
With the new patch (grsecurity-3.1-4.0.5-201506171322) it works with gcc 5.1 (Arch official package) and SIZE_OVERFLOW enabled !

Thanks for your work.

Loading...