LWN: Comments on "Kernel security: beyond bug fixing" https://lwn.net/Articles/662219/ This is a special feed containing comments posted to the individual LWN article titled "Kernel security: beyond bug fixing". en-us Sat, 01 Nov 2025 04:06:42 +0000 Sat, 01 Nov 2025 04:06:42 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net userspace drivers https://lwn.net/Articles/668441/ https://lwn.net/Articles/668441/ Cyberax <div class="FormattedComment"> <font class="QuotedText">&gt; There's this thing called "Direct Memory Access" in modern computers. Drivers can use that to access any sort of main memory or other devices in the same bus.</font><br> Not anymore: <a href="https://en.wikipedia.org/wiki/Input%E2%80%93output_memory_management_unit">https://en.wikipedia.org/wiki/Input%E2%80%93output_memory...</a><br> </div> Fri, 18 Dec 2015 04:29:33 +0000 userspace drivers https://lwn.net/Articles/668440/ https://lwn.net/Articles/668440/ Rudd-O <div class="FormattedComment"> There's this thing called "Direct Memory Access" in modern computers. Drivers can use that to access any sort of main memory or other devices in the same bus.<br> <p> Thus, while you think your (possibly compromised) network driver is oblivious to your password keystrokes because your connection to this site is SSL, your (possibly compromised) network driver is in fact stealing your keystrokes as you go.<br> <p> (I say possibly compromised, but with DMA, it's a juicy target for a compromise. There are videos of people doing this sort of thing, by the way. It's not something esoteric.)<br> </div> Fri, 18 Dec 2015 04:22:33 +0000 Kernel security: beyond bug fixing https://lwn.net/Articles/665663/ https://lwn.net/Articles/665663/ PaXTeam <div class="FormattedComment"> <a href="https://pax.grsecurity.net/docs/PaXTeam-H2HC15-RAP-RIP-ROP.pdf">https://pax.grsecurity.net/docs/PaXTeam-H2HC15-RAP-RIP-RO...</a> (there's some small errata in there that i'll fix eventually so better check the doc page for the updated version)<br> </div> Tue, 24 Nov 2015 16:25:03 +0000 Kernel security: beyond bug fixing https://lwn.net/Articles/665648/ https://lwn.net/Articles/665648/ hummassa <div class="FormattedComment"> I couldn't find the slides. Link, please? :D<br> </div> Tue, 24 Nov 2015 13:43:46 +0000 von Neumann extractor is not useful https://lwn.net/Articles/664535/ https://lwn.net/Articles/664535/ cladisch <div class="FormattedComment"> 0101<br> (You cannot use the same bit for two decisions; that would break the output, too.)<br> </div> Mon, 16 Nov 2015 05:55:03 +0000 von Neumann extractor is not useful https://lwn.net/Articles/664531/ https://lwn.net/Articles/664531/ kevinm <div class="FormattedComment"> How exactly do you get two consecutive 01 transitions without an intervening 10 transition?<br> </div> Mon, 16 Nov 2015 04:10:16 +0000 Kernel security: beyond bug fixing https://lwn.net/Articles/664111/ https://lwn.net/Articles/664111/ robbe <div class="FormattedComment"> I don’t think TeX being largely bug-free owns much to its implementation language.<br> <p> A better explanation is that it’s in rigid bugfix-only mode for more than 20 years now.<br> </div> Wed, 11 Nov 2015 21:20:36 +0000 Kernel security: beyond bug fixing https://lwn.net/Articles/663922/ https://lwn.net/Articles/663922/ PaXTeam <div class="FormattedComment"> there's a whole bunch of public research on control flow integrity, some of which also addresses protecting the return address despite its being writable by the attacker. i also recently presented my ideas on this at H2HC, see the slides for more details. in short, all these defenses boil down to restricting the 'address of my choosing' to the point that at least privilege escalation is no longer possible.<br> </div> Tue, 10 Nov 2015 17:29:53 +0000 Kernel security: beyond bug fixing https://lwn.net/Articles/663915/ https://lwn.net/Articles/663915/ hummassa <div class="FormattedComment"> Care to elaborate? If any instruction can write to the return stack, it's always possible to point the return address to an address of my choosing, and that way calling anything the current function's security context has the right to call. Which is mostly everything, because proper security contexts are a pain in the arse.<br> </div> Tue, 10 Nov 2015 16:39:27 +0000 Kernel security: beyond bug fixing https://lwn.net/Articles/663711/ https://lwn.net/Articles/663711/ xman <div class="FormattedComment"> <font class="QuotedText">&gt; Because it really seems possible to write a bad program in any language. And some people seem pretty good at that, whatever the programming environment cleverness.</font><br> <p> While undeniably people are great at writing bad code, there are languages/interfaces/apis/designs/whatever that are less error prone than others, and make it easier to see and correct bugs once you find them. Sparse demonstrates that even relatively subtle enhancements to the expressiveness of the kernel's code, you can significantly reduce the overhead lost to bugs.<br> <p> That allows for a much, much more targeted approach to addressing security.<br> </div> Mon, 09 Nov 2015 02:16:31 +0000 Kernel security: beyond bug fixing https://lwn.net/Articles/663708/ https://lwn.net/Articles/663708/ xman <div class="FormattedComment"> It may seem like developers are insane about this, but when you contemplate just how much performance is left on the table with our security measures and abstractions right now, there is actually a LOT developers already have sacrificed on the pillars of performance.<br> <p> With systems programming in particular, inefficiency itself often leads to its own bugs and security compromises farther up the stack. Developers *and* end users naturally route around inconvenient security systems and abstractions.<br> <p> Heck, we can have drastically improved security and privacy on the Internet right now, if we're just willing to absorb a 5x increase in latency and decrease in throughput (which, if you think about it, we had to suffer with right now), but hardly anyone is willing to make that compromise.<br> <p> At a higher level, the whole "remember my credit card" feature is an exercise in forgoing the minimal protections of an at least somewhat random and monitored credit card number that they carry with them everywhere for protection from what is almost always not-at-all-random and trivially crackable, not terribly well monitored, memorized password. Ask anyone who works in e-commerce how much more money they make with that feature.<br> </div> Mon, 09 Nov 2015 02:10:36 +0000 userspace drivers https://lwn.net/Articles/663671/ https://lwn.net/Articles/663671/ JanC_ <div class="FormattedComment"> I don't see how those binary drivers being in userspace would help against an NSA backdoor at all (especially in case of e.g. network drivers)?<br> <p> And I think you are wrong in case of most Broadcom drivers, which are open source but have to upload a closed source firmware into the network hardware, because they don't have a closed source firmware in ROM/flash like some others do. Both uploaded &amp; saved in ROM/flash firmwares could contain a backdoor, so kernel vs. userspace doesn't even come into play there.<br> </div> Sun, 08 Nov 2015 12:43:19 +0000 Kernel security: beyond bug fixing https://lwn.net/Articles/663631/ https://lwn.net/Articles/663631/ geek <div class="FormattedComment"> Well, TEX is written in Pascal and is widely held to be the best example of a large, widely used program with NO bugs.<br> <p> And if it takes Ken Thompson and Dennis Ritchie to write large bug-free programs in C, um, how many programmers like that are there?<br> <p> <p> </div> Sat, 07 Nov 2015 18:06:34 +0000 Kernel security: beyond bug fixing https://lwn.net/Articles/663546/ https://lwn.net/Articles/663546/ PaXTeam <div class="FormattedComment"> that paper is useless, don't believe anything in it. like i said, go try the code yourself, especially because PCID support was added in 2013 only whereas the paper is from research done in 2010 or so.<br> </div> Fri, 06 Nov 2015 19:56:48 +0000 Kernel security: beyond bug fixing https://lwn.net/Articles/663535/ https://lwn.net/Articles/663535/ patrick_g <div class="FormattedComment"> <font class="QuotedText">&gt; how about you actually try it out instead of speculating about it?</font><br> <p> No need to try. There is a usenix paper with perf comparisons here =&gt; <a href="https://www.usenix.org/system/files/conference/usenixsecurity12/sec12-final143.pdf">https://www.usenix.org/system/files/conference/usenixsecu...</a><br> <p> The paper is about kGuard but they do perf tests against vanilla and PaX.<br> For latency in syscalls (in microseconds) they wrote :<br> <p> <font class="QuotedText">&gt; The PaX-protected kernel exhibits a latency ranging between 5.6% and 257% (average 84.5%) on the x86, whereas on x86-64, the latency overhead ranges between 19% and 531% (average 172.2%). Additionally, (..) overhead for process creation (in both architectures) lies between 8.1% to 56.3%.</font><br> <p> For sockets and pipes bandwith degradation agains vanilla they wrote :<br> <p> <font class="QuotedText">&gt; PaX’s overhead lies between 19.9% – 58.8% on x86 (average 37%),and 21.7% – 78% on x86-64 (average 42.8%).</font><br> <p> But the slowdown is much less noticeable on macro benchmarks. For instance the test to build a vanilla kernel :<br> <p> <font class="QuotedText">&gt; On the x86, the PaX-protected kernel incurs a 1.26% run-time overhead, while on the x86-64 the overhead is 2.89%.</font><br> <p> And sql-bench slowdown agains vanilla :<br> <p> <font class="QuotedText">&gt; PaX lies between 1.16% (x86) and 2.67% (x86-64).</font><br> <p> <p> </div> Fri, 06 Nov 2015 19:25:28 +0000 Kernel security: beyond legacy https://lwn.net/Articles/663530/ https://lwn.net/Articles/663530/ igodard <div class="FormattedComment"> I am the chief architect of the Mill CPU architecture, whose threat-mitigation aspects were mentioned several times in the comments here. I'd welcome an invitation to meet, formally or informally, with the Linux security community. While it is true that the Mill is paperware as yet, it is a commercial product en route to hardware. There's no better time than now to explore what Linux could be, and should be, when given a clean-slate legacy-free platform underneath. Once the hardware is frozen it will be too late for your concerns - and ideas - to be reflected. You can reach me as ivan at millcomputing dt com.<br> </div> Fri, 06 Nov 2015 18:53:10 +0000 Kernel security: beyond bug fixing https://lwn.net/Articles/663531/ https://lwn.net/Articles/663531/ kees <div class="FormattedComment"> Yeah, I'm glad to see that working. For people that want to see what their kernels protect against, check out CONFIG_LKDTM, which creates /sys/kernel/debug/provoke-crash/DIRECT. Just echo into it to test various things (like EXEC_USERSPACE to check your SMEP or PXN):<br> <p> # cat /sys/kernel/debug/provoke-crash/DIRECT <br> Available crash types:<br> PANIC<br> BUG<br> WARNING<br> EXCEPTION<br> LOOP<br> OVERFLOW<br> CORRUPT_STACK<br> UNALIGNED_LOAD_STORE_WRITE<br> OVERWRITE_ALLOCATION<br> WRITE_AFTER_FREE<br> SOFTLOCKUP<br> HARDLOCKUP<br> SPINLOCKUP<br> HUNG_TASK<br> EXEC_DATA<br> EXEC_STACK<br> EXEC_KMALLOC<br> EXEC_VMALLOC<br> EXEC_USERSPACE<br> ACCESS_USERSPACE<br> WRITE_RO<br> WRITE_KERN<br> # echo EXEC_USERSPACE &gt; /sys/kernel/debug/provoke-crash/DIRECT<br> [2594952.708824] lkdtm: Performing direct entry EXEC_USERSPACE<br> [2594952.708852] lkdtm: attempting ok execution at ffffffffad5b2422<br> [2594952.708878] lkdtm: attempting bad execution at 00007f739d328000<br> [2594952.708907] unable to execute userspace code (SMEP?) (uid: 0)<br> [2594952.708920] BUG: unable to handle kernel paging request at 00007f739d328000<br> [2594952.708939] IP: [&lt;00007f739d328000&gt;] 0x7f739d328000<br> [2594952.708958] PGD 254a3f067 PUD 2732b0067 PMD 255bba067 PTE 248510067<br> [2594952.708981] Oops: 0011 [#1] SMP <br> <p> </div> Fri, 06 Nov 2015 18:50:33 +0000 Kernel security: beyond bug fixing https://lwn.net/Articles/663528/ https://lwn.net/Articles/663528/ PaXTeam <div class="FormattedComment"> <font class="QuotedText">&gt; That would certainly involve a lot of overhead.</font><br> <p> how about you actually try it out instead of speculating about it? PaX/UDEREF/PCID/amd64 at your service.<br> </div> Fri, 06 Nov 2015 18:19:15 +0000 Kernel security: beyond bug fixing https://lwn.net/Articles/663521/ https://lwn.net/Articles/663521/ BenHutchings <div class="FormattedComment"> Linux 4.3 added emulation of PAN on ARMv7 (CONFIG_CPU_SW_DOMAIN_PAN), again based on memory domains. It's even enabled by default. Unfortunately it's not compatible with LPAE.<br> </div> Fri, 06 Nov 2015 17:42:44 +0000 Kernel security: beyond bug fixing https://lwn.net/Articles/663411/ https://lwn.net/Articles/663411/ ploxiln <div class="FormattedComment"> Indeed, I did mean "if using a single stack" :) Dual stacks are nifty (but as pointed out by another comment not 100% bulletproof).<br> </div> Fri, 06 Nov 2015 03:38:50 +0000 Kernel security: beyond bug fixing https://lwn.net/Articles/663405/ https://lwn.net/Articles/663405/ fest3er <div class="FormattedComment"> Seems to me that a lot of what is desired cannot be done efficiently or reliably without hardware support. Like 9-bit memory where that extra bit determines whether or not the other 8 bits are writable. The best we could do today is to leave unwritable page holes in the address space to limit out-of-bounds writing; but this solution still has the resolution of a crayon. And only 64-bit (with 48 bits usable on x86_64) has enough virtual address space to waste.<br> </div> Fri, 06 Nov 2015 03:25:59 +0000 Kernel security: beyond bug fixing https://lwn.net/Articles/663212/ https://lwn.net/Articles/663212/ ortalo <div class="FormattedComment"> I do not really think the programming language is such a critical concern, neither the language level (Oz/ML vs Python vs C vs assembly language).<br> Why? Because it really seems possible to write a bad program in any language. And some people seem pretty good at that, whatever the programming environment cleverness.<br> And also because some of the best programs that never failed [1] were written in a mixture of assembly language and custom languages, but surely finely crafted by pretty good "coders" (who, btw, probably agree with you with respect to high-order languages safety advantage).<br> <p> The problem when thinking about our children is the fact that you may neglect to assess what our grand-parents did (right).<br> <p> [1] Look around Apollo or the shuttle flight system for top-class examples. Sorry for not having more recent examples. *That* is annoying I agree.<br> <p> </div> Thu, 05 Nov 2015 14:56:15 +0000 Kernel security: beyond bug fixing https://lwn.net/Articles/663195/ https://lwn.net/Articles/663195/ PaXTeam <div class="FormattedComment"> there're other defenses against that.<br> </div> Thu, 05 Nov 2015 12:52:03 +0000 Kernel security: beyond bug fixing https://lwn.net/Articles/663192/ https://lwn.net/Articles/663192/ PaXTeam <div class="FormattedComment"> it seems to me that you're mixing up defense techniques with exploit techniques, which one are you arguing about now? ;) your original post made a blanket statement about something which is demonstrably false, that's all i wanted to point out. how you can make exploit techniques fail with deterministic or probabilistic methods is irrelevant for that discussion. case in point, my simple example may very well be non-exploitable if the compiler places some of those variables into registers which by definition are not subject to memory corruption, but that of course was not the point of the example.<br> </div> Thu, 05 Nov 2015 12:46:48 +0000 userspace drivers https://lwn.net/Articles/663188/ https://lwn.net/Articles/663188/ Zolko <div class="FormattedComment"> This performance -vs- speed is also the argument to not have drivers in userspace. Which means that there is kernel code running that is completely unknown to the developers. We are not talking about bugs or security flaws, but built-in backdoors by the manufacturer. For example, Broadcom is a US company, who wants to bet that their closed binary drivers contain backdoors requested by the NSA under gagging legislation ? <br> <p> What use is there for a firewall if the first line of defense is a traitor ? What use is there for sandboxing if the X driver installs keyloggers and then phones home ?<br> <p> Talking about kernel security with a monolithical kernel and binary drivers is pointless crap (TM Linus) !!!<br> </div> Thu, 05 Nov 2015 12:37:32 +0000 Kernel security: beyond bug fixing https://lwn.net/Articles/663187/ https://lwn.net/Articles/663187/ hummassa <div class="FormattedComment"> The only defense against THAT would be "only the CALL instruction can write on the return stack".<br> </div> Thu, 05 Nov 2015 12:28:21 +0000 Kernel security: beyond bug fixing https://lwn.net/Articles/663180/ https://lwn.net/Articles/663180/ renox <div class="FormattedComment"> <font class="QuotedText">&gt; the return address is writable by the process and therefore by the arbitrary write primitive too. whether there're defenses that make it harder or not is orthogonal to your original statement 'you cannot use a buffer overflow to override a return address'.</font><br> <p> The 'arbitrary write' can overwrite the return address only if the address of the return address is known, which can be quite difficult if there is randomisation.<br> <p> Also for the Mill CPU(unfortunately paperware only currently) I think that the separated address stack is managed directly by the CPU, so an 'arbitrary write' cannot overwrite a return address.<br> <p> <p> </div> Thu, 05 Nov 2015 12:25:03 +0000 Kernel security: beyond bug fixing https://lwn.net/Articles/663179/ https://lwn.net/Articles/663179/ PaXTeam <div class="FormattedComment"> the return address is writable by the process and therefore by the arbitrary write primitive too. whether there're defenses that make it harder or not is orthogonal to your original statement 'you cannot use a buffer overflow to override a return address'.<br> </div> Thu, 05 Nov 2015 11:25:29 +0000 Kernel security: beyond bug fixing https://lwn.net/Articles/663174/ https://lwn.net/Articles/663174/ Wol <div class="FormattedComment"> <font class="QuotedText">&gt; It took decades (one generation?) but even BIOS recently dropped assembly, so there is hope. At least for our children.</font><br> <p> Which BIOS is that? I understood that at least one major BIOS was written in Forth, and has been that way for what, all of this century?<br> <p> Cheers,<br> Wol<br> </div> Thu, 05 Nov 2015 10:52:02 +0000 Kernel security: beyond bug fixing https://lwn.net/Articles/663173/ https://lwn.net/Articles/663173/ renox <div class="FormattedComment"> Yes, it's able to write anything anywhere the process can, but it doesn't necessarily makes its possible to overwrite the return address, which makes it harder to exploit the flaw (especially if you have w^x and randomisation).<br> <p> <p> <p> </div> Thu, 05 Nov 2015 10:45:54 +0000 Kernel security: beyond bug fixing https://lwn.net/Articles/663171/ https://lwn.net/Articles/663171/ PaXTeam <div class="FormattedComment"> void foo(char *in, long s)<br> {<br> long *p;<br> char out[8];<br> memcpy(out, in, 1024);<br> *p = s;<br> }<br> <p> assume the attacker controls the data behind 'in' and that the memcpy overwrites both 'p' and 's' on the stack, the last line will then be able to write anything anywhere. in short, there are many ways a memory corruption bug can be exploited, overwriting the return address of the current frame is just one and perhaps the most popularized textbook example but by far not the only way. this is the reason why having a proper threat model helps avoiding mistakes in devising defenses.<br> </div> Thu, 05 Nov 2015 10:36:21 +0000 Kernel security: beyond bug fixing https://lwn.net/Articles/663163/ https://lwn.net/Articles/663163/ renox <div class="FormattedComment"> I'm sorry but I didn't understand how your example would work.<br> <p> Can you explain it again or do you have a link with an article explaining how it could work?<br> Thanks.<br> </div> Thu, 05 Nov 2015 09:31:02 +0000 Kernel security: beyond bug fixing https://lwn.net/Articles/663143/ https://lwn.net/Articles/663143/ PaXTeam <div class="FormattedComment"> why not? you first overwrite a local variable of pointer type then let the rest of the function write through that pointer to overwrite the return address on the other stack.<br> </div> Wed, 04 Nov 2015 23:47:05 +0000 Kernel security: beyond bug fixing https://lwn.net/Articles/663112/ https://lwn.net/Articles/663112/ liam <div class="FormattedComment"> It would be something you could actually mention at conferences:)<br> More seriously, it would be very much like the rt branch where the intent is to upstream everything that can be upstreamed. In order to do this they'd need to have a good relationship with upstream.<br> Frankly, starting with the pax/grsec patches may not be a bad idea, but the work would need to be separated out into the smallest, useful components so as to make upstreaming more likely (I haven't examined there patches, so this work may already be in place).<br> <p> </div> Wed, 04 Nov 2015 21:36:37 +0000 Kernel security: beyond bug fixing https://lwn.net/Articles/663097/ https://lwn.net/Articles/663097/ dlang <div class="FormattedComment"> isn't the grsecurity paxteam stuff an attempt to run a separate kernel security project?<br> <p> what would be differetn about what you are proposing?<br> </div> Wed, 04 Nov 2015 19:45:04 +0000 Kernel security: beyond bug fixing https://lwn.net/Articles/663094/ https://lwn.net/Articles/663094/ liam <div class="FormattedComment"> Well, maybe, but hopefully not:)<br> My thoughts were that having a place where security was the overriding factor would increase the pool of potential contributors, demonstrate the worth (and cost) of said changes (thereby mitigating concerns about performance/bugs rather than having such concerns stop development prematurely), and, in the meantime, act as the upstream for security related work (the later might be useful for folks interested in running such a kernel just as the rt branch is preferred by audio engineers).<br> </div> Wed, 04 Nov 2015 19:39:19 +0000 Kernel security: beyond bug fixing https://lwn.net/Articles/663007/ https://lwn.net/Articles/663007/ renox <div class="FormattedComment"> <font class="QuotedText">&gt; So if bar could overflow a buffer in its stack frame, or in foo's stack frame, no matter how you arrange them,</font><br> <p> "No matter how you arrange them" is not correct: if you have separated variable and address stack, you cannot use a buffer overflow to override a return address.<br> <p> </div> Wed, 04 Nov 2015 12:30:58 +0000 Kernel security: beyond bug fixing https://lwn.net/Articles/663008/ https://lwn.net/Articles/663008/ jezuch <div class="FormattedComment"> <font class="QuotedText">&gt; Regarding conservatism: has any consideration been given to creation of a security tree, in similar fashion to the realtime tree?</font><br> <p> And then spend a couple of decades trying to merge it back? :)<br> </div> Wed, 04 Nov 2015 12:30:01 +0000 Kernel security: beyond bug fixing https://lwn.net/Articles/662994/ https://lwn.net/Articles/662994/ ploxiln <div class="FormattedComment"> Sure, if your hardware supports segmentation or something like it, you don't have to swap the page tables (and invalidate the TLB) and performance isn't too bad.<br> <p> Kees was suggesting swapping the page tables, for each system call or interrupt, when the hardware does not support something like segmentation. That would certainly involve a lot of overhead.<br> </div> Wed, 04 Nov 2015 02:02:48 +0000 Kernel security: beyond bug fixing https://lwn.net/Articles/662991/ https://lwn.net/Articles/662991/ ploxiln <div class="FormattedComment"> It's very common for a buffer to be allocated in a parent stack frame and then used in a child function. For example<br> <p> foo() {<br> char buf[16];<br> bar(buf, 16);<br> ...<br> }<br> <p> So if bar could overflow a buffer in its stack frame, or in foo's stack frame, no matter how you arrange them, one of them could hit the return address.<br> </div> Wed, 04 Nov 2015 01:54:39 +0000