Closed orlitzky closed 7 years ago
Hi,
RAP is implemented as a GCC compiler plugin. So deactivate it, I think: CONFIG_PAX_RAP=n
On 171114-19:51+0000, Loïc wrote:
Hi,
RAP is implemented as a GCC compiler plugin. So deactivate it, I think: CONFIG_PAX_RAP=n
Hmmh... I don't have those issues. And I have:
CONFIG_PAX_RAP=y
( and I even think I'll set it to be:
... CONFIG_PAX_RAP_VERBOSE=y #
for my next compilation with the Loïc's patch. :-)
And that means, @Michael Orlitzk, that you would probably need to get the, what is it, let me think... that you would need something like this (and maybe other stuff), and your RAP can be on as well:
gcc-6-plugin-dev - Files for GNU GCC plugin development. ... #
Because it's an important protection...
And I think that Mathias Krause, minipli, and our guy from Devuan, parazyd, got RAP to work completely, but I'm not advanced enough to be able to check it, it's only indications I think I saw of it, and read about it somewhere... So it is recommended to try and keep it.
You can find on forum.grsecurity.net (or is it forums.grsecurity.net how my attackers aimed exactly at the RAP in my machine, because most everything else was well protected by grsec here... And they aimed at RAP because it was at that time since maybe a year or so disabled in the non-paid grsec kernels (because of the filthy games against spender and PaX Team by Linus and his comrades and by, we know now, Google --for that look up the very last topic in the grsecurity forums, named "Paid access to test patches" and in it the very last post, by spender)... EDIT 2017-11-16 Wait, it may be this link, where the RAP exploit was tried against me, see this topic on grsec forums: PAX: overwritten function pointer or return address, bans portage! https://forums.grsecurity.net/viewtopic.php?f=3&t=4653 EDIT END
But about the gcc plugin, if you go that way, and if that is missing, maybe someone else can instruct Michael Orlitzk more precisely.
Regards!
-- Miroslav Rovis Zagreb, Croatia https://www.CroatiaFidelis.hr
Thanks guys. I am actually able to get the sources to build with RAP enabled, but to do that, I have to change my linker from Gold to the BFD linker that comes with GNU binutils. On my system, /usr/bin/ld
is a symlink and I can switch freely between the two.
When I'm building the kernel with the Gold linker and receive the above error, I can change the symlink to point to "ld" from GNU binutils. If I then type make
again, the build process resumes and succeeds -- so I'm relatively sure that the problem is with the linker.
Of course, there may be a fundamental incompatibility between Gold and the way RAP is implemented, so "use the BFD linker" might wind up being the answer, anyway. Either way it would be nice to know =)
I think that Mathias Krause, minipli, ... got RAP to work completely
One thing of course is that he's playing with it ;)
You can find on forum.grsecurity.net (or is it forums.grsecurity.net how my attackers aimed exactly at the RAP in my machine
I'll take a look at that.
Either way it would be nice to know =)
Did you try to modify the "scripts/Makefile.gcc-plugins" or "scripts/gcc-plugins/rap_plugin/Makefile" for use the option gcc's with "-fuse-ld=gold" ?
Did you try to modify the "scripts/Makefile.gcc-plugins" or "scripts/gcc-plugins/rap_plugin/Makefile" for use the option gcc's with "-fuse-ld=gold" ?
I haven't tried messing with the build system at all, but I think the two options -fuse-ld=bfd
and fuse-ld=gold
simply switch between the two executables ld.bfd
and ld.gold
:
$ ls /usr/bin/ld.*
/usr/bin/ld.bfd
/usr/bin/ld.gold
The default (again, just assuming here) is to use /usr/bin/ld
. However, on my system, /usr/bin/ld
is a symlink to one of the other two (ld.bfd
or ld.gold
). So what would typically be accomplished through -fuse-ld=gold
is instead accomplished at the symlink level. (We can more or less build and entire Gentoo system using gold in that manner.)
HacKurx replied to my: "Wait, it may be this link, where the RAP exploit was tried against me, see this topic on grsec forums:" and I had previously given a wrong link there. This is the one: PAX: overwritten function pointer or return address, bans portage! https://forums.grsecurity.net/viewtopic.php?f=3&t=4653 ( but it's not much, just indications, due to my Air-Gapped methods of poor-user's security ) And I'm reposting the correct link because people don't get editions to githuweets in their mailboxes.
Loic (firstname of kind developer HacKurx), for some reason, I couldn't decrypt the mail you sent me (and since we don't have an gresec-unoff dedicated mailing list or an gresec-unoff dedicated forum (yet) this is the only place I can tell you about it.
"( but it's not much, just indications, due to my Air-Gapped methods of poor-user's security )" meaning I bailed out before the exploit would develop... and, sadly, couldn't easily test the case as PaX Team had asked: "can you reproduce this with a vanilla kernel?" https://forums.grsecurity.net/viewtopic.php?f=3&t=4653#p16881 And my Air-Gap method is in my (verbose) follow-up reply there.
@orlitzky, I'm not certain if the kernel can be build with the gold linker even with RAP disabled -- actually even at all.
Have you tried building a vanilla kernel with the gold linker? If that works I'm willing to add -fuse-ld=bdf
to RAP's CFLAGS
. However, the symbols gold is complaining about are absolute ones that should have the same value. So I don't know why it's complaining :/
@minipli Changing CONFIG_PAX_RAP=y
to CONFIG_PAX_RAP=n
does fix the build, with all else held constant.
Please don't introduce any hacks into the build system on my account. Gold is a little bit stricter than the BFD linker, so usually these issues are pretty easy to resolve by adding a missing -lfoo
to $LIBS
or something trivial (but technically correct) like that.
This is only worth fixing if it's a subtle bug that Gold catches, but that the BFD linker does not. Otherwise, I'm happy to switch linkers before building the kernel.
Well, the issue is, the symbols gold is complaining about are the ones RAP needs to do the hash based type check. It emits them during compilation for each compilation unit. As it can't know in advance which functions have their address taken it emits symbols for all of them. However, those symbols are emitted as absolute values and -- as long as there are no conflicting prototype declarations -- should all be the same for a given function---and, in turn, for a given RAP hash symbol. Otherwise the final link is expected to fail as there are, apparently, two code locations that have a different understanding of how the function prototype should look like. But RAP needs exactly one to do its type check.
However, here it's different. gold is complaining about RAP hash symbols that have the same value. It's IMO not a bug in the RAP plugin, it's just gold that's too picky about multiple definitions of a symbol -- even if they all have the same (absolute) value.
I'll add it to my TODO list but it might take some time. I've a few plugin related changes pending already.
Thanks for the report!
it's just gold that's too picky about multiple definitions of a symbol -- even if they all have the same (absolute) value.
I'll ask on the binutils list if this is the intended behavior... maybe I'm wasting your time with a linker bug =P
So it goes: https://sourceware.org/ml/binutils/2017-11/msg00543.html
Thanks for your help with this!
Thank you for insisting!
I'm not sure if this is something you're interested in, but it's worth a shot. I noticed this build failure a while ago with the official grsec sources and reported it in Gentoo bug #607974. I just tested it with HEAD from the repo, and get a similar failure:
This happens whenever my "ld" is set to the gold linker:
I'll paste only my pax/grsec config options below, but anything else you need is available too.