LWN: Comments on "Remote root hole in Samba" https://lwn.net/Articles/491516/ This is a special feed containing comments posted to the individual LWN article titled "Remote root hole in Samba". en-us Sat, 13 Sep 2025 21:04:18 +0000 Sat, 13 Sep 2025 21:04:18 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net Remote root hole in Samba https://lwn.net/Articles/493394/ https://lwn.net/Articles/493394/ cmccabe <div class="FormattedComment"> Let's look at the orignial post that started this thread.<br> <p> <font class="QuotedText">&gt; Programs in OpenBSD chroot have access to all the syscalls.</font><br> <font class="QuotedText">&gt; Probably at least several of them are vulnerable.</font><br> <p> Now we've digressed into looking at a bunch of Linux (NOT OpenBSD) security flaws. How does this help you prove that OpenBSD is insecure?<br> <p> Secondly, privilege separation, BSD jails, SELinux, ASLR, etc are still useful technologies even if they don't block 100% of exploits. I think most system administrators would consider being vulnerable to one exploit per year a VERY good record, for any of the major three platforms.<br> </div> Thu, 19 Apr 2012 20:46:58 +0000 Remote root hole in Samba https://lwn.net/Articles/492560/ https://lwn.net/Articles/492560/ spender <div class="FormattedComment"> Don't forget perf_counter() ;)<br> <p> <a href="http://www.youtube.com/watch?v=KvREwhfQmbc">http://www.youtube.com/watch?v=KvREwhfQmbc</a><br> </div> Sun, 15 Apr 2012 23:48:56 +0000 Remote root hole in Samba https://lwn.net/Articles/492548/ https://lwn.net/Articles/492548/ Cyberax <div class="FormattedComment"> <font class="QuotedText">&gt;First of all, we were talking about OpenBSD, not Linux. Secondly, if you're so sure that "some of them are buggy", you should find out which ones. I'm sure that the reward will be a lot greater than $1000.</font><br> <p> I'm absolutely sure that Linux right now has multiple exploitable local vulnerabilities. <br> <p> <font class="QuotedText">&gt;However, most of those privilege escalations didn't involve insecure system calls. In fact there's only one that I can think of which did (maybe others can think of more).</font><br> <p> Whut? <br> <p> <a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2009-0029">http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2009-0029</a><br> <a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2010-3301">http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2010-3301</a><br> <a href="http://xorl.wordpress.com/2011/04/25/cve-2011-1593-linux-kernel-proc-next_pidmap-invalid-memory-access/">http://xorl.wordpress.com/2011/04/25/cve-2011-1593-linux-...</a><br> ...<br> <p> It's like a clockwork! At least one local exploit a year.<br> </div> Sun, 15 Apr 2012 20:58:23 +0000 Remote root hole in Samba https://lwn.net/Articles/492535/ https://lwn.net/Articles/492535/ cmccabe <div class="FormattedComment"> First of all, we were talking about OpenBSD, not Linux. Secondly, if you're so sure that "some of them are buggy", you should find out which ones. I'm sure that the reward will be a lot greater than $1000.<br> <p> I think what may be confusing you is the fact that there have been a lot of privilege escalations in Linux over the years (although not in OpenBSD, which is what we were talking about-- remember?). However, most of those privilege escalations didn't involve insecure system calls. In fact there's only one that I can think of which did (maybe others can think of more).<br> </div> Sun, 15 Apr 2012 17:23:46 +0000 Remote root hole in Samba https://lwn.net/Articles/492452/ https://lwn.net/Articles/492452/ andres <div class="FormattedComment"> Your last two posts in this thread clearly show you have no idea what you're talking about.<br> <p> systrace is only "vunerable" to TOCTOU/TOATOU if your policy involves checking pointer arguments.<br> <p> systrace policies such as ssh's block entire syscalls outright; they don't check arguments. As such, those policies are not vulnerable.<br> </div> Sat, 14 Apr 2012 20:37:28 +0000 Remote root hole in Samba https://lwn.net/Articles/492420/ https://lwn.net/Articles/492420/ mmorrow <div class="FormattedComment"> Ah true, fat-pointers to zero-width memory blocks do appear to give a way to map "int" into "(void*)" in a controlled way.<br> </div> Sat, 14 Apr 2012 14:20:03 +0000 Remote root hole in Samba https://lwn.net/Articles/492413/ https://lwn.net/Articles/492413/ khim <blockquote><font class="QuotedText">It seems to me that a in conforming implementation which uses fat-pointers, the only possible way the above could be implemented is to implement all such (void*)(int) casts as resulting in NULL.</font></blockquote> <p>Not necessarily. 0 must be converted to NULL, but it's quite Ok to produce different pointers for different numbers. The simple way will be to just store given integer in the “address” part of pointer and store zero in “width” part of pointer. This will give you different yet equally unusable pointers.</p> Sat, 14 Apr 2012 12:17:06 +0000 Remote root hole in Samba https://lwn.net/Articles/492370/ https://lwn.net/Articles/492370/ mmorrow <div class="FormattedComment"> (or replace "p==NULL" with "undefined behaviour", but the question remains "Is this permissible?")<br> </div> Fri, 13 Apr 2012 22:49:05 +0000 Remote root hole in Samba https://lwn.net/Articles/492366/ https://lwn.net/Articles/492366/ mmorrow <div class="FormattedComment"> True, supporting {,u}intptr_t is optional. Though, (void*)(int) is still allowed. Consider:<br> <p> int x;<br> void *p;<br> x = ..;<br> assert(x);<br> p = (void*)x;<br> assert(p==NULL); /*only possibility for a fat-pointer implem?*/<br> <p> It seems to me that a in conforming implementation which uses fat-pointers, the only possible way the above could be implemented is to implement all such (void*)(int) casts as resulting in NULL. Whether this is permissible I'm not certain.<br> <p> </div> Fri, 13 Apr 2012 22:42:27 +0000 Remote root hole in Samba https://lwn.net/Articles/492240/ https://lwn.net/Articles/492240/ nix <div class="FormattedComment"> That's trivially implementable with fat pointers, because one turns into<br> <p> (*(p+(5)))<br> <p> while the other turns into<br> <p> (*((5)+p))<br> <p> and addition is commutative: the type of the entire expression is typeof(p) in both cases by the C type conversion rules, so the 5 is multiplied by sizeof(*p) in both cases.<br> <p> So this is perfectly expressible without requiring either flat memory or any form of out-of-object or untyped addressing.<br> </div> Fri, 13 Apr 2012 12:57:14 +0000 Remote root hole in Samba https://lwn.net/Articles/492179/ https://lwn.net/Articles/492179/ khim <blockquote><font class="QuotedText">This is not forbidden by ISO C11.<br /><br /> [7.20.1.4.1] states:<br /> "[intptr_t] designates a signed integer type with the property that any valid pointer to void can be converted to this type, then converted back to pointer to void, and the result will compare equal to the original pointer[.]"</font></blockquote> <p>You are correct, of course. My bad. <b>If</b> intptr_t exist in a given implementation then you must be able to do such conversion - but it's clearly optional as noted in the very same 7.20.1.4.1 paragraph.</p> Fri, 13 Apr 2012 04:18:34 +0000 Remote root hole in Samba https://lwn.net/Articles/492173/ https://lwn.net/Articles/492173/ mmorrow <div class="FormattedComment"> <font class="QuotedText">&gt;&gt; My recollection is that you're permitted to cast e.g. a char* to an intptr_t</font><br> <p> <font class="QuotedText">&gt; Yes.</font><br> <p> <font class="QuotedText">&gt;&gt; and back again</font><br> <p> <font class="QuotedText">&gt; No. This is forbidden. There is one exception: you can assign null pointer constant...to pointer.</font><br> <font class="QuotedText">&gt; ...C11 ...</font><br> <font class="QuotedText">&gt; Other integers can not be assigned. Or rather: they can but the result is undefined behavior (as usual in C).</font><br> <p> This is not forbidden by ISO C11.<br> <p> [7.20.1.4.1] states:<br> <p> "[intptr_t] designates a signed integer type with the property that any valid pointer to void can be converted to this type, then converted back to pointer to void, and the result will compare equal to the original pointer[.]"<br> <p> It seems that you are taking [6.5.16.1] (second to last item):<br> <p> "the left operand is [a]...pointer, and the right is a null pointer constant..."<br> <p> to mean that this is the *only* way that a pointer can be assigned an integral value (constant or otherwise). However, consider [6.5.4.3] (emphasis added):<br> <p> "Conversions that involve pointers, *other that where permitted by the constraints of 6.5.16.1*, shall be specified by means of an explicit cast."<br> <p> So, the null pointer constant is just the only integral value you can assign to a pointer *without an explicit cast*.<br> <p> (By pure coincidence the C11 spec happens to be on my desk at arms length ;)<br> </div> Fri, 13 Apr 2012 02:29:44 +0000 Remote root hole in Samba https://lwn.net/Articles/492155/ https://lwn.net/Articles/492155/ nybble41 <div class="FormattedComment"> There is a footnote in the C99 draft standard to the effect that the intent was for the conversions to reflect the underlying machine architecture. Not a requirement, of course--just a suggestion.<br> <p> It's an application of the "principle of least surprise". On a machine with uniform, byte-addressable memory (unlike the iAPX 432), the least surprising integer representation of a pointer is the object's byte address, which can easily be converted in both directions without any loss of information.<br> <p> The standard does specify that you can convert any pointer to a char* and access the object one byte at a time. I'm not sure how one would reconcile that with a type-checked architecture like the iAPX 432.<br> </div> Thu, 12 Apr 2012 23:53:45 +0000 Remote root hole in Samba https://lwn.net/Articles/492147/ https://lwn.net/Articles/492147/ khim <blockquote><font class="QuotedText">While that seems to be the intent</font></blockquote> <p>This was never the intent. Remember the first C standard (ANSI C 89 or ISO 90) was developed when things like <a href="http://en.wikipedia.org/wiki/Intel_iAPX_432">iAPX 432</a> were supposed to be the future. Sure, this direction died off and we've got <a href="http://en.wikipedia.org/wiki/Intel_80386">IA-32</a> and <a href="http://en.wikipedia.org/wiki/PowerPC">PPC</a> instead, but language was defined to be usable on such architectures and in such systems. I suspect this is important for things like <a href="http://labs.adobe.com/technologies/alchemy/">Alchemy</a> today.</p> Thu, 12 Apr 2012 22:59:04 +0000 Remote root hole in Samba https://lwn.net/Articles/492141/ https://lwn.net/Articles/492141/ khim <blockquote><font class="QuotedText">My recollection is that you're permitted to cast e.g. a <code>char*</code> to an <code>intptr_t</code></font></blockquote> <p>Yes.</p> <blockquote><font class="QuotedText">and back again</font></blockquote> <p>No. This is forbidden. There is one exception: you can assign <i>null pointer constant</i> (which is <i>an integer constant expression with the value 0, or such an expression cast to type <b>void *</b></i>) to pointer. Yes, zero is special even in C11, not just in C++11! Other integers can not be assigned. Or rather: they can but the result is undefined behavior (as usual in C).</p> <p>This may be surprising to you but C does <b>not</b> require flat memory model and it does <b>not</b> guarantee the ability to create pointer from just some random sequence of bits.</p> Thu, 12 Apr 2012 22:52:04 +0000 Remote root hole in Samba https://lwn.net/Articles/492145/ https://lwn.net/Articles/492145/ nybble41 <div class="FormattedComment"> While that seems to be the intent, and the most common implementation, all I could find on the subject in the C99 draft standard is this:<br> <p> <font class="QuotedText">&gt; An integer may be converted to any pointer type. Except as previously specified, the result is implementation-defined, might not be correctly aligned, might not point to an entity of the referenced type, and might be a trap representation.</font><br> <p> <font class="QuotedText">&gt; Any pointer type may be converted to an integer type. Except as previously specified, the result is implementation-defined. If the result cannot be represented in the integer type, the behavior is undefined. The result need not be in the range of values of any integer type.</font><br> <p> So integer-pointer conversions either way are implementation-defined, and pointer-to-integer conversions invoke undefined behavior if the pointer cannot be represented as an integer, which would probably be the case for an implementation with large, bound-checked pointers.<br> </div> Thu, 12 Apr 2012 22:51:33 +0000 Remote root hole in Samba https://lwn.net/Articles/492128/ https://lwn.net/Articles/492128/ endecotp <div class="FormattedComment"> <font class="QuotedText">&gt; All such casts conveniently trigger undefined behavior </font><br> <font class="QuotedText">&gt; thus are not guaranteed to work</font><br> <p> My recollection is that you're permitted to cast e.g. a char* to an intptr_t and back again, and expect to get the same pointer that you started with.<br> </div> Thu, 12 Apr 2012 21:46:49 +0000 Remote root hole in Samba https://lwn.net/Articles/492119/ https://lwn.net/Articles/492119/ khim <blockquote><font class="QuotedText">As I understand, MCST guys have NOT made a safe hardware.</font></blockquote> <p>Yes, they did.</p> <blockquote><font class="QuotedText">It's all legal - we're not writing into uninitialized RAM and we're not casting pointers to ints.</font></blockquote> <p>No, it's illegal. They've used fat pointers thus <code>some_array</code> pointer is pointer with some base address and limit equal to 10. It's illegal to access 12th element using it.</p> <p>The whole OS was supposed to live in one huge flat address space thus it was important not only to distinguish pointers from non-pointers but also to distinguish “your pointers” from “someone else's pointers”. This is impossible to do without boundary checking.</p> <blockquote><font class="QuotedText">Besides, E2k is vaporware anyway.</font></blockquote> <p>Well, YMMV. The last time they visited our office they had chip but no chipset. Motherboard with tiny cheap CPU and three huge expensive FPGAs (with chipset) is not exactly something you can sell, but it's real in some sense.</p> Thu, 12 Apr 2012 20:39:14 +0000 Remote root hole in Samba https://lwn.net/Articles/492116/ https://lwn.net/Articles/492116/ Cyberax As I understand, MCST guys have NOT made a safe hardware. They've just implemented pointer tagging. It's more than possible to have unsafe operations there.<br/> <br/> For example:<br/> <pre> int some_array[10]; int some; int permissions[3]; some_array[12]=0xFFFF; </pre> <br/> It's all legal - we're not writing into uninitialized RAM and we're not casting pointers to ints.<br/> <br/> Besides, E2k is vaporware anyway. Thu, 12 Apr 2012 20:27:02 +0000 Remote root hole in Samba https://lwn.net/Articles/492111/ https://lwn.net/Articles/492111/ khim <blockquote><font class="QuotedText">You can't add bounds checking in f() because it doesn't know the size of the array that ptr points to.</font></blockquote> <p>Well, with the existing ABI it does not know, but you can change the ABI. As I've said: <a href="http://lwn.net/Articles/492032/">it was done before</a>. Actually guys from MCST had hardware support, but it can be done entirely programmatically, too - just with bigger overhead.</p> <blockquote><font class="QuotedText">You might get quite a long way with that approach, but eventually you'll hit something like casting to/from integers that breaks it.</font></blockquote> <p>All such casts conveniently trigger undefined behavior thus are not guaranteed to work. Unions are especially nasty (this is where MCST guys needed hardware support to keep everything working safely and speedily), but yes, you can write entirely safe ISO C language if you want. Of course it's free(3) will probably be noop (or, alternatively malloc(3) can always return NULL) because you'll need to track all allocations, but it's doable.</p> Thu, 12 Apr 2012 20:16:27 +0000 Remote root hole in Samba https://lwn.net/Articles/492052/ https://lwn.net/Articles/492052/ endecotp <div class="FormattedComment"> <font class="QuotedText">&gt; [bounds checking] can be added by the compiler when compiling </font><br> <font class="QuotedText">&gt; C or C++ code while remaining entirely faithful to the language </font><br> <font class="QuotedText">&gt; standards for those languages.</font><br> <p> No it can't; consider this:<br> <p> int f(const int* ptr, size_t offset)<br> {<br> return ptr[offset];<br> }<br> <p> in another translation unit:<br> <p> int g()<br> {<br> int a[100];<br> return f(a,100);<br> }<br> <p> You can't add bounds checking in f() because it doesn't know the size of the array that ptr points to. You can't add bounds checking in g() because it doesn't know that 100 is being used as an array index.<br> <p> You can try to carry around the valid bounds of every pointer by making each pointer actually 3 addresses. You might get quite a long way with that approach, but eventually you'll hit something like casting to/from integers that breaks it.<br> </div> Thu, 12 Apr 2012 18:34:34 +0000 Remote root hole in Samba https://lwn.net/Articles/492032/ https://lwn.net/Articles/492032/ khim <p>It's possible to implement the full C standard using fat pointers (including 5[p] == p[5], of course). People from MCST did that with E2k. What they found out immediately after is the fact that real programs are not C-standard compliant. For example they sometimes want to convert pointer to suitably-sized int (which is allowed) and then back (which is not allowed).</p> Thu, 12 Apr 2012 16:56:09 +0000 Remote root hole in Samba https://lwn.net/Articles/492029/ https://lwn.net/Articles/492029/ Cyberax <div class="FormattedComment"> kcc probably doesn't implement all the C standard.<br> <p> For example, there's no way one can do: "5[p] == p[5]" with fat pointers.<br> </div> Thu, 12 Apr 2012 16:39:26 +0000 Remote root hole in Samba https://lwn.net/Articles/491986/ https://lwn.net/Articles/491986/ khim <p>You don't need GC. The things which you can not include are free(3) and realloc(3): without tracing pointers you can not say if it's safe to decallocate memory or not if you trace pointers anyway then why will you need free(3) or realloc(3)?</p> <p>Usually the safe alternative is some kind of GC (refcounting GC works fine and often presents the best practical compromise), but other schemes are possible (for example you can allocate memory statically or use arenas which can be freed in safe way).</p> Thu, 12 Apr 2012 14:41:30 +0000 Remote root hole in Samba https://lwn.net/Articles/491967/ https://lwn.net/Articles/491967/ cesarb <div class="FormattedComment"> <font class="QuotedText">&gt; Sure. You need mandatory GC and range checks. If your language has them then it can be made safe.</font><br> <p> Why do you need GC to make a safe language?<br> </div> Thu, 12 Apr 2012 13:57:08 +0000 Remote root hole in Samba https://lwn.net/Articles/491951/ https://lwn.net/Articles/491951/ epa <div class="FormattedComment"> Interesting, thanks.<br> </div> Thu, 12 Apr 2012 12:40:51 +0000 Remote root hole in Samba https://lwn.net/Articles/491947/ https://lwn.net/Articles/491947/ epa <blockquote>Bounds checking requires ALL pointers to carry the size of the block of RAM they're pointing to. C standard does not allow this.</blockquote> Technically, this is not correct - for example <a href="http://code.google.com/p/c-semantics/">kcc</a> is a compiler which conforms to the C standard and also checks all pointer accesses. But the code runs very slowly. In practice, you are right that it is not possible to check *all* pointer accesses without cumbersome runtime machinery. <p> However I wasn't suggesting that; only checking of array bounds in something like <code>a[i]</code>. If you wanted to defeat the bounds checking it would be easy to say <code>*(&amp;a[0] + 500)</code> but we are not trying to make a managed language like Java in which raw memory access is impossible - only to convert a good chunk of bugs from remote-root holes into mere denial-of-service attacks. <p> Again, to be clear, I am not saying that C should change into a language where every pointer has to carry type information or where raw pointer access is forbidden. (Even though that would in theory be possible while still implementing the C standard, as the link above shows.) I am only saying that array accesses should have simple bounds checking that the offset is between 0 and (length-1), that this bounds checking be inserted by the compiler in cases where it adds only a small runtime overhead, and that there be an easy way to turn it off again if the programmer needs every drop of performance. <p> I have to admit that I have not examined the code mentioned in this advisory and that when it talks about 'array' access being out of bounds, it could in fact be some complex pointer manipulation. It might not be possible for a compiler to add bounds checking to that without adding runtime type information, as you say. In which case simple bounds checking would not have stopped this particular root exploit. Thu, 12 Apr 2012 12:39:28 +0000 Remote root hole in Samba https://lwn.net/Articles/491943/ https://lwn.net/Articles/491943/ jelmer <div class="FormattedComment"> Samba uses a domain-specific language (IDL) to describe the various DCE/RPC calls. Our IDL compiler (pidl) is then used to generate the pack/unpack code in C.<br> <p> This security issue was caused by a bug in the IDL compiler's generation of the bounds checking code for some arrays. <br> </div> Thu, 12 Apr 2012 12:09:27 +0000 Remote root hole in Samba https://lwn.net/Articles/491934/ https://lwn.net/Articles/491934/ Cyberax <div class="FormattedComment"> <font class="QuotedText">&gt;I am not really saying that the 'language' should include bounds checking. The semantics of C do not need to change. As far as I know, an out-of-bounds array access is already an operation with undefined behaviour, so the compiler is free to add bounds checking to the generated code while remaining a correct C compiler.</font><br> <p> Nope. Bounds checking requires ALL pointers to carry the size of the block of RAM they're pointing to. C standard does not allow this.<br> <p> Cyclone ( <a href="http://en.wikipedia.org/wiki/Cyclone_%28programming_language%29#Pointer.2Freference_types">http://en.wikipedia.org/wiki/Cyclone_%28programming_langu...</a> ) does this by having each pointer carry its length in a separate variable.<br> <p> In Java/C#/Go/... pointers are forbidden entirely and only references to objects of statically known size are allowed.<br> </div> Thu, 12 Apr 2012 11:42:36 +0000 Remote root hole in Samba https://lwn.net/Articles/491921/ https://lwn.net/Articles/491921/ epa <div class="FormattedComment"> Well, whatever the arguments about using C or C++ for new projects (and I don't want to get into a language war) there is certainly a lot of existing code in these languages.<br> <p> My point is that bounds checking is not something which requires changing your programming language. It can be added by the compiler when compiling C or C++ code while remaining entirely faithful to the language standards for those languages.<br> <p> </div> Thu, 12 Apr 2012 10:42:18 +0000 Remote root hole in Samba https://lwn.net/Articles/491919/ https://lwn.net/Articles/491919/ epa <div class="FormattedComment"> I am not really saying that the 'language' should include bounds checking. The semantics of C do not need to change. As far as I know, an out-of-bounds array access is already an operation with undefined behaviour, so the compiler is free to add bounds checking to the generated code while remaining a correct C compiler.<br> <p> It would however make sense to provide a simple pragma to turn off bounds checking for performance-critical code. I would expect that the developers of a program like Samba would choose not to use that pragma in a part of the code that parses untrusted user requests. It's not that the developers deliberately chose to write their program in an unsafe style in order to squeeze out an extra one per cent of performance. Rather, the available tools made it hard for them to make it safe.<br> <p> Make it easy to be safe - make bounds checking on by default - and provide a simple way for programmers to choose the riskier option if they choose to.<br> </div> Thu, 12 Apr 2012 10:38:10 +0000 Safety https://lwn.net/Articles/491917/ https://lwn.net/Articles/491917/ epa <div class="FormattedComment"> I know that array bounds checking does not catch all memory trampling bugs, particularly in programs that use lots of pointers. My point is that it does catch a lot of them, and from the sound of the bug report it appears it would have caught this particular one.<br> <p> As with all security measures (or indeed anything), the fact that it would not eliminate the problem entirely is not a reason to take a reasonable step to reduce the problem.<br> </div> Thu, 12 Apr 2012 10:33:17 +0000 Remote root hole in Samba https://lwn.net/Articles/491885/ https://lwn.net/Articles/491885/ job <div class="FormattedComment"> When was the last vulnerability in the PHP interpreter discovered?<br> <p> Oh ... wait..<br> </div> Thu, 12 Apr 2012 09:00:14 +0000 Remote root hole in Samba https://lwn.net/Articles/491802/ https://lwn.net/Articles/491802/ Cyberax <div class="FormattedComment"> I'm absolutely sure that at least some of them are buggy. I can bet you $1000 that there'll be new local Linux kernel exploits within 2 years.<br> </div> Thu, 12 Apr 2012 00:03:54 +0000 Remote root hole in Samba https://lwn.net/Articles/491801/ https://lwn.net/Articles/491801/ Cyberax <div class="FormattedComment"> Sure. You need mandatory GC and range checks. If your language has them then it can be made safe.<br> </div> Wed, 11 Apr 2012 23:59:56 +0000 Remote root hole in Samba https://lwn.net/Articles/491798/ https://lwn.net/Articles/491798/ cmccabe <div class="FormattedComment"> If you have proof that any of the system calls in OpenBSD (or Linux, for that matter) are vulnerable, then you should post it. If not, I'm afraid this is starting to sound like FUD.<br> </div> Wed, 11 Apr 2012 23:42:42 +0000 Safety https://lwn.net/Articles/491790/ https://lwn.net/Articles/491790/ Kluge <div class="FormattedComment"> <font class="QuotedText">&gt;Wasn't that the idea behind Modula-2 (and subsequently Modula-3)?</font><br> <p> And also Delphi and Free Pascal, GNU Pascal, etc?<br> <p> AFAIK (speaking as occasional programmer; not an authority), those systems provide good, modern development environments. Not sure how safe they are compared to the C family.<br> </div> Wed, 11 Apr 2012 22:51:44 +0000 Remote root hole in Samba https://lwn.net/Articles/491783/ https://lwn.net/Articles/491783/ khim <blockquote><font class="QuotedText">So what percentage of google is written in C/C++ ?</font></blockquote> <p><b>A lot</b>. I'm not sure I can disclose the precise numbers, but most performance-critical pieces (such as search or ads where every saved millisecond can be translated directly to revenue) are written in C++.</p> <blockquote><font class="QuotedText">I have heard it is mostly java, python, and C/C++ in third place.</font></blockquote> <p>Nope. Python was never used for anything “heavy”. It think the heaviest python-based application is still <a href="http://www.niallkennedy.com/blog/2006/11/google-mondrian.html">Mondrian</a>. Python is used for monitoring, for creation of reports, that kind of stuff.</p> <p>When Google was startup it created plethora of languages (things like <a href="http://en.wikipedia.org/wiki/Sawzall_(programming_language)">Sawzall</a>), and new <a href="http://en.wikipedia.org/wiki/Domain_specific_language">DSL</a>s are introduced from time to time, but the main pillars are still C++ and Java.</p> <blockquote><font class="QuotedText">I don't think that google is a startup anymore.</font></blockquote> <p>Yup. That's why it uses industry-standard languages now.</p> <blockquote><font class="QuotedText">According to you, they should write everything in C/C++ because it is easier to find people who already know it.</font></blockquote> <p>Bingo! They do! Of course Java is even more popular thus less performance-critical pieces are written in Java.</p> <blockquote><font class="QuotedText">I believe that gmail is all python...</font></blockquote> <p>Well, the last time I've worked with GMail codebase was about three years ago and it was C++ backend and Java (and obviously JavaScript) in frontend. I know they did extensive redesign after that time so I'm not fully sure about the current split between Java and C++, but no, python was never under consideration. Beyond monitoring and report tools, that is.</p> Wed, 11 Apr 2012 22:36:43 +0000 Remote root hole in Samba https://lwn.net/Articles/491762/ https://lwn.net/Articles/491762/ lopgok <div class="FormattedComment"> So what percentage of google is written in C/C++ ?<br> I have heard it is mostly java, python, and C/C++ in third place.<br> Notice that java and python have<br> 1) bounds checked arrays<br> 2) memory management<br> <p> I don't think that google is a startup anymore.<br> <p> According to you, they should write everything in C/C++ because it is easier to find people who already know it.<br> <p> I believe that gmail is all python...<br> <p> </div> Wed, 11 Apr 2012 21:20:48 +0000 Remote root hole in Samba https://lwn.net/Articles/491705/ https://lwn.net/Articles/491705/ khim <blockquote><font class="QuotedText">In terms of economics there is no justification for writing an entire program in C. Time to develop, difficulity to maintain, lines of code, and security all point away from using C/C++.</font></blockquote> <p>This depends on your needs, really. How many OS kernel you can name written in Haskel? How many modern Web Browsers afre out there written in Lisp or even Java?</p> <blockquote><font class="QuotedText">Perhaps you should read Paul Graham about writing a web app for shopping carts. <a href="http://www.paulgraham.com/avg.html">http://www.paulgraham.com/avg.html</a></font></blockquote> <p>Yeah. That's good article. But you don't really need the whole behemoth. Single first footnote is more then enough:<br /> <blockquote>Viaweb at first had two parts: the editor, written in Lisp, which people used to build their sites, and the ordering system, written in C, which handled orders. The first version was mostly Lisp, because the ordering system was small. Later we added two more modules, an image generator written in C, and a back-office manager written mostly in Perl.<br /><br /> In January 2003, Yahoo released a new version of the editor written in C++ and Perl. It's hard to say whether the program is no longer written in Lisp, though, because to translate this program into C++ they literally had to write a Lisp interpreter: the source files of all the page-generating templates are still, as far as I know, Lisp code. (See <a href="http://www.paulgraham.com/quotes.html">Greenspun's Tenth Rule</a>.)</blockquote> <p>Erlang, Hakell, Lisp and other exotic languages work just fine for a startup (indeed they may be more effective then C/C++ depending on the task), but <b>they don't scale</b>. The very simple fact that you need someone with exotic skillset to develop such a thing means that when you grow beyond the startup phase you need to redo the thing in some other language… and you often lose so much in transition that sometimes your initial lead is not enough to survive.</p> <p>And if you are <b>not</b> a startup then it's easier to use language familiar to the people in your company rather then to try to find or train someone to use Scheme or something similar… which means C/C++ is often pretty damn good choice (if not the best one).</p> Wed, 11 Apr 2012 18:13:09 +0000