Thank you, Spender and Pax people!
You and the Hungarian (and possibly other) Pax developers are people I admire the most in contrast to the bleak and mostly profiteering top computing brains of today.
I would donate if I weren't heading for broke and very slowly and as yet remotely to maybe even foreclosure.
I can only encourage those who can, to donate. I rarely click on ads, but I did this time, just to see the kind firms who support you. I thank them as well!
Upon having such bad binary grsecurity installed and in such bad way, I decided I needed my system clean and I mean from scratch, so I reinstalled it...
(And I am saying this for newbies: there are still nice people in various Linux distros, but beware what and how you install. Myself, I opted for simple lxde desktop without some Gnome mine-tracker orm track-miner stuff (I couldn't care less to go find the exact name now, sorry!) and things that rummage through your system, and while doing do, claim they don't use your data for anything but your own needs. C'mon!...
!! For newbies to take notice, is the above !! (Most of this is for newbies, actually, up until I fail again in my install.)
There are still really nice people, say in Debian various teams, but...)
...And that is loong time reinstalling!
And then it took me long time to finally figure out how to do it.
I think I understand now how I need to do it.
In my case:
https://www.kernel.org/pub/linux/kernel/v3.x/where:
linux-3.8.7.tar.bz2
linux-3.8.7.tar.sign
Because I'm on Debian testing, that's Wheezy Release Candidate 1 now, IIUC. I like newer stuff, am not so afraid of instabilities, so newer kernels I prefer.
It is to go with:
pax-linux-3.8.7-test20.patch
and
grsecurity-2.9.1-3.8.7-201304142158.patch
and
gradm-2.9.1-201301041755.tar.gz
according to (sure different numbers there, older versions):
https://en.wikibooks.org/wiki/Grsecurit ... grsecurityI almost got it wrong again, because I did here first go for the binary kernels, just a few hours ago... No!, no way, grsecurity/pax patches are done for the exact kernels, and strictly for the sources of the kernels. They patch the sources, not the binary image of the kernel. It took me a while to finally settle that in my mind.
And, also this, no Debian kernel sources go with the grsecurity patch from grsecurity.net download, but you got Julian Tinnes or Corsac (a lot about the latter in my thread on forums.debian.org linked above), and some more things to observe and apply, I don't know any more details on that at this time.
So, here we go:
- Code: Select all
me@myhost:~$ mkdir kernel/
me@myhost:~$ cd kernel/
me@myhost:/my_downloads$ bunzip2 linux-3.8.7.tar.bz2
me@myhost:/my_downloads$ gpg --verify linux-3.8.7.tar.sign linux-3.8.7.tar
gpg: Signature made Fri 12 Apr 2013 04:57:45 PM UTC using RSA key ID 6092693E
gpg: Can't check signature: public key not found
me@myhost:/my_downloads$
But just go to, say, pgp.mit.edu and input 0x6092693E, then compare fingeprint, you'll see it's ok.
- Code: Select all
me@myhost:~/kernel$ ls -l /Cmn/deb_dLo/linux-3.8.7.tar
-rw-r--r-- 1 mr mr 505743360 Apr 17 13:19 /Cmn/deb_dLo/linux-3.8.7.tar
me@myhost:~/kernel$ ls -l
total 0
me@myhost:~/kernel$ tar xf /Cmn/deb_dLo/linux-3.8.7.tar
me@myhost:~/kernel$ ls -l
total 4
drwxr-xr-x 23 mr mr 4096 Apr 12 16:52 linux-3.8.7
me@myhost:~/kernel$ ls -l linux-3.8.7/
total 524
drwxr-xr-x 30 mr mr 4096 Apr 12 16:52 arch
drwxr-xr-x 3 mr mr 4096 Apr 12 16:52 block
-rw-r--r-- 1 mr mr 18693 Apr 12 16:52 COPYING
-rw-r--r-- 1 mr mr 95054 Apr 12 16:52 CREDITS
drwxr-xr-x 4 mr mr 4096 Apr 12 16:52 crypto
drwxr-xr-x 99 mr mr 12288 Apr 12 16:52 Documentation
drwxr-xr-x 108 mr mr 4096 Apr 12 16:52 drivers
drwxr-xr-x 36 mr mr 4096 Apr 12 16:52 firmware
drwxr-xr-x 72 mr mr 4096 Apr 12 16:52 fs
drwxr-xr-x 25 mr mr 4096 Apr 12 16:52 include
drwxr-xr-x 2 mr mr 4096 Apr 12 16:52 init
drwxr-xr-x 2 mr mr 4096 Apr 12 16:52 ipc
-rw-r--r-- 1 mr mr 2536 Apr 12 16:52 Kbuild
-rw-r--r-- 1 mr mr 252 Apr 12 16:52 Kconfig
drwxr-xr-x 10 mr mr 4096 Apr 12 16:52 kernel
drwxr-xr-x 9 mr mr 4096 Apr 12 16:52 lib
-rw-r--r-- 1 mr mr 239609 Apr 12 16:52 MAINTAINERS
-rw-r--r-- 1 mr mr 48024 Apr 12 16:52 Makefile
drwxr-xr-x 2 mr mr 4096 Apr 12 16:52 mm
drwxr-xr-x 55 mr mr 4096 Apr 12 16:52 net
-rw-r--r-- 1 mr mr 18736 Apr 12 16:52 README
-rw-r--r-- 1 mr mr 3371 Apr 12 16:52 REPORTING-BUGS
drwxr-xr-x 13 mr mr 4096 Apr 12 16:52 samples
drwxr-xr-x 13 mr mr 4096 Apr 12 16:52 scripts
drwxr-xr-x 9 mr mr 4096 Apr 12 16:52 security
drwxr-xr-x 22 mr mr 4096 Apr 12 16:52 sound
drwxr-xr-x 15 mr mr 4096 Apr 12 16:52 tools
drwxr-xr-x 2 mr mr 4096 Apr 12 16:52 usr
drwxr-xr-x 3 mr mr 4096 Apr 12 16:52 virt
me@myhost:~/kernel$
The point here is, "3.8.7" must correspond exactly to the vanilla kernel from kerne.org, I mean the sources kernel which it only ever is, on kernel.org, IIUC.
- Code: Select all
me@myhost:/my_downloads$ gpg2 --verify grsecurity-2.9.1-3.8.7-201304142158.patch.sig grsecurity-2.9.1-3.8.7-201304142158.patch
gpg: Signature made Mon 15 Apr 2013 03:59:27 CEST using DSA key ID 4245D46A
gpg: Good signature from "Bradley Spengler (spender) <spender@grsecurity.net>"
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: 9F74 393D 7E7F FF3C 6500 E778 9879 B649 4245 D46A
me@myhost:/my_downloads$
And now I apply the patch as Spender said (the complete output is very long so I cut it much shorter).
- Code: Select all
me@myhost:~/kernel/linux-3.8.7$ patch -p1 < /Cmn/deb_dLo/grsec_test/grsecurity-2.9.1-3.8.7-201304142158.patch
patching file Documentation/dontdiff
patching file Documentation/kernel-parameters.txt
patching file Makefile
patching file arch/alpha/include/asm/atomic.h
patching file arch/alpha/include/asm/cache.h
patching file arch/alpha/include/asm/elf.h
patching file arch/alpha/include/asm/pgalloc.h
patching file arch/alpha/include/asm/pgtable.h
patching file arch/alpha/kernel/module.c
patching file arch/alpha/kernel/osf_sys.c
patching file arch/alpha/mm/fault.c
patching file arch/arm/Kconfig
patching file arch/arm/common/gic.c
patching file arch/arm/include/asm/atomic.h
patching file arch/arm/include/asm/cache.h
...[snip]...
patching file tools/gcc/Makefile
patching file tools/gcc/checker_plugin.c
patching file tools/gcc/colorize_plugin.c
patching file tools/gcc/constify_plugin.c
patching file tools/gcc/generate_size_overflow_hash.sh
patching file tools/gcc/kallocstat_plugin.c
patching file tools/gcc/kernexec_plugin.c
patching file tools/gcc/latent_entropy_plugin.c
patching file tools/gcc/size_overflow_hash.data
patching file tools/gcc/size_overflow_plugin.c
patching file tools/gcc/stackleak_plugin.c
patching file tools/gcc/structleak_plugin.c
patching file tools/perf/util/include/asm/alternative-asm.h
patching file tools/perf/util/include/linux/compiler.h
patching file virt/kvm/ioapic.c
patching file virt/kvm/kvm_main.c
me@myhost:~/kernel/linux-3.8.7$
That's what the patch does! All these files are changed on precise lines and in precise terms.
That's a grsecurity-patched no-more-vanilla kernel, but sooo much better kernel!
Here I am not completely sure, but I think I need to apply pax patch now.
Gradm2, according to the contained README, I understand is installed later just fine. Gradm2 is not a patch, but source of a program to compile.
So, I go:
- Code: Select all
me@myhost:~/kernel/linux-3.8.7$ patch -p1 < /Cmn/deb_dLo/grsec_test/pax-linux-3.8.7-test20.patch
patching file arch/alpha/include/asm/atomic.h
Reversed (or previously applied) patch detected! Assume -R? [n]
which is, I ran into problems. I clearly get it that the patch program figured out I patched the kernel with another patch, sure, but I don't know (yet) what that "Assume -R? [n] " wants to (not) do, because if I just hit Enter it won't do it.
But I guess it must stand, the R for reverting the previous patch. I'll go and find it in 'man patch'...
Yeah, in that man page there is "-R or --reverse"...
So I hit Enter, bracing myself for what might even go wrong, because I'm not completely sure I'm doing right...
It just gave me another:
- Code: Select all
Apply anyway? [n]
And here I have to type in Y or yes, else it won't apply anything...
- Code: Select all
Apply anyway? [n] Y
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file arch/alpha/include/asm/atomic.h.rej
patching file arch/alpha/include/asm/elf.h
Reversed (or previously applied) patch detected! Assume -R? [n]
Apply anyway? [n] yes
Hunk #1 succeeded at 98 with fuzz 2 (offset 7 lines).
patching file arch/alpha/include/asm/pgalloc.h
Reversed (or previously applied) patch detected! Assume -R? [n]
Apply anyway? [n] yes
Hunk #1 succeeded at 35 with fuzz 1 (offset 6 lines).
patching file arch/alpha/include/asm/pgtable.h
Reversed (or previously applied) patch detected! Assume -R? [n]
Apply anyway? [n] yes
Hunk #1 FAILED at 102.
1 out of 1 hunk FAILED -- saving rejects to file arch/alpha/include/asm/pgtable.h.rej
patching file arch/alpha/kernel/module.c
Reversed (or previously applied) patch detected! Assume -R? [n]
Apply anyway? [n] ye
Hunk #1 FAILED at 160.
1 out of 1 hunk FAILED -- saving rejects to file arch/alpha/kernel/module.c.rej
patching file arch/alpha/kernel/osf_sys.c
Hunk #1 FAILED at 1304.
Hunk #2 succeeded at 1344 with fuzz 2 (offset 4 lines).
Hunk #3 FAILED at 1351.
2 out of 3 hunks FAILED -- saving rejects to file arch/alpha/kernel/osf_sys.c.rej
patching file arch/alpha/mm/fault.c
Reversed (or previously applied) patch detected! Assume -R? [n]
Apply anyway? [n] yes
Hunk #1 succeeded at 28 with fuzz 2 (offset -25 lines).
Hunk #2 FAILED at 251.
1 out of 2 hunks FAILED -- saving rejects to file arch/alpha/mm/fault.c.rej
patching file arch/arm/common/gic.c
Reversed (or previously applied) patch detected! Assume -R? [n]
Apply anyway? [n] yes
Hunk #1 FAILED at 81.
Hunk #2 FAILED at 329.
2 out of 2 hunks FAILED -- saving rejects to file arch/arm/common/gic.c.rej
patching file arch/arm/include/asm/atomic.h
Reversed (or previously applied) patch detected! Assume -R? [n]
Apply anyway? [n] yes
Hunk #1 FAILED at 17.
Hunk #2 FAILED at 42.
Hunk #3 FAILED at 60.
Hunk #4 FAILED at 80.
Hunk #5 FAILED at 98.
Hunk #6 succeeded at 282 (offset 148 lines).
Hunk #7 FAILED at 189.
Hunk #8 FAILED at 204.
Hunk #9 succeeded at 386 with fuzz 1 (offset 167 lines).
Hunk #10 FAILED at 236.
Hunk #11 FAILED at 248.
Hunk #12 succeeded at 463 with fuzz 2 (offset 195 lines).
Hunk #13 succeeded at 499 (offset 208 lines).
Hunk #14 succeeded at 540 (offset 222 lines).
Hunk #15 succeeded at 592 with fuzz 1 (offset 252 lines).
Hunk #16 FAILED at 381.
Hunk #17 FAILED at 410.
Hunk #18 succeeded at 685 (offset 249 lines).
Hunk #19 succeeded at 856 (offset 357 lines).
Hunk #20 FAILED at 546.
Hunk #21 FAILED at 583.
Hunk #22 FAILED at 602.
14 out of 22 hunks FAILED -- saving rejects to file arch/arm/include/asm/atomic.h.rej
patching file arch/arm/include/asm/cacheflush.h
Reversed (or previously applied) patch detected! Assume -R? [n]
Apply anyway? [n] yes
Hunk #1 FAILED at 116.
1 out of 1 hunk FAILED -- saving rejects to file arch/arm/include/asm/cacheflush.h.rej
patching file arch/arm/include/asm/cache.h
Reversed (or previously applied) patch detected! Assume -R? [n]
Apply anyway? [n] yes
Hunk #1 FAILED at 4.
Hunk #2 FAILED at 24.
2 out of 2 hunks FAILED -- saving rejects to file arch/arm/include/asm/cache.h.rej
patching file arch/arm/include/asm/checksum.h
Reversed (or previously applied) patch detected! Assume -R? [n]
Wrong, and I don't know where I went wrong this time around...
I might go for more perusing and internet searching, and I also need to post this, so I maybe get advice what to do.