-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spectre mitigation (retpoline) #26
Comments
I take what lands upstream in the v4.9 stable branch -- probably the microcode and MSR based solution. |
CVE-2017-5715: I hope you'll make a backport if need it. |
Retpoline going to be landed in 4.9. Perhaps it's easier to backport Retpoline first? Provide it doesn't depend on some precursor commits from KPTI... At least we can fix the userspace first with the new compiler now... |
@biergaizi The initial retpoline support is in 4.9.77. See diff. There is a bit of breakage with "pax_indirect_call" and "pax_ret" but nothing comparable with KPTI's breakage. Conflicts: |
These conflicts are trivial, just some indirect replacements.
Don't know if PaX/grsecurity introduced any extra assembly code here. But probably still easy to backport. 😄 Haven't looked into it, still don't know if any code introduced by retpoline depend on some precursor commits from KPTI. Probably not? |
You can add retpoline support without adding KPTI with the commit torvalds/linux@76b0438 (patch here). However, it does not appear to be compatible with the following optimizations: |
Truth is, IIUC, then AMD64 owners would have a lot less to worry, and grsecuoff kernels would already make sense, for them, installing and running... (Truth is also, we're a minority...) |
Do we have a timeline for getting the generic retpoline patches in to this? |
@klikevil |
HacKurx wrote:
I recompiled 4.9.74 with your retpoline patch and uploaded it to: It is being tested here: and it is likely to be tested by others from Debian/Devuan, |
I thought I'd open a new issue and name it:
Pls. note that fat WARNING in bottom of the above paste... Because that's the part that's now most missing for security, retpoline-patch being there. |
Maybe not extremely unlikely. I just took the same patch, actually I git clone'd the linux.git and did:
and diff did it complaining very little: miroR@some-amd-machine:/somewhere/src/linux-4.9.74$ patch -p1 < \ I'll tell you if I get the microcode to load, but it'll take longer. I compile with only one thread (no -j2 or -j4, just default -j1 for make), feels more reliable, I want it to really work for others too... I'm compiling the all-modules-compiled but separately from kernel, modules proper, for any hardware. |
Would not accept the extension .patch. But it should be named: microcode_amd_c_fam17h.patch |
Thanks apparently my attempt at it didn't touch several files and it was failing to boot (just hanging). Attempting compiling yours in now.
|
Klikevil wrote:
I can't understand much of it. minipli, HackKurx and others might, but you should try to introduce newlines in your paste (look it up on the web, it never even got your paste into email, Github's fault <- if others got what I got)... Corrections to my previous post (which can't be corrected in the email already sent 20 hours ago): --- /Cmn/mr/Github_180205_minipli_COR_1.txt 2018-02-05 16:41:48.514779652 +0000 -compiling the all-modules-compiled in kernel Yes, it's likely Github's fault, I tried to add backticks to start and end of the primitive diff just above, (under escape on many keyboards, but that pronto removed newlines...) |
However, for my AMD machines, it does not sort the microcode... OTOH, neither can new microcode get with the latest: # apt-cache policy linux-image-4.14.0-0.bpo.3-amd64 (no backticks for the above explained reason, and shows still poorly: nothing should be striken-through... if others see like I see: newlines removed when backticks). # cat /proc/cpuinfo | grep 'model name|microcode' And that's the proc on the old machine. Will paste from the new machine... In a while. |
Sorry, I mistakenly claimed Debian/Devuan has retpoline support, it doesn't. Correcting it online. |
@klikevil, maybe just one thing, regarding your post above:
If you used my https://github.com/miroR/grsec-dev1-compile script, and maybe patched it not at the correct stage, open an issue there, and I might try and find time to improve the script. In case it is something more complex, I'm not of much use. |
There I have received (sent:
[copied from the email headers]) email, which said in bottom: |
@HacKurx Thanks for the retpoline patch, far better than my One question, how long do you evaluate the life of this kernel before to be deprecated ("less" secure than the mainline) ? I'm planing to stick with this for the next few years (~ 5 years), do you think this is a reasonable plan ? |
@miroR i had apparently made a lot of changes to the source, i fetched the zip reapplied the patch and rebuilt w/o issue edit: Finally got the system up and running with @HacKurx 's retpoline patches, if you are on redhat 7 you'll have to literally rebuild systemd from source because systemd sucks and misdetects the architecture. [root@dnocc1337 ~]# dmesg |& grep -i spect [root@dnocc1337 ~]# uname -a Other update: see my post below, you don't have to rebuild systemd just comment 2 lines from the patch that arch/x86/kernel/cpu/bugs.c /IF/ you run in to an issue with systemd not detecting the correct architecture. |
@HacKurx After some debugging and several recompiles i figured out why my kernel was booting as x66_64
[ 0.013920] What the fuck is this string? : 6
That was making utsname()-> machine[1] come back as x66_64 >.> She is better now though [root@dnocc1337 linux]# uname -a This is in arch/x86/kernel/cpu/bugs.c |
Good to know that RedHat just invented the x66 architecture 😂😂 |
I like the enthusiasm @klikevil , but I'm not advanced. When it comes to C code (which I can edit and use only basic stuff of yet), I need hours to maybe figure out... (And I'm sure some among the other followers would benefit from the... read on)... Pls. some guidance, where that code is, and as much as possible of the details... I haven't compiled grsec since almost two months now, eagerly awaiting a savior, that it be @minipli or anybody else, to save, essentially GNU/Linux to remain feasible to be modified to become secure (which it is not as it comes out by the dictator and his lieutenants)... And so... not having a few hours to recall and refresh my previous work and understanding, pls. a schoolish, slow, reminder... if possible, of course... |
@miroR Only do this if you run in to the same issue that i was having where it was detecting the architecture as x66_64 instead of x86_64 despite being compiled with a proper CHOST/ARCH etc set. Comment out line 42 and 43 and build again and it will detect the proper architecture. Why in God's name it's detecting it as that I don't have an answer but when i made it print the string to the kernel ring buffer with
it printed a 6 and so i just took a shot in the dark and commented out those lines that fuck with init_utsname->()machine[1] (had a bit of help in figuring out what that was from @HacKurx by getting me pointed in the right direction as to what actually determines uname lol). Either way solved my problem :D . Also it is important to note I was using gentoo's gcc which essentially pretends it's a cross compiler and i had it in a major non-standard path and a bunch of other unique oddities. |
@klikevil |
@minipli interesting for after |
Been out of work for personal reasons for a bit so I haven't tested the vanilla kernel on the same vm if I am able to make it back in the forseeable future I'll let you know @HacKurx |
Hi Matthias,
Thanks for your amazing effort. I know you have plenty to do right now, but let me ask, do you plan to backport the spectre mitigations (retpoline) too?
(https://lkml.org/lkml/2018/1/3/780)
The text was updated successfully, but these errors were encountered: