On Sun, Apr 27, 2014 at 4:27 AM, Steve Haflich <shaflich@gmail.com> wrote:
I agree with essentially everything in wglb's message, but (once again) I'll grumpily jump in to emphasize a point which I think many on this list have missed.


On Fri, Apr 25, 2014 at 1:20 PM, William Lederer <william.lederer@gmail.com> wrote:

I agree with the general sentiment that Lisp is a much safer language to build anything in. While several in this thread are pointing to bounds checking as one of the advantages that Lisp has over C and other languages, there is something else I find that is also very strong: It is easier to write programs about which a reader can reason about correctness. In Lisp, the programs tend to be closer to provable and errors are more evident. As in "obviously no deficiencies" vs "no obvious deficiencies".

But in my experience, vulnerabilities result from
  • Buffer Overflows/lack of bounds checking (Heartbleed and friends)
  • Configuration errors
  • Logic Flaws
  • Dangerous use of user input (leading to SQLi, XSS, XSRF)
  • Improper use of cryptography
  • Unclear protocol specification (leading to OpenSSL)
This (IMO entirely worthy and correct) summary can easily be misunderstood!  Lisp may be superior because it has bounds checking. (We've previously agreed that isn't guaranteed since it isn't in the ANS, and in any platform likely depends on optimization qualities, including the optimization qualities under which internal called routines were compiled.)  But bugs based on buffer overflow don't on normal operating systems in general involve bounds checking.  At some point on any modern OS, reading or writing to a socket stream will involve passing to the OS (generally via a thin user-mode C API layer like *nix read() and write(), or some socket analogue).  Neither Lisp nor C will provide any automatic bounds checking on such a call.  The OS treats the application's address space as a mostly-contiguous undifferentiated sea of bytes(*).  It doesn't matter that at the app level C also has this model of a sea of bytes, while in Lisp the ocean is run-time tagged into small plots.  That distinction disappears once one calls write(fd,buf,len).

The Lisp Machine in its several manifestations might be the only counterexample, since there was no C boundary over which to cross, and because type and bounds checking was performed for free in the microcode.  But Lisp machines aren't around any more largely because of the economy of scale.  The number of x86 and x64 processors on the planet must be nearly on the order of 10^9, while the number of Lisp machine processors never got out of the 10^5 range, so Intel and AMD etc. could justify huge investments making those processors 3 orders of magnitude faster in raw speed.  Lisp processors could not have kept up at bearable per-item cost.  Alas!


I think it is not only a question of level of investment or either a question of Lisp in hardware or an other higher language in hardware for that matter. There seems to be some physico-technical optimality point in question here at the hardware/software interface.  From my (fading?) memories of a past era I can somewhat recall that the last (I think) major CPU architecture that took security support seriously in hardware was the Intel iAPX 432, with multiple nested security rings in hardware/descriptor supported gates/instructions. (BTW, the 432 was meant to support Ada of all languages, not C or Lisp, but it was general-purpose enough).  And history has recorded how well this iAPX 432 architecture flew.

And while I am using the word "fly" I have that urge to ask you guys that question: What would you personally fly, software written in C or software written in Common Lisp?  And I mean it quite literally, with you sitting in the plane.  I think that the fact that one can seriously ask that question is one of the most significant evolution in the demands the general context presents to any programming language standard. In 1994 fly-by-wire was cutting edge and still quite experimental, now in 2014 it is the reality of every day on routine commercial flight.

I see (a somewhat revised?) Common Lisp as a very good starting point to address this new reality.
Better than C, that is for sure. (How can you even hope to make C more safe and secure and yet still
be C is beyond my understanding, FWIW).