LWN: Comments on "vmsplice(): the making of a local root exploit"
https://lwn.net/Articles/268783/
This is a special feed containing comments posted
to the individual LWN article titled "vmsplice(): the making of a local root exploit".
en-usSun, 03 Aug 2025 16:41:13 +0000Sun, 03 Aug 2025 16:41:13 +0000https://www.rssboard.org/rss-specification[email protected]QA?
https://lwn.net/Articles/368031/
https://lwn.net/Articles/368031/barrygould<div class="FormattedComment">
ISTM that someone should have tested the exploit against the 'fixed' kernel before declaring it fixed. (more QA is needed in the kernel development processes.)<br>
</div>
Thu, 24 Dec 2009 22:07:48 +0000vmsplice(): the making of a local root exploit
https://lwn.net/Articles/314460/
https://lwn.net/Articles/314460/dibbles_you<div class="FormattedComment">
cd /to/linux/kernel<br>
# find . -name "*.c" | xargs grep ">>" | awk -F ">>" '{ for(n=2;n<=NF;n++) { $c=$n; sub(/^=/,"",$c); sub(/ /,"",$c); gsub(/\(/,"",$c); gsub(/\)/,"",$c); $c=substr($c,1,1); if ($c>='0' && $c<='9') print "number"; else print "text"; } }' > a<br>
# cat a| grep text | wc -l<br>
# cat a| grep number | wc -l<br>
<p>
number=19877<br>
text=4936<br>
<p>
so it would seem the linux kernel believes numbers are usually clearer for others to read and understand.<br>
<p>
if you believe otherwise submit a patch to the kernel removing all occurrences and replacing them with meaningful #defines.<br>
<p>
#define 'ing all numbers is stupid, using identifiers that describe what they are should allow anybody to understand their context, if you use lots of operators and numbers in a single expression split them up to use multiple variables with appropriate names, if they are in conditions use multiple conditions with comments if necessary. The compiler will optimize all these away and make your code more readable without have 15 editors open or using code navigators to work out that the actual value of CLUSTERS_DIVIDE_BY_BYTES_IN_SECTORS_MULTIPLIED_BY_PI(x) is 2.<br>
<p>
PS. the script is an approximation.<br>
</div>
Sun, 11 Jan 2009 04:06:48 +0000Bigger caches ? Where ?
https://lwn.net/Articles/272488/
https://lwn.net/Articles/272488/phip<div class="FormattedComment"><pre>
<font class="QuotedText">> There will never be "bigger cache sizes". Never.</font>
You should check out PA-RISC. They have L1 D-caches up to 2048K.
</pre></div>
Sun, 09 Mar 2008 23:16:27 +0000Trapping on overflow
https://lwn.net/Articles/271274/
https://lwn.net/Articles/271274/antonApart from asm statements and modifying gcc I don't know of a way to
get gcc or other compilers to use the trapping instructions for C
code.
<p>Concerning "no arithmetic in here is supposed to wrap around",
unsigned arithmetic is supposed to wrap around in standard C, only
signed arithmetic is allowed to trap (or do anything else) on
overflow.
Thu, 28 Feb 2008 21:23:14 +0000It's far from complete
https://lwn.net/Articles/270684/
https://lwn.net/Articles/270684/fbh<div class="FormattedComment"><pre>
Acutally you're right.
It's a trick to compute the addresses of the fake "struct page" structures on both 32 and 64
bits platforms.
It should work on 64 bits platforms. I don't know why it doesn't in your case though but it's
just a matter of tuning some values in the exploit code probably.
Thanks.
</pre></div>
Mon, 25 Feb 2008 09:02:12 +0000It's far from complete
https://lwn.net/Articles/270655/
https://lwn.net/Articles/270655/cras<div class="FormattedComment"><pre>
I don't know if the exploit was supposed to work as a 64bit binary (I crashed my machine when
testing one version of it), but that code doesn't translate to "NULL" on 64bit systems.
</pre></div>
Mon, 25 Feb 2008 00:19:41 +0000It's far from complete
https://lwn.net/Articles/270613/
https://lwn.net/Articles/270613/fbh<div class="FormattedComment"><pre>
Hello,
I'm suprised to see how this article is far from complete. It misses some important details
and it doesn't actually explain how the exploit works...
For example, the interesting buffer overflow (which is actually not done by get_user_pages()
BTW), is not used to put a return address on the stack at all ! Hint: it's actually used to
put 0 and 0x1000.
And, surprise surprise, the exploit also 'mmap' 2 areas starting by 0 and 0x1000. And these
areas are made up to look like a struct page structure for a compound page where the
destructor field is set to kernel_code() address.
One thing I still miss is why the exploit code is so weirdly written ?
For example, it does:
pages[0] = *(void **) &(int[2]){0,PAGE_SIZE};
whereas it could have done instead:
pages[0] = NULL;
Is it something common for exploit code to be ofuscated ?
</pre></div>
Sun, 24 Feb 2008 10:55:42 +0000Trapping on overflow
https://lwn.net/Articles/270602/
https://lwn.net/Articles/270602/giraffedata<blockquote>
MIPS and Alpha have separate arithmetic instructions that trap on signed overflow ...
</blockquote>
<p>
Nice. Do you know if there is any way to make GCC (or any other C compiler) generate such instructions?
<p>
I can understand people resisting adding instructions to handle overflow, but if I could declare in my C program "no arithmetic in here is supposed to wrap around" and get signalled to death if it does, I'd do it a lot.
Sat, 23 Feb 2008 22:24:11 +0000for the record
https://lwn.net/Articles/270599/
https://lwn.net/Articles/270599/gvy<div class="FormattedComment"><pre>
* Sun Feb 10 2008 Sergey Vlasov <vsu@altlinux> 2.6.18-alt12
- Security-related changes:
+ CVE-2008-0600: splice: fix user pointer access in get_iovec_page_array()
+ check iovec buffers in __bio_map_user_iov() (fixes issue with SG_IO)
+ guard against attempts to call get_user_pages() for 0 pages
</pre></div>
Sat, 23 Feb 2008 22:06:18 +0000Trapping on overflow
https://lwn.net/Articles/270598/
https://lwn.net/Articles/270598/anton<blockquote>But I don't get why no CPU today provides even the option
of trapping on an arithmetic overflow.</blockquote>
MIPS and Alpha have separate arithmetic instructions that trap on
signed overflow (e.g., ADD on MIPS and ADDV on Alpha). IA-32 has INTO
which traps if OF is set. Apparently this instruction was so rarely
used by programmers, that AMD64 removed it in order to free up some
opcode space, and did not even bother to allocate another (multi-byte)
opcode for it; but you can still implement the functionality by
combining JO (or JNO) with INT.
<p>The existence of INTO has not helped against this security hole, though.
Sat, 23 Feb 2008 21:45:21 +0000Power 6 clock high-score and real performance
https://lwn.net/Articles/270593/
https://lwn.net/Articles/270593/anton<blockquote>It'd be interesting to have a study which analyse whether
going in order for integer processing to increase the clock really did
improve performance</blockquote>
Take a look at <a rel="nofollow" href="http://www.spec.org/cpu2006/results/">SPEC CPU
2006 results</a>. Last I looked, a 4.7GHz Power6 had similar speed to a 3GHz Core 2
Duo 6850 in both SPECint2006 and SPECfp2006 results.
Sat, 23 Feb 2008 17:14:18 +0000Bigger caches ? Where ?
https://lwn.net/Articles/270261/
https://lwn.net/Articles/270261/renox<div class="FormattedComment"><pre>
<font class="QuotedText">>Look at the IBM Power6 for some high-clock cores...</font>
Except that apparently they had a lot of difficulty ramping up the clock..
Plus their CPU does *in order* integer processing which induce a loss of efficiency..
It'd be interesting to have a study which analyse whether going in order for integer
processing to increase the clock really did improve performance or if it was just a marketing
gimmick a la P4.
</pre></div>
Thu, 21 Feb 2008 09:53:51 +0000Bigger caches ? Where ?
https://lwn.net/Articles/270258/
https://lwn.net/Articles/270258/renox<div class="FormattedComment"><pre>
<font class="QuotedText">>This is place where Linus misses the point completely: there are no "bigger cache sizes".
There will never be "bigger cache sizes". Never. Pentium had 16 KiB L1 </font>
Funny how you restrict the meaning of 'bigger cache size' to 'L1 cache size' to "make your
point".
Sure L1 won't grow, but L2 and L3 cache are also cache you know?
</pre></div>
Thu, 21 Feb 2008 09:46:47 +0000OT: reply
https://lwn.net/Articles/269924/
https://lwn.net/Articles/269924/intgr<p>So it turns out that this indeed is the problem; the stylesheet file sizes only differ in one byte so I didn't catch the difference the first time (I thought they were equal).</p>
<pre>
--- lwn_logged_out.css 2008-02-19 09:58:38.000000000 +0200
+++ lwn_logged_in.css 2008-02-19 09:57:04.000000000 +0200
@@ -135,7 +135,7 @@
DIV.CommentBody { padding: 0px 4px 0px 4px; }
P.CommentPoster { margin-top: 0px; }
-div.CommentReplyButton { display: none;
+div.CommentReplyButton { display: block;
text-align: right;
padding: 4px; }
</pre>
<p>The problem here is browser cache. When the user first visits LWN.net, not having logged in yet, the browser downloads <tt>/CSS/lwn</tt> which specifies that <tt>div.CommentReplyButton</tt> should be hidden.</p>
<p>Later when the user does log in, the browser doesn't bother re-fetching the stylesheet because it already has this URL cached. The Right Way to fix this is to have different stylesheet URLs depending on whether the user is logged in -- rather than using magic stylesheets.</p>
Tue, 19 Feb 2008 08:09:52 +0000This code is there not for performance
https://lwn.net/Articles/269744/
https://lwn.net/Articles/269744/giraffedata<blockquote>
It is unfortunate that the CPU cannot enforce signedness and size types.
</blockquote>
<p>
The unfortunateness is at a lower level than that. It's unfortunate that a CPU can't do ordinary integer math, where 2 + 2 = 4. I understand why the very first CPUs wrapped around integers -- it happens naturally with the simplest implementations. But I don't get why no CPU today provides even the option of trapping on an arithmetic overflow instead of wrapping around silently. They do it for floating point, but not for integers.
Sun, 17 Feb 2008 19:50:25 +0000vmsplice(): the making of a local root exploit
https://lwn.net/Articles/269651/
https://lwn.net/Articles/269651/bronson<div class="FormattedComment"><pre>
I guess we will disagree. Your way is still hostile to new maintainers because it carries so
much implicit information. What if your code code has this?
inode->i_blocks = bytes >> 8;
What is a new maintainer to think? Even if he does recognize that this expression is
different from the others, he's still confused. Did you auto-optimize the expression (bytes
>> 9)*2? Is it typoed or a thinko?
Will every potentially confusing use of the shift operator in your code include a comment
stating the author's intention? If so, then will that convention still be true once someone
else has modified your code?
Also, you've given yourself a rather heavy restriction on variable naming haven't you? Will
all your variable names really contain "blocks" and "bytes" as appropriate? You'll probably
want to add this restriction as a comment to each file to which it applies or it won't last
long once other people start committing patches to your code!
Finally, your technique only works for trivial expressions like assignment. What happens if
you need to actually perform a calculation?
A BYTES_TO_BLOCKS macro solves all these problems by making the conversion explicit. Implicit
rules and unwritten conventions always make life hard for new maintainers. Always.
</pre></div>
Sat, 16 Feb 2008 17:13:43 +0000This code is there not for performance
https://lwn.net/Articles/269635/
https://lwn.net/Articles/269635/ernest<div class="FormattedComment"><pre>
It is unfortunate that the CPU cannot enforce signedness and size types.
Anybody programming in assembly can bypass any higher level language type
checks you have in mind. This is true even if the users has the best
intentions.
Ernest.
</pre></div>
Sat, 16 Feb 2008 11:28:07 +0000vmsplice(): the making of a local root exploit
https://lwn.net/Articles/269623/
https://lwn.net/Articles/269623/dododge<div class="FormattedComment"><pre>
<font class="QuotedText">> Consider:</font>
<font class="QuotedText">> inode->i_blocks = bytes >> 9;</font>
<font class="QuotedText">> vs:</font>
<font class="QuotedText">> inode->i_blocks = BYTES_TO_BLOCKS(bytes);</font>
It's a bit of an unfair example, though, because you're computing
against a value called "bytes" and assigning it to something called
"blocks". You've put enough context around the expression to make
it clear what the shift is trying to accomplish.
The problem is when someone assumes ">> 9" is inherently
self-documenting and throws it into the middle of a much more
complex statement. Consider:
process_frag_2(sig,(get_ent(curr) >> 9) + 2,HEX_ENCODE);
vs:
process_frag_2(sig,BYTES_TO_BLOCKS(get_ent(curr)) + 2,HEX_ENCODE);
When I'm reading code, I'd much rather see the latter. It doesn't
just tell me why the shift is being done; it even adds useful
information about the APIs for get_ent() and process_frag_2().
</pre></div>
Sat, 16 Feb 2008 01:52:04 +0000code obfuscation
https://lwn.net/Articles/269621/
https://lwn.net/Articles/269621/man_lsTrue. Any idiot can obfuscate his or her code, but it takes work and wit to make legible code.Sat, 16 Feb 2008 01:21:21 +0000Magic exists by necessity alone
https://lwn.net/Articles/269612/
https://lwn.net/Articles/269612/vonbrand<p>
Even if a "perfect architecture" existed such that "real machines" are "perfect subsets" (real architectures are <em>very different</em>, sometimes in very weird ways), one of the problems writing a kernel is that real hardware is as buggy (or more!) as the next software (in the end, it is algorithms implemented in silicon, with the added burden that bugs can rarely patched and the rebuilt package distributed to the users).Fri, 15 Feb 2008 23:23:40 +0000Halting problem ? Ha!
https://lwn.net/Articles/269598/
https://lwn.net/Articles/269598/nix<div class="FormattedComment"><pre>
I used the wrong terms, really. What Haskell, Cayenne and Qi provide over
C++ is (radically) greater *expressiveness*. The syntax of Qi type
definitions is especially strange, but it's a hell of a lot saner than
trying to define anything complicated using C++ templates.
</pre></div>
Fri, 15 Feb 2008 21:48:10 +0000OT: reply
https://lwn.net/Articles/269535/
https://lwn.net/Articles/269535/madscientist<div class="FormattedComment"><pre>
I see this happen somewhat often using FireFox too. As you say, the buttons are ALL missing,
and a reload takes care of it. I checked the source once on these but it looked fine: the CSS
for the buttons was all there. They just didn't show up.
I've also had situations where the front page says there are replies, but when I click the
link I don't see any replies. Then if I reload, the replies appear! This happens more
rarely, but it's happened more than once.
At first I thought it was because I was using the greasemonkey add-on to distinguish between
read and unread comments, but I've since turned that off and I still see both of these
problems.
</pre></div>
Fri, 15 Feb 2008 15:07:36 +0000vmsplice(): the making of a local root exploit
https://lwn.net/Articles/269512/
https://lwn.net/Articles/269512/jimparis<div class="FormattedComment"><pre>
<font class="QuotedText">> I venture that if you can't see that, you must still be in your</font>
<font class="QuotedText">> first job and haven't yet had the task to maintain somebody else's code.</font>
And I venture that, in my experience (which is not as limited as you impolitely presume),
"somebody else's code" is a whole lot more difficult to work with when I have to dig through
arbitrary levels of opaque macros to figure out what they're really trying to do.
Clearly we have a difference in opinion. I prefer in code that is written clearly enough to
be self-explanatory. Consider:
inode->i_blocks = bytes >> 9;
vs:
inode->i_blocks = BYTES_TO_BLOCKS(bytes);
If you maintain that the second version conveys more information than the first, then I'm
afraid we will just have to disagree.
</pre></div>
Fri, 15 Feb 2008 07:43:24 +0000vmsplice(): the making of a local root exploit
https://lwn.net/Articles/269508/
https://lwn.net/Articles/269508/JoeF<i>Using ">> 9" is essentially a comment saying "I'm converting this to a 512-byte sector count".</i>
<p>No. It only says that you shift a value by 9 bits to the right.
<br>It may say to <b>you</b> that you are converting a value to a 512-byte sector count. It does <b>not</b> necessarily say that to others.
<p><i>It's such a fundamentally basic operation that anyone working with filesystem or disk code
would understand it immediately.</i>
<p><b>That</b> mindset is what results in a lot of the flaws in all kinds of code. There <b>will</b> always be somebody working on the code for whom it isn't obvious. I venture that if you can't see that, you must still be in your first job and haven't yet had the task to maintain somebody else's code. I can tell you from (painful) experience that this kind of stuff is among the worst stuff out there.<br> ">>9" makes implicit assumptions, and implicit assumptions, even if they may seem reasonable to the original author, are often not obvious to maintainers, possibly years down the road.
<br>Oh, and just in case, I <b>am</b> writing filesystem code. I would never even get the idea to write something like ">>9" without a comment, or better, in a macro.
Fri, 15 Feb 2008 06:54:55 +0000Halting problem ? Ha!
https://lwn.net/Articles/269485/
https://lwn.net/Articles/269485/ms<div class="FormattedComment"><pre>
No, nix wasn't joking. If you use C++ templates and limit yourself to numbers then it really
is turing complete. Haskell, with the right flags (undecidable instances and overlapping
instances) is also Turing complete. Cayenne is deliberately so and many people are now really
thinking that it's just better to permit Turing completeness and let the programmer take
responsibility.
The alternative is more like what Epigram is looking at (amongst others) where you limit
recursion to on the structure of terms and prevent infinite structures. That way, you can
still guarantee termination. I fear we may now be some way from the original issue though ;)
</pre></div>
Fri, 15 Feb 2008 00:06:49 +0000Halting problem ? Ha!
https://lwn.net/Articles/269471/
https://lwn.net/Articles/269471/lysse<div class="FormattedComment"><pre>
I don't know if you're joking about C++, but one of the notable things about Qi is that its
type system *is* Turing-complete, by intent and proof (someone implemented SK combinators in
it).
</pre></div>
Thu, 14 Feb 2008 22:01:38 +0000vmsplice(): the making of a local root exploit
https://lwn.net/Articles/269442/
https://lwn.net/Articles/269442/jimparis<div class="FormattedComment"><pre>
<font class="QuotedText">> You either need to add a comment, or use a define.</font>
bytes >> 9 without a clarifier is something that should never be in production-quality code.
Magic numbers should never be in code without a clear explanation what they mean. If you don't
want a macro that can hide things, write something like bytes >> SECTOR_SHIFT.
If one doesn't want to hide things, hide it inside "SECTOR_SHIFT"?
I'm sorry, I remain unconvinced.
Using ">> 9" is essentially a comment saying "I'm converting this to a 512-byte sector count".
It's such a fundamentally basic operation that anyone working with filesystem or disk code
would understand it immediately.
Abstracting common constants is most useful when they might change, and they're just arbitrary
to begin with -- HZ for example. Or things that actually have no real meaning, like magic
numbers that identify a filesystem. For a number that has a real, well-known meaning, and for
which changing would involve huge logic changes in the code, I think macros like that are just
extra levels of obfuscation.
</pre></div>
Thu, 14 Feb 2008 20:42:23 +0000vmsplice(): the making of a local root exploit
https://lwn.net/Articles/269435/
https://lwn.net/Articles/269435/JoeFYou either need to add a comment, or use a define.<br>
bytes >> 9 without a clarifier is something that should <b>never</b> be in production-quality code.<br>
Magic numbers should never be in code without a clear explanation what they mean.<br>
If you don't want a macro that can hide things, write something like bytes >> SECTOR_SHIFT.
Thu, 14 Feb 2008 19:44:23 +0000One possible SELinux trick
https://lwn.net/Articles/269385/
https://lwn.net/Articles/269385/corbetI just ran across <a rel="nofollow" href="http://james-morris.livejournal.com/26303.html">this posting from James Morris</a> on how SELinux (in recent kernels) can block the mapping of memory into very low addresses - a feature which would have defeated this particular exploit.Thu, 14 Feb 2008 15:06:07 +0000OT: reply: FireFox versus CSS
https://lwn.net/Articles/269371/
https://lwn.net/Articles/269371/hummassa<div class="FormattedComment"><pre>
I think it is a CSS problem. As I use non-standard colors, when I do the same operation ("log
in to read this article"), it comes back with the default colors instead of my colors. At this
point, I refresh the page... hence I don't encounter the "no buttons" problem.
</pre></div>
Thu, 14 Feb 2008 14:42:11 +0000vmsplice(): the making of a local root exploit
https://lwn.net/Articles/269366/
https://lwn.net/Articles/269366/corbetThe exploit is able to run arbitrary code in kernel mode, so the answer has to be "no." Unless one had previously configured SELinux to disallow access to <tt>vmsplice()</tt> altogether, of course.Thu, 14 Feb 2008 13:44:25 +0000OT: reply
https://lwn.net/Articles/269347/
https://lwn.net/Articles/269347/intgr<div class="FormattedComment"><pre>
I've seen this repeatedly with Firefox, probably because I always throw out all browser
cookies on exit; the refresh trick always fixes it.
This is how the problem occurs for me:
1. I'm not logged in and click on an article that requires subscription; LWN informs me that I
can't see this article.
2. I click on "log in to read this article"; <a href="https://lwn.net/login?target=/Articles/268783/">https://lwn.net/login?target=/Articles/268783/</a>
3. After filling in username and password, I'm redirected to the
<a href="http://lwn.net/Articles/268783/">http://lwn.net/Articles/268783/</a> page without the "reply to this comment" buttons -- as if LWN
thought I wasn't logged in.
4. Reloading the page makes the buttons appear.
To reproduce the bug again, I have to clear my cache (!) after logging out. This would suggest
that it depends on some external dependency (like CSS or JavaScript) that varies depending on
login, but gets cached pre-login by the browser. However I couldn't find such dependencies on
the LWN site.
</pre></div>
Thu, 14 Feb 2008 11:51:28 +0000vmsplice(): the making of a local root exploit
https://lwn.net/Articles/269335/
https://lwn.net/Articles/269335/dale77<div class="FormattedComment"><pre>
Anyone know whether SELinux would have prevented this exploit?
</pre></div>
Thu, 14 Feb 2008 08:16:28 +0000vmsplice(): the making of a local root exploit
https://lwn.net/Articles/269318/
https://lwn.net/Articles/269318/jimparis<div class="FormattedComment"><pre>
<font class="QuotedText">> While hardware sectors may be 512 bytes (currently), filesystems usually deal with larger
blocks.</font>
All the more reason to be just specify it clearly at the point of use rather than hiding it
away in a #define! See my response above too.
</pre></div>
Thu, 14 Feb 2008 06:40:51 +0000vmsplice(): the making of a local root exploit
https://lwn.net/Articles/269316/
https://lwn.net/Articles/269316/jimparis<div class="FormattedComment"><pre>
<font class="QuotedText">> > For example, if you work on code related to SCSI or filesytems or otherwise connected with
disks, you're expected to recognise that (bytes >> 9) converts from a byte count to a sector
count, since sectors are 512 bytes.</font>
<font class="QuotedText">> However, a well-crafted macro BYTES2SECTORS(bytes) would give me a clue, and the magic
numbers and operations on them would live in the definition of the macro, so you've got one
place to maintain the conversion and it's clear to us noobs what it's related to.</font>
But in the context of the kernel, hiding things in a BYTES2SECTORS macro can be downright
dangerous. What types does it handle for input and output? Does it sleep or have any locking
requirements? If I pass an expression, do I have to worry about side effects if it gets
evaluated twice? How does it behave if bytes is not a multiple of one sector?
Is it talking about the canonical 512-byte defintion of a sector or the actual 2048 byte
sectors used on CD-ROMs?
"bytes >> 9" is absolutely clear. I see instantly that it handles integer types and matches
the signedness. It is free from side effects and fast. I know that the answer is rounded
down to the nearest whole sector. Sectors are 512 bytes.
I don't see why you would want to hide all of that information from a developer. Your version
is only simpler at a quick glance to a casual observer, not someone who actually has to deal
with the code and what the statement actually does.
</pre></div>
Thu, 14 Feb 2008 06:38:52 +0000vmsplice(): the making of a local root exploit
https://lwn.net/Articles/269244/
https://lwn.net/Articles/269244/hmh<div class="FormattedComment"><pre>
Apparently, there is a lot more technical details to this exploit.
See <a href="http://article.gmane.org/gmane.linux.kernel/639206">http://article.gmane.org/gmane.linux.kernel/639206</a> for some very interesting info from an
anonymous source in .hu.
</pre></div>
Wed, 13 Feb 2008 20:32:55 +0000Bigger caches ? Where ?
https://lwn.net/Articles/269235/
https://lwn.net/Articles/269235/hmh<div class="FormattedComment"><pre>
In mainstream consumer CPUs, maybe the clocks have stabilized (which IS a good thing, we
already waste too much power just to do office work).
Look at the IBM Power6 for some high-clock cores...
</pre></div>
Wed, 13 Feb 2008 20:23:58 +0000vmsplice(): the making of a local root exploit
https://lwn.net/Articles/269141/
https://lwn.net/Articles/269141/dw<div class="FormattedComment"><pre>
As a matter of diligence I (like many, many people) document large swathes of my code in the
form of comments. Basically anywhere it has taken me more than a moment to think about, or
where the purpose of the code cannot be inferred by reading API documentation for the calls
made inside it.
Magical integer literals and bitshifts fall well within this purview, and I cannot see it as
"noobness" in these two specific cases. Imagine someone had to go back and fix all those
bitshifts when we move to Some New Compiler (in Some Hypothetical Future). Can't be regexed,
no central place where a change can ripple through the tree, and utterly dangerous, say, if
this New Compiler takes advantage of the fact that bitwise right shift on a signed number is
undefined according to ANSI C (I'm taking this as one, single example. There are hundreds
more).
I understand that other peoples' code is difficult to comprehend. Hell, I've read more than my
fair worth of Other Peoples' Code. I'm talking specifically about why the Linux kernel seems
to be so full of this, but other commenters have given good reasons for some of this already.
</pre></div>
Wed, 13 Feb 2008 18:03:25 +0000vmsplice(): the making of a local root exploit
https://lwn.net/Articles/269117/
https://lwn.net/Articles/269117/landley<div class="FormattedComment"><pre>
So code other people wrote is harder for you to read than code you wrote.
Join the club. For code you wrote, you'd better have a complete
theoretical model in your head or it won't work. For other people's code,
you're trying to reverse engineer their thought process by taking apart a
machine they built.
So if you haven't figured out yet that source code is inherently harder to
read than it is to wrote, or that working code accumulates complexity as
it has to deal with a real world that does not cleanly match simple
theoretical models, you're definitely on the "newb" side rather than
the "professional" side.
Read this:
<a href="http://www.joelonsoftware.com/articles/fog0000000053.html">http://www.joelonsoftware.com/articles/fog0000000053.html</a>
And note how much else out there agrees with it:
<a href="http://www.spinellis.gr/codereading/">http://www.spinellis.gr/codereading/</a>
<a href="http://withoutane.com/rants/2007/when-you-read-code">http://withoutane.com/rants/2007/when-you-read-code</a>
<a href="http://blogs.msdn.com/oldnewthing/archive/2007/04/06/2036150.aspx">http://blogs.msdn.com/oldnewthing/archive/2007/04/06/2036...</a>
and so on...
</pre></div>
Wed, 13 Feb 2008 17:34:21 +0000vmsplice(): the making of a local root exploit
https://lwn.net/Articles/269111/
https://lwn.net/Articles/269111/landley<div class="FormattedComment"><pre>
It's easier for you to read what you wrote than it is for you to read what
someone else wrote, therefore the problem is with the other person?
Reading code is always harder than writing code. When you write code, by
definition you have a working model of the code in your head and
understand all the concepts involved (or it won't work). When you read
someone else's code, even well commented source code, you're trying to
reverse engineer their thought process based on a machine they built which
was primarily designed to function, not to teach.
Beyond that, working code is often complicated because it has to deal with
the real world rather than a theoretical model.
Go read this:
<a href="http://www.joelonsoftware.com/articles/fog0000000069.html">http://www.joelonsoftware.com/articles/fog0000000069.html</a>
</pre></div>
Wed, 13 Feb 2008 17:09:06 +0000