Slashdot Mirror


DieHard, the Software

Roland Piquepaille writes "No, it's not another movie sequel. DieHard is a piece of software which helps programs to run correctly and protects them from a range of security vulnerabilities. It has been developed by computer scientists from the University of Massachusetts Amherst — and Microsoft. DieHard prevents crashes and hacker attacks by focusing on memory. Our computers have thousands times more memory than 20 years ago. Still, programmers are privileging speed and efficiency over security, which leads to the famous "buffer overflows" which are exploited by hackers."

230 comments

  1. Vista already doing some of this by PurifyYourMind · · Score: 4, Informative

    Along the same lines anyway... a new feature in Vista: Address space layout randomization (ASLR) is a computer security technique which involves arranging the positions of key data areas, usually including the base of the executable and position of libraries, heap, and stack, randomly in a process' address space. http://en.wikipedia.org/wiki/Address_space_layout_ randomization

    1. Re:Vista already doing some of this by Anonymous Coward · · Score: 5, Interesting

      This came out in OpenBSD 3.3 over three years ago. Nice to see Microsoft keeping up with the times.

    2. Re:Vista already doing some of this by PurifyYourMind · · Score: 1

      Doh! I should have known. :-)

    3. Re:Vista already doing some of this by Salvance · · Score: 4, Interesting

      Sure, but wouldn't it be better if everything ran in it's own virtual session (or within a virtual secure space)? This was Microsoft's original plan with it's Palladium component of Longhorn, but my understanding is that this was almost entirely scrapped to get Vista out the door.

      Part of the other problem is that most home users expect secure data, but they aren't willing to do anything about it (e.g. set up non-admin users, install virus checkers/firewalls/etc).

      --
      Crack - Free with every butt and set of boobs
    4. Re:Vista already doing some of this by Alien54 · · Score: 1

      So of course, the two systems will conflict with each other, and lock up the system tighter than the improper use of superglue in NSFW situations

      or randomly locate virtual memory around the HD without regard to pre-existing magnetic conditions.

      ;-)

      --
      "It is a greater offense to steal men's labor, than their clothes"
    5. Re:Vista already doing some of this by Jeremi · · Score: 1
      This came out in OpenBSD 3.3 over three years ago. Nice to see Microsoft keeping up with the times.


      Is this feature standard in Linux yet? I'd hate to see us OSS guys get shown up by Bill... ;^)

      --


      I don't care if it's 90,000 hectares. That lake was not my doing.
    6. Re:Vista already doing some of this by Ristretto · · Score: 5, Informative

      Hi Slashdot readers,

      DieHard's randomization is very different from what OpenBSD does, not to mention Vista's address-space randomization. I've added a note to the FAQs that explains the difference in some detail, and answers several other questions, but in short: "address-space randomization" randomizes the base address of the heap and also mmapped-chunks of memory, leaving the relative position of objects intact. By contrast, DieHard randomizes the location of every single object across the entire heap. It also goes further in that it prevents a wide range of memory errors automatically, like double frees and illegal frees, and effectively eliminates heap corruption.

      -- Emery Berger

    7. Re:Vista already doing some of this by jnf · · Score: 1

      Yea and was in PaX about 6 years ago, so much for being proactively secure.

    8. Re:Vista already doing some of this by truth_revealed · · Score: 1

      Die Hard uses the Flux Capacitor technology.

      Man, that's lame even by my standards.

    9. Re:Vista already doing some of this by strider44 · · Score: 4, Informative

      You could have just looked it up and seen that it's been in Linux for a similar length of time (in 2.6.x). I just googled for "linux address randomization" and clicked the top link.

    10. Re:Vista already doing some of this by Anonymous Coward · · Score: 0, Flamebait

      Yeah, so lets bash MS for doing a good thing

    11. Re:Vista already doing some of this by nacturation · · Score: 4, Informative

      Seems like OpenBSD's implementation does what DieHard claims, or at least some of it. See this interview from August 2005 for information:

      http://kerneltrap.org/node/5584

      Any thoughts?

      --
      Want to improve your Karma? Instead of "Post Anonymously", try the "Post Humously" option.
    12. Re:Vista already doing some of this by Tim+C · · Score: 3, Insightful

      Vista has been in development for around 5 years; unless you were expecting this to be released as a service pack for XP or Server 2003, what's your point? It's in MS's latest release, what more do you want? (Yeah, a shorter release cycle would be nice - except that then people would bitch about the upgrade treadmill...)

    13. Re:Vista already doing some of this by Anonymous Coward · · Score: 0

      Im not sure if your the main developer there. But checking what you do, I'd say you did a direct translation of what OpenBSD does over to Vista.

      Even though no source code has been transfered, I'd say this is pretty much a translation of what OpenBSD did.

      Please point to the source code you used for your flux version.

    14. Re:Vista already doing some of this by iamacat · · Score: 4, Informative

      No, it won't. Programs need to interoperate - you might want to explicitly upload a photo to shutterfly using your web browser, but you don't want a rogue website to just siphon off all your private photos by exploiting a memory bug in one of the endless plugins.

      The real solution is programming in a language with secure memory management, such as .Net, Java or even LISP. I suspect that overhead is far smaller than running 3 copies of the program at once like DieHard does.

    15. Re:Vista already doing some of this by Alioth · · Score: 2, Informative

      OpenBSD prevents double frees and illegal frees and heap corruption too, and has been doing so for at least a couple of years. The code is BSD licensed too, so you can use it in closed source products like Windows. OpenBSD also has had something called W^X (Write XOR execute) for several years now, even for CPU architectures that don't support making executable pages read-only.

    16. Re:Vista already doing some of this by Anonymous Coward · · Score: 0

      By contrast, DieHard randomizes the location of every single object across the entire heap. It also goes further in that it prevents a wide range of memory errors automatically, like double frees and illegal frees, and effectively eliminates heap corruption

      Yep, just like OpenBSD's malloc does. Not much contrast there, fanboi.

    17. Re:Vista already doing some of this by Ristretto · · Score: 5, Informative
      Hi,

      Here's a more detailed answer -- I'll add it to the FAQ.

      OpenBSD (a variant of PHKmalloc) does some of what DieHard's allocator does, but DieHard does much more. On the security side, DieHard adds much more "entropy"; on the reliability side, it mathematically reduces the risk that a programmer bug will have any impact on program execution.

      OpenBSD randomly locates pages of memory and allocates small objects from these pages. It improves security by avoiding the effect of certain errors. Like DieHard, it is resilient to double and invalid frees. It places guard pages around large chunks and frees such large chunks back to the OS (causing later references through dangling pointers to fail unless the chunk is reused). It attempts to block some buffer overflows by using page protection. Finally, it shuffles some allocated objects around on a page, randomizing their location within a page.

      DieHard goes much further. First, it completely segregates heap metadata from the heap, making heap corruption (and hijack attacks) nearly impossible. On OpenBSD, a large-enough underflow on OpenBSD can overwrite the page directory or local page info struct (at the beginning of each page), hijacking the allocator. This presentation describes several ways OpenBSD's allocator can be attacked. By contrast, none of DieHard's metadata is located in the allocated object space.

      Second, DieHard randomizes the placement of objects across the entire heap. This has numerous advantages. On the security side, it makes brute-force attempts to locate adjacent objects nearly impossible -- in OpenBSD, knowing the allocation sequence determines which pages objects will land on (see the presentation pointed to above).

      DieHard's complete randomization is key to provably avoiding a range of errors with high probability. It reduces the worst-case odds that a buffer overflow has any impact to 50%. The actual likelihood is even lower when the heap is not full. DieHard also avoids dangling pointer errors with very high probability (e.g., 99.999%), making it nearly impervious to such mistakes. You can read our PLDI paper for more details and formulae.

      -- Emery Berger

    18. Re:Vista already doing some of this by DrSkwid · · Score: 1

      Virtualisation adds another attack vector, suddenly ALL of your programs could be vulnerable.

      If your OS can only be trusted in a virtual environment, what's the point of using an OS at all?

      --
      There are places where the networks are not touching,and there are places where they are-Boeing's Lori Gunter
    19. Re:Vista already doing some of this by pcmanjon · · Score: 1

      Is this feature standard in Linux yet? I'd hate to see us OSS guys get shown up by Bill... ;^)
      You do know *BSD is open source software these days, right?

    20. Re:Vista already doing some of this by Thalagyrt · · Score: 1

      Gotta love the AC that calls the developer of the application the article's talking about a fanboi.

      --
      Buffalo buffalo Buffalo buffalo buffalo buffalo Buffalo buffalo!
    21. Re:Vista already doing some of this by cloudmaster · · Score: 1

      What? OpenBSD is Open Source Software? How are common people supposed to know that?

    22. Re:Vista already doing some of this by DeadboltX · · Score: 1

      Windows XP is over 4 years old and this is their first new release since then.
      One could argue that Microsoft could have put this in SP1 or even SP2 but I am no expert and have no idea if implementing it in Windows XP would even be plausible or if it would mess up too much stuff or cause old programs to stop working.
      Since Vista is the first new release of Windows since XP a bit over 4 years ago it seems a bit harsh to call Microsoft out about being behind the times.

    23. Re:Vista already doing some of this by Anonymous Coward · · Score: 0

      in it's own
      with it's Palladium

      "its".

  2. Different program? by Anonymous Coward · · Score: 2, Informative

    I thought DieHard was a random number generator test suite. It is annoying when people dont even look around for other programs with the same name and do similar things.

    1. Re:Different program? by j00r0m4nc3r · · Score: 4, Funny

      Yeah, he should have named his project Die Harder

    2. Re:Different program? by baldass_newbie · · Score: 3, Funny

      Or DieHardWithAVengeance...

      --
      The opposite of progress is congress
    3. Re:Different program? by RAMMS+EIN · · Score: 1

      ``I thought DieHard was a random number generator test suite.''

      So it is. Speaking of which, does anyone here know how to interpret the numbers it generates? I ran it on the deadbeef random number generator a while ago (test results linked from that page), and my interpretation is that deadbeef_rand does well on some tests and very poorly on others. Am I right? Can one distill from DieHard's output what the weaknesses of the PRNG are?

      --
      Please correct me if I got my facts wrong.
    4. Re:Different program? by Werkhaus · · Score: 5, Funny

      I thought the random number generator was DieBold?

    5. Re:Different program? by Joebert · · Score: 5, Funny

      No, you're thinking of the random Vote generator.

      --
      Wanna fight ? Bend over, stick your head up your ass, and fight for air.
    6. Re:Different program? by Anonymous Coward · · Score: 0

      Or follow Wil Wheaton's example and call it CleverProjectName.

    7. Re:Different program? by Anonymous Coward · · Score: 0

      Yes, and I hope George Marsaglia sues them for trademark infringement.

    8. Re:Different program? by gbobeck · · Score: 1
      Or DieHardWithAVengeance...

      That is so 1995. Update to 2007 and call it "Live Free or DieHard"
      --
      Navicula hydraulica plena anguilarum est. Omnes castelli tuus nostri sunt. Ed elli avea del cul fatto trombetta.
    9. Re:Different program? by pacinpm · · Score: 2, Insightful

      Problem is it is not so random.

    10. Re:Different program? by the_doctor_23 · · Score: 1

      Then it is not very good.

      --
      "Extraordinary claims require extraordinary evidence" - Carl Sagan
    11. Re:Different program? by wolverine1999 · · Score: 1

      You are right, it is. This is something else with the same name....

  3. Correction by realmolo · · Score: 4, Insightful

    "Still, programmers are privileging speed and efficiency over security..."

    Speed and efficiency of *development*, maybe.

    Which is the problem. Modern software is so dependent on toolkits and compiler optimizations and various other "pre-made" pieces, that any program of even moderate complexity is doing things that the programmer isn't really aware of.

    1. Re:Correction by MBCook · · Score: 4, Insightful

      This is one of the arguments for a language running on a VM like Java, C#, or Python. They can do runtime checking of array bounds and such and throw an exception or crash instead of silently overwriting some other variable that only may or may not cause a crash or some other noticeable side effect later.

      --
      Comment forecast: Bits of genius surrounded by a sea of mediocrity.
    2. Re:Correction by AKAImBatman · · Score: 4, Insightful
      "Still, programmers are privileging speed and efficiency over security..."

      Speed and efficiency of *development*, maybe.

      No, it was right the first time. Java is several orders of magnitude more secure by default than any random C or C++ program. Yet mention Java on a forum like, say, Slashdot, and you'll hear no end to how much Java sucks because "it's slow". (Usually ignoring the massive speedups that have happened since they last tried it 1996.) It doesn't matter that the tradeoff for that speed is flexibility, security, and portability. They want things to be fast for some undefined quantity of fast.

      In fact, I predict that someone will be along to argue just how slow Java is in 3... 2... 1...
    3. Re:Correction by Anonymous Coward · · Score: 0

      Java is so slow that I had to hook up a calendar for my profiler! *rimshot*

    4. Re:Correction by Bill+Dog · · Score: 0, Flamebait
      They want things to be fast for some undefined quantity of fast.

      No, we want things to be as fast as they can be.

      From TFA:
      These problems wouldn't arise if programmers were a little less focused on speed and efficiency, which is rarely a problem these days, and more attentive to security issues, says Berger.
      He must be criticizing open source programmers only. Because in business, programmers aren't focussed on speed and efficiency, they're focussed on what their bosses are breathing down their necks about: getting it out the door. Berger sounds like a VM-language bigot (or paid ($30K from MS) .Net Runtime shill) who doesn't understand how most software is really made, and prefers to believe in caricatures of programmers.
      --
      Attention zealots and haters: 00100 00100
    5. Re:Correction by TopSpin · · Score: 1

      Speed and efficiency of *development*, maybe. Which is the problem. Modern software is so dependent on toolkits and compiler optimizations and...

      I wondered where all those vulnerabilities were coming from. It's not humans misusing memory references and overrunning ad hoc fixed length buffers, etc. It's the toolkits, libraries and compilers! Glad we got that figured out.

      From the post:

      Our computers have thousands times more memory than 20 years ago. Still, programmers are privileging speed and efficiency over security...

      This implies is that because memory is larger less attention can be paid to efficiency, but the hapless programmers don't know better. I used to use quicksort when I had 640 KiB of RAM, but now that I have 8 GiB, I'll just use bubble sort. Brilliant.

      --
      Lurking at the bottom of the gravity well, getting old
    6. Re:Correction by Anonymous Coward · · Score: 4, Insightful

      No, we want things to be as fast as they can be.

      Maybe, but most programs are not written in a way which will achieve this goal.

      Programmer time is a limited resource. This is true even on a hobby project with no deadlines and everybody working for free; you want to ship sometime. Making programs run fast takes a lot of programmer time, even when you use a language which is supposedly fast by default such as C or C++.

      C and C++ make you spend a lot of time working around weaknesses in the language and fixing bugs that other languages can never have. A great deal of programmer time is put into developing the broken and slow implementation of half of Common Lisp that every sufficiently complex program must contain.

      All of this time spent is time that does not go into making the program fast.

      By using a language that makes programmers more productive, you get a lot more time to make the program fast. You can do this by optimizing in the "slow" language you started with, by rewriting inner loops in C, by changing the whole algorithm to run on the GPU, etc.

      The 90/10 rule says that your program spends 90% of its time in only 10% of its code, and that optimizing the other 90% of the code is basically a waste. And yet people who want their programs to "go fast" are writing that 90% in a low-level language, effectively wasting a large amount of effort.

      You may also end up getting your program working, realize that it actually is fast enough despite being written in a really slow interpreted language, and spend the time you saved making more cool software. Or you can go back and make the original product fast. It's up to you.

      There are many good reasons to use C, and many good reasons to write entire programs in C, but "it's fast" is not a particularly good reason. An app written in pure C is probably not as fast as it can be unless its scope is very limited.

    7. Re:Correction by Jeremi · · Score: 3, Insightful
      He must be criticizing open source programmers only. Because in business, programmers aren't focussed on speed and efficiency


      Business software isn't the problem. The software that is the problem is the software that runs on every naive home user's PC ... Windows, Outlook, IE, Mozilla, AIM, etc etc. This is the software whose security problems allow spam, credit card fraud, virus outbreaks, etc. And last time I checked, all of that stuff is still written in C or C++, not in any VM.


      Berger sounds like a VM-language bigot (or paid ($30K from MS) .Net Runtime shill)
      who doesn't understand how most software is really made, and prefers to believe in caricatures of programmers.


      Great, you've called the guy a bigot, a shill, and an idiot, without even having understood what he was talking about.

      --


      I don't care if it's 90,000 hectares. That lake was not my doing.
    8. Re:Correction by dodobh · · Score: 1

      As a user, my concern isn't about development time at all. It's about how the application consumes my resources. Java is great on the server side (one app, long run times, lots of memory). On the desktop side? Not yet (less memory, lots of concurrent apps, short run times for most apps).

      --
      I can throw myself at the ground, and miss.
    9. Re:Correction by evilviper · · Score: 3, Interesting
      It doesn't matter that the tradeoff for that speed is flexibility, security, and portability. They want things to be fast for some undefined quantity of fast.

      I've got to call you on the "portability" crap.

      Java is about as portable as Flash... Sure, the major platforms are supported, but that's it. 3rd parties spent a lot of time trying to impliment java, but never did get everything 100%. Licensing issues, above all else, made it a real hassle to get Java on platforms like FreeBSD.

      Meanwhile, C and C++ compiler are installed in the base system by default.

      The only "portability" advantage Java has is perhaps in GUI apps, and that's at the expense of a program that doesn't look or work remotely similar to any other app on the system...

      There are a great many reasons people don't use java. Performance is only a minor one.
      --
      Slashdot gets worse every day... Pipedot: News for nerds, without the corporate slant
    10. Re:Correction by Anonymous Coward · · Score: 5, Insightful

      "Java is slow" is the stated reason. As you noted, it is not the actual reason. To tell the actual reason is difficult, but in short Java reminds us too much of what it should have been.

      The basic complaints I have heard are these:

      Complaint 1: Java is slow.
        As you stated, this is not a meaningful complaint.

      Complaint 2: Garbage Collection stinks
        GC is an obvious requirement of a "safe" language. As implemented in Java, it is downright stupid. When doing something CPU intensive, the GC never runs, leading to gobbling up memory until there is no more and thrashing to death. I'm sure that somebody is going to dig up that paging-free GC paper, but pay attention: that is a kernel-level GC.

      Complaint 3: Swing is ugly/leaks memory
        The first is a matter of opinion. The second is well-known. Swing keeps references to long-dead components hidden in internal collections leading to massive memory leaks. These memory leaks can be propagated to the parent application if it is also written in Java.

      Complaint 4: Bad build system
        Java cannot do incremental builds if class files have circular references. In a small project of about ten classes I was working on, the only way to build it was "rm *.class ; javac *.java"

      Complaint 5: Tied class hierarchy to filesystem hierarchy
        This was just stupid and interacts badly with Windows (and anything else with a case insensitive filesystem). It is even worse for someone who is first learning the language. It also makes renaming classes have a very bad effect on source control.

      Complaint 6: Lack of C++ templates
        C++ has some of its own faults. Fortunately its template system can be leveraged to fix quite a few of them. Java's generics have insufficient power to do the same thing.

      Complaint 7: Lack of unsigned integer
        These are oh-so-necessary when doing all kinds of things with binary formats. Too bad Java and all its descendents don't have them.

      Complaint 8: Verbosity without a point
        It has gotten so bad in places that I am strongly tempted to pass Java through the C preprocessor first, but I can't do that very well because of 4.

    11. Re:Correction by Anonymous Coward · · Score: 0
      by rewriting inner loops in C

      Been there, done that, with a twist. The original loop was a nice find/replace loop in Word automation. Knowing for certain this was a bottleneck and also knowing the code would be ugly no matter what language it was in,
      I didn't bother rewriting in .NET first but went straight to C. Having pointer arithmetic actually made the problem easier despite finding several pointer-related bugs, so big win there.
    12. Re:Correction by M.+Baranczak · · Score: 1

      Licensing issues, above all else, made it a real hassle to get Java on platforms like FreeBSD. Sun just formally announced that they'll release Java under the GPL.
    13. Re:Correction by Anonymous Coward · · Score: 0

      Complaint 8: Verbosity without a point

      This was bad in C++ (I blame iostreams for leading down that path) and got a million times worse in java. Seriously, something like 'parse this coma delimited string and pull out the numbers as hex digits, then pack the result into an array" should be 10 lines of code *max* including robust error checking - java turns this simple example into a giant silly game that is verbose for ZERO gain. Long type and functions names, multiple type swaps, and pulling in an extra library or two. The C++ situation is no better.

      Sometimes the "do what I say, exactly that, and nothing more" approach of C is the right approach.

    14. Re:Correction by tulrich · · Score: 2, Insightful
      Java is several orders of magnitude more secure by default than any random C or C++ program.

      Do you know what "several orders of magnitude" means? For variety, next time you should write "... exponentially more secure ..." or "... takes security to the next level!"

      BTW, it's funny you should mention Java performance in this thread -- one of the DieHard authors published this fascinating paper on Java GC performance: http://citeseer.ist.psu.edu/hertz05quantifying.htm l -- executive summary: GC can theoretically be as fast as explicit malloc/free, if you're willing to spend 5x memory size overhead (gulp).

    15. Re:Correction by chromatic · · Score: 1

      When they finish the process, the Java portability problem will start to go away.

    16. Re:Correction by owlstead · · Score: 1

      It does not have to be *as* fast as malloc/free. It needs to be sufficiently fast to run applications with. Explicit malloc/free's are very problematic, you need to keep score of each object, and that is not always easy to do. At least it is already much faster (the default GC of Java) than smart pointers (reference counting), which is the direct opponent against the GC I suppose.

      And I agree, speaking on "several orders of magnitude" is taking it a bit far. It's much more secure, but since security is *very* hard to quantisize, talking of things like magnitude is stretching it. The idea still seems correct though, buffer overruns are virtually non-existent in Java. And applications generally don't crash with "this program referenced memory on 00000000h" or cryptic messages like that.

      Which is also the problem with this approach, you still will be able to perform a buffer overrun, only the application will crash, enabling a denial of service attack. With cryptic error messages etc.

    17. Re:Correction by tulrich · · Score: 1

      Which is also the problem with this approach, you still will be able to perform a buffer overrun, only the application will crash, enabling a denial of service attack. With cryptic error messages etc.

      A crash is the best thing for this situation. Much better than undefined (possibly exploitable) behavior. The log should not be cryptic; it should contain a backtrace showing you where your code was when it died. Not very different than a Java exception log.

    18. Re:Correction by WNight · · Score: 1

      Ruby:
      "12,2a,3f".split(',').collect {|num| num.to_i 16 }
      => [18, 42, 63]

      And I got to write/test it interactively... I do agree about needless verbosity. Most programs would be better finished than optimized, code them in Ruby or Python and optimize any speed critical areas with C or anything else. C *is* premature optimization.

    19. Re:Correction by Lisandro · · Score: 1

      C and C++ make you spend a lot of time working around weaknesses in the language and fixing bugs that other languages can never have. A great deal of programmer time is put into developing the broken and slow implementation of half of Common Lisp that every sufficiently complex program must contain.

      One mans' weakness is another mans' strength. If you have to spend a lot of time to implement functionality missing from a language, perhaps you chose the wrong tool for the work. This is one of my peeves with the endless Java-vs-C arguments: ok, you think language "x" is better... to do what, exactly? I wouldn't write a device driver with Java just as i wouldn't write web applets in C.

      Don't get me wrong, i wouldn't write much in Java anyway, as i hate the language with a passion (i think there're much better choices for interpreted/bytecoded languages), but discussing weaknesses must be done within a frame of reference.

    20. Re:Correction by smallfries · · Score: 2, Insightful

      This implies is that because memory is larger less attention can be paid to efficiency, but the hapless programmers don't know better. I used to use quicksort when I had 640 KiB of RAM, but now that I have 8 GiB, I'll just use bubble sort. Brilliant. You are really misrepresenting his point here. We both know that bubble sort would run much slower on a 8Gb dataset than quicksort. The real comparison is "should we some really tricky and nasty code for this particular function or should it be a giant lookup table?" When memory is (relatively) cheaper than processor time, the set of tradeoffs changes. Some of these tradeoffs then mean than code can be written more correctly (securely) at the expense of higher memory usage. These tradeoffs are intuitively bad to someone who cut their teeth on a 16bit processor with hardly any memory, but as I'm sitting writing this there is only 130Mb out of 1Gb in use (not counting the cache) - who is to say that doubling memory usage is bad if it removes a whole class of bugs and holes?
      --
      Slashdot: where don knuth is an idiot because he cant grasp the awesome power of php
    21. Re:Correction by hal9000(jr) · · Score: 1

      Ok, I wil bite. I am not a programmer, but a user and yes, Java apps are slow and tend to consume lots of memory and not let it go. I don't know if that is due to the language or the developers use of the language, but I do know that whatever the cause, the net effect is slow apps.

      Other issues, let's see, for some reason, firefox hangs when more than one java app is run in the browser. I see alot of Java apps where dialogs are non-modal (you can access/view one window at a time). Java apps aften *require* a specific version of the JVM and why for the of all that is holy can't a computer have multiple versions of the JVM and let the damn app choose the right interpreter? An example, Concur expense reporting application requires JRE 1.4.[something]. Nearly everything else that I use requires at least JRE 1.5. So I maintain a VMWare image just to interact with Concur. Now that makes sense. so there is also backward compatabilty. Java, write once, run everywhere. What a pipe dream.

    22. Re:Correction by DrSkwid · · Score: 1

      Java sucks because it's Java

      --
      There are places where the networks are not touching,and there are places where they are-Boeing's Lori Gunter
    23. Re:Correction by DrSkwid · · Score: 1

      and I thought Perl was the king of write only code

      --
      There are places where the networks are not touching,and there are places where they are-Boeing's Lori Gunter
    24. Re:Correction by ufoot · · Score: 0
      And last time I checked, all of that stuff is still written in C or C++, not in any VM.

      Not totally true. It's true that most of the *core* of these software is written in C/C++, but most of the time they end up using scripts. Take Mozilla for instance, you might think it's C/C++, but in fact running Mozilla you're very often running JavaScript code over XUL interfaces. So the design for these is rather logical: build up a core in the "as fast as possible language" (that is, C), then run scripts on top of it, in a very VM-like fashion. Of course you could build the core engine over Java, but then you would "sandbox" stuff twice. Once running a Java VM, then on top of it an XPFE (XUL+JavaScript and the rest) engine, then your application scripts, that is, Mozilla itself, which in turns interprets a third-party code (the HTML+JavaScript you actually want to read). That's a lot of software layers...

      Same thing for Apache, on any server I've seen in production, most of the CPU time is eaten in mod_php or mod_perl, that is, executing scripts.

      I don't think it's such a necessary move to use Java, as long as your program is complex enough to justify the creation of your own virtual & scriptable environnement. Java is of course an option, but using Python/Perl/Lua/Lisp/Ruby/... bindings is equally efficient.

    25. Re:Correction by Anonymous Coward · · Score: 0

      Complaint 7: Lack of unsigned integer
          These are oh-so-necessary when doing all kinds of things with binary formats. Too bad Java and all its descendents don't have them.

      So the actual problem is you need to handle binary formats and twiddle individual bits. In which case, just use a bitsream library, as I do.
    26. Re:Correction by WNight · · Score: 1

      If you could possibly post easier to understand code stand does the same, in any language including English, I would be interested in seeing it. Try not to use any obfuscated function names like split or collect though, they're so hard to read.

      id10t

    27. Re:Correction by arkanes · · Score: 1

      The equivalent Python: for num in "12,2a,3f".split(","): print int(num, 16) The least obvious bit is the need to tell int() (or to_i) to use base 16. A more exact Python version would be a list comprehension: [int(num, 16) for num in "12,2a,3f".split(",")] Which is slightly less readable to someone who doesn't know Python. I have only a very passing knowledge of Ruby but figured out what the snipped did without trouble.

    28. Re:Correction by sgtrock · · Score: 1
      Complaint 4: Bad build system
          Java cannot do incremental builds if class files have circular references. In a small project of about ten classes I was working on, the only way to build it was "rm *.class ; javac *.java"

      emphasis added

      I'm very surprised that no one else jumped on this one. I've never seen a well designed app that had circular references of any sort. I'll stipulate that such probably do exist, as there seems to be a case for doing things that would otherwise be dumb for just about any 'exception to the rule' that you could name. However, if you're designing your app correctly, shouldn't you be working hard to isolate your code enough that circular references aren't necessary?
    29. Re:Correction by Lord+of+Hyphens · · Score: 1

      Meanwhile, C and C++ compiler are installed in the base system by default.

      The major assumption that you've appeared to make is that people will compile from source (and so therefore portable C/C++ code is preferable to Java). Java's portability stems from its binary-compatibility, which is the desirable setup for light applications.

      Of course, Java's portability comes at the cost of looking completely like it's in its own little world most of the time (GUI) and some performance hits (which usually can be ignored unless you must have heavy time-critical computations running). Both of which you mentioned in your post.

      That all being said, I avoid Java whenever I can, because I have an irrational dislike of the language. :)

      --
      "I've spent my whole life figuring out crazy ways to do things. It'll work." -- Montgomery Scott, "Relics"
    30. Re:Correction by RAMMS+EIN · · Score: 3, Interesting

      In support of your point, I want to share the followind PDF: Lisp as an Alternative to Java. The study compares programs written in Java, C/C++ (they lump these togeter), and Common Lisp / Scheme (again, lumped together). The findings are basically:

      1. The fastest programs are written in C/C++
      2. On average, Lisp/Scheme programs are fasted, followed by C/C++ programs, and Java programs are way behind.
      3. Development time is shortest for Lisp/Scheme, with Java and C++ being more or less equal.
      4. C/C++ programs used the least memory, with Lisp/Scheme and Java being about equal.
      5. There was very little variation in the run time and development time of Lisp/Scheme programs, and a lot of variation everywhere else.

      The PDF contains some nice graphs illustrating all this.

      --
      Please correct me if I got my facts wrong.
    31. Re:Correction by typicallyterrific · · Score: 1

      Well, that's why you make it impossible for buffer overruns to occur in the first place.

      In any sufficiently important program, crashing and then throwing up in your lap (assuming the version crashing even was compiled with debugging info) is or should be completely unacceptable. Much better if the program can realize what's going wrong and work around it - whether that means re-asking the user for that input again, retrying reading the IO buffers or emailing a developer.

      The beauty about exceptions and error codes is that when they occur, you know something is wrong and can do something about it while the program is still running. Thats what they are for. No more of this silent, absurdly hard to find corruption of memory going on. If I don't have to manipulate memory directly, there is just should be no reason for me to have to worry about whether malloc is returning null or to have arrays allow me to access memory past their bounds anymore -- goddamnit, the compiler/interpreter can do that just fine, thank you.

      I haven't been programming for very long, but I can't think of too many situations where you absolutely *NEED* to be able to perform pointer arithmetic. And in those situations you probably can't or shouldn't use an interpreted, object oriented language to begin with.

      All of this is much, much better than spending time reinventing garbage collection with fewer features.

    32. Re:Correction by julesh · · Score: 1

      GC is an obvious requirement of a "safe" language.

      No, it isn't. Memory safety can be achieved without the use of garbage collection, by avoid reallocation of freed memory to a differently-typed object. Access to freed pointers can be caught by page table manipulation. Sure, there's an overhead to these techniques, but then there's a non-trivial overhead to GC as well.

      I'm sure that somebody is going to dig up that paging-free GC paper, but pay attention: that is a kernel-level GC.

      Which just indicates that there's been a lack of forethought in OS design resulting in the impossibility of implementing this at user level. I'm not sure, but pretty confident it could be done in user mode in a well-designed microkernel (e.g. L4). Not sure how relevant this is at this point, though. We've gone too far down the current line of OS development to just drop everything in favour of a new design just to be able to do a couple of neat tricks like this.

      Complaint 3: Swing is ugly/leaks memory
          The first is a matter of opinion.


      Yes, but it's a very popular opinion. Swing (and JDK) is also exceptionally slow. Most people don't realise it, but almost all of the slowness traditionally associated with Java can be attributed to those toolkits. Don't believe me? Try writing a program with another toolkit. I haven't tried it myself, but you could give wxjava a go.


      Complaint 4: Bad build system
          Java cannot do incremental builds if class files have circular references. In a small project of about ten classes I was working on, the only way to build it was "rm *.class ; javac *.java"


      Have you tried jikes? It has a superior incemental build system to sun's compiler. Not sure it'll fix your issue, but anything's possible.

    33. Re:Correction by Lumpish+Scholar · · Score: 1
      ... in business, programmers aren't focussed on speed and efficiency, they're focussed on what their bosses are breathing down their necks about: getting it out the door.
      Which means even less emphasis on security.
      Berger sounds like a VM-language bigot (or paid ($30K from MS) .Net Runtime shill) who doesn't understand how most software is really made ...
      Seems to me he's a researcher who's noticed that "most software is really made" by C and C++ programmers in a hurry. He's addressing the needs of developers (and users!) of such software.
      --
      Stupid job ads, weird spam, occasional insight at
    34. Re:Correction by durdur · · Score: 2, Informative

      > Sure, the major platforms are supported, but that's it

      What platforms do you want? Java is on 32- and 64-bit Windows, 32- and 64-bit Linux, Solaris (SPARC + Intel), AIX, HP-UX, OS X (Intel + PPC), IBM z/OS and iSeries, AND FreeBSD (http://www.freebsd.org/java/) among other platforms. FreeBSD guys negotiated a license (but with Java GPL now they won't need to in future).

      I would also disagree about portability of code. J2SE apps are very portable. Usually with zero platform specific code changes. J2EE is another story.

    35. Re:Correction by Pastis · · Score: 1

      So you're showing a survey made in 2000, ranking small developments (all under 100 hours) programmed by 14 volonteers. What does it prove ?

      First in the enterprise world, choise of technology is almost never dictated by pure engineering recommendations.
      Second in the same world, nobody is going to look at this survey to decide what language to use in their next project. Nobody.

      And I would suggest that hard code lisp developers are probably better developers on average than randomly selected java developers.

    36. Re:Correction by Abcd1234 · · Score: 1

      How is that write-only? I've never used Ruby, and I know exactly what that means. Anyone with even a little background in Smalltalk, Python, or Lisp should be able to figure that out.

      Perhaps you just need to further educate yourself?

    37. Re:Correction by drinkypoo · · Score: 1
      Complaint 1: Java is slow. As you stated, this is not a meaningful complaint. Complaint 2: Garbage Collection stinks GC is an obvious requirement of a "safe" language. As implemented in Java, it is downright stupid. When doing something CPU intensive, the GC never runs, leading to gobbling up memory until there is no more and thrashing to death. I'm sure that somebody is going to dig up that paging-free GC paper, but pay attention: that is a kernel-level GC.

      Complaint 2 leads to complaint 1 being correct. So it's not slow all the time - it's only slow when you need it most! Great. What a fucking feature.

      --
      "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
    38. Re:Correction by drinkypoo · · Score: 1
      We've gone too far down the current line of OS development to just drop everything in favour of a new design just to be able to do a couple of neat tricks like this.

      It's never a bad time to do things correctly. Marketing it is another issue. But I hope that the next open source phenomenon OS is something modern, not a rehashing of things ancient - no matter how much I love Linux, and I do.

      --
      "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
    39. Re:Correction by RAMMS+EIN · · Score: 1

      ``So you're showing a survey made in 2000, ranking small developments (all under 100 hours) programmed by 14 volonteers. What does it prove ?''

      Nothing, besides the performance of said programmers on one task. Which I thought was interesting enough to share.

      ``And I would suggest that hard code lisp developers are probably better developers on average than randomly selected java developers.''

      That's probably true, but that's not what the study is about. IIRC, the average Lisp experience of the Lisp coders in the study was less than the average Java experience of the Java coders. Still, you're right in that bias from programmer skill cannot be ruled out.

      --
      Please correct me if I got my facts wrong.
    40. Re:Correction by Anonymous Coward · · Score: 0

      Well, coming from someone used to Perl it's quite understandable, it just looks strange to me to call a member function (?) of a string literal. That is, assuming I'm right about what it is, and not just about what it does.

      Honestly, the data mixed in there threw me for more of a loop at first than the actual code.

    41. Re:Correction by Abcd1234 · · Score: 1

      Well, considering you can do that exact sort of thing in Java, Python, Perl 6, and probably most other conventional 'pure' object-oriented languages (Java isn't 'pure', in the strict sense, but it tries), I repeat, educate yourself! :) Experimenting with other languages and programming paradigms can really open your eyes to new development methods and techniques. It also gives you a larger number of tools, which means you'll do a better job picking the right one for a given task.

    42. Re:Correction by julesh · · Score: 1

      As a spare-time kernel writer, I couldn't agree more. The problem is that a few small improvements like this won't make a new kernel viable. It needs to be a radical improvement over existing systems. Witness Plan9.

    43. Re:Correction by Bill+Dog · · Score: 1
      Which means even less emphasis on security.
      Too true.

      Seems to me he's a researcher who's noticed that "most software is really made" by C and C++ programmers in a hurry.
      That may be so. But that's not what he said. He makes no mention of thinking that programmers are too much in a hurry. He only talks about how he thinks they're all so busy agonizing over speed and efficiency. They aren't. By a long shot. Thus, he's a kook with an axe to grind, either genuinely held, or feigned (towards making his funders feel good about the grant money they've given him). That said, his project looks very worthwhile.
      --
      Attention zealots and haters: 00100 00100
    44. Re:Correction by cyber-vandal · · Score: 1

      I looked at that with disbelief as well. Which programmers are privileging speed and efficiency of code? I've not seen that in any of the big software packages I use (including the OSS ones I might add). I'd also dispute the speed and efficiency of development too. For all the extra shit available to supposedly speed up development and/or make software more reliable it still takes too long to come up with something that still doesn't work properly. RAD tools only allow some programmers to make a turd more quickly but it's still a turd.

    45. Re:Correction by Anonymous Coward · · Score: 0
      I've never seen a well designed app that had circular references of any sort.

      public class MyObject
      {
        private MyListener listener;
       
        public void addListener(MyListener listener)
        {
          this.listener = listener;
        }
       
        public void fireEvent()
        {
          listener.doListeningThing(this);
        }
      }
       
      public class MyListener
      {
        public void doListeningThing(MyObject object)
        {
      //Manipulate MyObject
        }
      }
      Pretty much anytime you have two-way communication between two classes, you have a circular reference. Granted, most of these references are hidden behind decoupling interfaces, but sometimes that's just too much of an overkill for a one-off communications link. :)
    46. Re:Correction by tulrich · · Score: 1

      In any sufficiently important program, crashing and then throwing up in your lap (assuming the version crashing even was compiled with debugging info) is or should be completely unacceptable. Much better if the program can realize what's going wrong and work around it - whether that means re-asking the user for that input again, retrying reading the IO buffers or emailing a developer.

      In any sufficiently important program, if you're catching array bounds exceptions and continuing, you need to fix the underlying bug, or you may be exploited. Exception catching is one mechanism for dealing with such errors, but not one that I consider good practice.

      The beauty about exceptions and error codes is that when they occur, you know something is wrong and can do something about it while the program is still running.

      If you don't know specifically what is wrong in your exception handler, and you try to keep going, then you are in undefined territory, and you're open to dangerous exploits. Granted, crashing is a kind of exploit (DoS), but a more visible and less dangerous kind than undefined behavior.

      No more of this silent, absurdly hard to find corruption of memory going on.

      A crash with backtrace should make memory corruption EASY to find, that's the whole point.

    47. Re:Correction by Rich0 · · Score: 1

      In Ruby - EVERYTHING is an object.

      Note - I am not a Ruby expert, but 5+3 == 5.+(3) == 4.next+2.next - literals are objects and have member functions (which they inherit from some underlying class). Operators are just shortcuts for calling functions (5+3 == 8 is the same as 5.+(3).==(8) ).

      Anybody with more knowledge of Ruby feel free to chime in - I'm just starting to learn Rails in my spare time.

    48. Re:Correction by Rich0 · · Score: 1

      Until recently most large java apps would not run on 64-bit linux, because of the buggy VM implementations. Sure, anything small worked fine, but try Freenet or Eclipse or anything like that and you were up the creek. And many apps would work with Sun's JRE and not with Blackdown, and vice-versa. It got to the point where I just built everything without java support.

      Now things seem to have improved quite a bit, and I expect that the GPL will help them quite a bit. However, I can feel the original poster's pain.

  4. What a load of shit. by QuantumG · · Score: 0, Troll

    1. Roland Piquepaille
    2. It's just heap randomization, again.

    Nothing to see here.

    --
    How we know is more important than what we know.
    1. Re:What a load of shit. by Anonymous Coward · · Score: 0

      While heap randomization is not new I don't know of another project that uses comparison of replicas to identify inconsistancies. From the abstract of thier paper: "By initializing each replica with a different random seed and requiring agreement on output, the replicated version of Die-Hard increases the likelihood of correct execution because errors are unlikely to have the same effect across all replicas.". Can you provide a cite for your "nothing to see here comment" or is that just your knee jerk reaction? Personally I think the utility of DieHard from a security standpoint might be limited, but it has the potential to be freakin useful for tracking down complex pointer problems.

    2. Re:What a load of shit. by Anonymous Coward · · Score: 0

      > is there a middle way between Intelligent Design and Neo-Darwinism?

      is there a middle way betwen geocentrism and heliocentrism?

    3. Re:What a load of shit. by QuantumG · · Score: 1

      wow, someone who gets my commentary on british politicals, brilliant.

      --
      How we know is more important than what we know.
    4. Re:What a load of shit. by Anonymous Coward · · Score: 4, Interesting

      I did a quick read of the whitepaper and sort of see it as heap randomization+. I have very little faith in the claims of low overhead. But leaving that aside, there are 2 major problems here:

      1) If there is a program crash, it may be possible to reproduce the bug on the same computer, but probably not on 2 different ones, such as the user's and the developer's.

      2) It discourages programmers from good design and thorough testing by leading them to believe that bugs won't occur.

      The claim for DieHard (from the whitepaper) is that it "tolerates memory errors and provides probabilistic memory safety". But bugs will still happen! I once added about 10 lines of code to log a bug our team was having a hard time tracking down. It turned out to have its own bug that would be hit if:

      - Two threads were accessing the same buffer
      AND
      - One of them was swapped out during the execution of 3 machine instructions (out of about a million)

      It took my moderately sized customer base 2 weeks to hit it. The only way to avoid memory errors is to make the code bulletproof, which means fixing it when bugs are reported.

    5. Re:What a load of shit. by jnf · · Score: 1

      At a 50-75% memory usage increase no less.

    6. Re:What a load of shit. by Anonymous Coward · · Score: 0

      Yes... If the planet has a mass close to the mass of the star.

    7. Re:What a load of shit. by ebichete · · Score: 1

      Not sure what the typical mass of a star is meant to be...

      However, using Sol (and our solar system) as an example,
      anything within an order of magnitude will no longer be a planet.

      I think you need at least two orders of magnitude difference
      for a "well defined" orbit.

      (end of pointless information, now returning to your regular Slasdot)

  5. Cue Diehard quotes in... by Mogster · · Score: 0

    5...4...3..

    Yippee-ki-yay

    --
    ACK NAK RST
  6. Um, no. by Duncan3 · · Score: 1

    No, putting arrays on the stack causes buffer overflows. Which is trivial to not do, and trivial to check for.

    The fact that Microsoft doesn't HAVE a security model, IE/Outlook are jokes, and users run as admin has a bit more to do with it.

    --
    - Adam L. Beberg - The Cosm Project - http://www.mithral.com/
    1. Re:Um, no. by codegen · · Score: 1

      Buffer overflows can also happen in the data segment (both global variables and heap).
      And it is almost as easy to exploit. Intead of overflowing to the return address, you overflow
      to the nearest vptr (if C++ is being used), to the nearest function pointer or to the nearest green bit.

      --
      Atlas stands on the earth and carries the celestial sphere on his shoulders.
    2. Re:Um, no. by jorghis · · Score: 1

      There are pointers to the code segment in every section of memory. (heap, stack, you name it) Do you honestly think that the only time a pointer to code gets followed is when you are bouncing around in between stack frames?

      I am amazed that you would so arrogantly declare that simply doing a bit of static analysis would be sufficient to fix all (or even most) buffer overflows in complex programs with hundreds of thousands or even millions of lines of code. It sounds like you just looked at one tutorial of the 'classic' buffer overflow with overrunning in a stack frame causing arbitrary code execution and decided that was the only case programmers had to worry about. It seems like its always people who have a small amount of knowledge about computers (but really not all that much) who are the most eager to rip on MS.

    3. Re:Um, no. by Anonymous Coward · · Score: 0

      What is a "green bit"? Thanks!

    4. Re:Um, no. by codegen · · Score: 1

      Sorry for not responding sooner. Green bits are the extra house keeping values
      that are stored to manage the memory. The actual layout and use of the green bits
      differs depending on the management library. But in general, when a block is
      allocated by new or malloc, there is slightly more allocated and some values
      are stored at the beginning of the block. The value returned by the allocator
      is the location just after the green bits. When the block is freed, some libraries
      add the free list pointer values in the first part of the block as well.

      --
      Atlas stands on the earth and carries the celestial sphere on his shoulders.
  7. Let's solve voting security. by Wilson_6500 · · Score: 2

    If you were somehow to install DieHard software on a DieBold machine, does the universe collapse in on itself? This is one of those pasta plus antipasto situations, I think.

    1. Re:Let's solve voting security. by j00r0m4nc3r · · Score: 1

      Quiet, you! The last thing we need is an El Queso terrorist strolling into a crowded airport with a voting machine strapped to his chest...

  8. Movie sequel no. 3 by Bob54321 · · Score: 0

    Offtopic but does anyone know what happened to Die Hard 4 (probably with a name like Die Hardest???). I read they were making it with Britney Spears as John McLean's daughter. Would of probably put me off one of my favorite movie series with her bad acting. I guess that was the answer to my own question!

    --
    :(){ :|:& };:
    1. Re:Movie sequel no. 3 by nwbvt · · Score: 1

      Yeah, its coming out soon, its going to be called "Live Free or Die Hard". I saw a trailer for it before "The Good Shepherd", though all I can tell you from that is that there will be a lot of big explosions and car chases.

      --
      Mathematics is made of 50 percent formulas, 50 percent proofs, and 50 percent imagination.
    2. Re:Movie sequel no. 3 by dbIII · · Score: 1
      Die Hard 4 (probably with a name like Die Hardest???) ... with Britney Spears

      Die Hard 4 - going commando.

    3. Re:Movie sequel no. 3 by Coucho · · Score: 1

      Die Hard 5 - Hardly Dying

      --
      *pSig = NULL;
    4. Re:Movie sequel no. 3 by Bob54321 · · Score: 1

      From the link i see my original post was very on topic (ish...). It seems the movie is about internet terrorists shutting down the USA. Obviously because we a insecure coders! (And yes, you get none of that from the trailer.)

      --
      :(){ :|:& };:
  9. wtf? by Anonymous Coward · · Score: 0, Insightful
    Today's computers have more than 2,000 times as much memory as the machines of yesteryear, yet programmers are still writing code as if memory is in short supply.

    I stopped reading after that first line.

    Programming is not a matter of simply writing until things get full.

    1. Re:wtf? by julesh · · Score: 1


              Today's computers have more than 2,000 times as much memory as the machines of yesteryear, yet programmers are still writing code as if memory is in short supply.

      I stopped reading after that first line.


      Yeah, it was pretty dumb. I mean, we've been building digital computers for over 50 years now. You'd have thought by now that we'd have written all the software we'd ever want, right?

      No. We keep writing new software because we're doing new things that older computers couldn't do. That means that all that memory is necessary, because otherwise the application we're working on would have been written 20 years ago.

  10. So... by Anonymous Coward · · Score: 0

    Microsoft helped develop a program to uninstall Windows?

  11. Algorithms demand perfection by Progman3K · · Score: 1

    You should never program thinking about security issues.
    Write the algorithms correctly and there won't BE any buffer-overflows.

    What's so hard about this?

    --
    I don't know the meaning of the word 'don't' - J
    1. Re:Algorithms demand perfection by wallet55 · · Score: 1

      so much to do, so little time. So much easier to dash off some code, patch the bugs, jury rig the gaps, and append new features.... then clean up the more screamingly ridiculous messes in service pack x+1

    2. Re:Algorithms demand perfection by Anonymous Coward · · Score: 0

      Well, one possible reply is

      "lol, fire lusers who write buggy code that overflows!1!! i bet m$ dont do this, lusers, i write secure code because i use TEH LUNIX lolz!"

      The less slashdotty but more sensible response is that even the best programmers make mistakes. Show me a program you've written that doesn't have bugs in it, and I'll show you a liar. Some of the worst security holes are written by a genius that made one slip up. Which is why having automated tools to prevent these kinds of mistakes helps. This can include anything from DieHard-like tools, to virtual machines with enforced safety, to the C++ STL (down with char* !).

    3. Re:Algorithms demand perfection by Jeremi · · Score: 1
      Write the algorithms correctly and there won't BE any buffer-overflows.

      What's so hard about this?


      The "write the algorithms correctly" part. The demand for programs is much larger than the supply of sufficiently trained/disciplined/talented programmers. Therefore, we need a solution that gives acceptable results even when the programmer isn't a guru (and preferably when the programmer is a trained monkey, because he often will be)

      --


      I don't care if it's 90,000 hectares. That lake was not my doing.
    4. Re:Algorithms demand perfection by sqlrob · · Score: 1

      The STL is not a panacea. You still need to interact with the OS for any non-trivial program, which is going to take/return raw chunks of memory.

    5. Re:Algorithms demand perfection by drinkypoo · · Score: 1

      Not only that but I think we should be reaching towards a time when everyone can be a "programmer". Oh, maybe most people will never learn to write all that useful code, but if they can plug a bunch of tinkertoys together and produce a program that works for them and achieves their goals then we're one step closer to being free of the tyranny of commercial software.

      --
      "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
  12. Sears Diehard Movie Software??? by davidwr · · Score: 0

    If you watch Diehard, the movie, in your car DVD player running off a Sears Diehard battery while running DieHard on your laptop, does that mean you died hard 3 times over?

    --
    Knowledge is how to play a game, intelligence is how to win, wisdom is knowing what game to play.
  13. Our computers have thousands times more memory... by Stormx2 · · Score: 1

    Well thank god we have Vista to fill up that uptapped goldmine!

  14. Wouldn't a language do the same job? by rolfwind · · Score: 1

    Wouldn't using languages like Lisp do basically the same job? I mention lisp, besides it being a favorite language of mine, because I know the end product can be coded/compiled fast and efficiently while maintaining security in many cases. Other more popular languages like Python, while getting more lispish, seem to have a inherent speed penalty that cannot be reduced as easily come compile time though I am not sure, saying this as more of a spectator to that language.

    Note: I'm sure other functional languages can do the job of memory management and protect from buffer overflows as well as Lisp, I'm just no expert on them so I can't speak for them.

    It's just that over the years, I have seen products come out for C family of languages that protect the programmers from the trickiers parts of C..... which seem to come up again and again even for expert programmers and where there is no bulletproof solution. I'd want to know if another language wouldn't do the job in 90% of the cases.

    1. Re:Wouldn't a language do the same job? by russellh · · Score: 1
      Wouldn't using languages like Lisp do basically the same job?

      Yes.

      But it's not a practical solution for about 185 different reasons starting with the fact that very few commercial apps are written in any kind of dynamic language, let alone LISP, and they're not likely to be rewritten anytime soon for such an intangible reason as security. rpg was right that worse is better, and the last language will be C. he wrote that before java, ruby, etc., but I think it's still right. Like it or hate it.

      --
      must... stay... awake...
    2. Re:Wouldn't a language do the same job? by QuoteMstr · · Score: 1

      Lisp is all that safe a language, and can be somewhat strange: I'm a little confused by the specification's discussion of safe versus unsafe operations, but as I recall, you can specifically instruct the Lisp compiler to ignore array bounds checking at the expense of speed. You'd have to be insane to do this, however, but it is possible. Consider this function:

      (defun bar (array i x)
        "Set the Ith element of array ARRAY to X"

        (declare (type fixnum i)
                 (type (simple-array fixnum) array)
                 (optimize (speed 3)
                           (safety 0)))

        (setf (aref array i) x))

      Now, let's test it:

      (let ((x (coerce '(0 1 2 3)
                       '(array fixnum 1))))
        (bar x -4 31)
        x)

      That does indeed cause various memory errors under SBCL.

      OTOH, if we were to specify safety 3 and speed 0 in that function, an error would be signaled and all would be well.

      Lisp is a great language, but the Scheme is too simple and lacks a real packaging system, and Common Lisp suffers from C++-style overcomplexity. (Take the mess that is the intersection of the vector, simple-vector, array and simple-array types for example.)

      CL's macro system allows these flaws to be overcome, but it's still an overcomplex PITA sometimes.

    3. Re:Wouldn't a language do the same job? by chromatic · · Score: 1
      ... very few commercial apps are written in any kind of dynamic language...

      Commercial in what sense? Shrink-wrapped software, perhaps, but I've written a fair few commercial applications (licensed or sold or for clients) in dynamic languages.

    4. Re:Wouldn't a language do the same job? by krischik · · Score: 1

      Yes, I never had a buffer overrun when using Ada - unless I used one of the following:

      with Interfaces.C:
      pragma Import (Convention => C, ...

      got the drift? One problem is that the OSs itself are written in C.

      Martin

  15. Pastamancer? by Anonymous Coward · · Score: 0

    This is one of those pasta plus antipasto situations, I think. Sounds like you might be a Pastamancer.
    1. Re:Pastamancer? by Wilson_6500 · · Score: 1

      God, no! Disco Bandit for life. I called myself a "Senator" and gave all my pets names that started with Intern. I miss that game sometimes.

  16. Not quite by gr8_phk · · Score: 1

    There is nothing wrong with putting an array on the stack. I once had the need to copy a function into a local int[50] and run it from there - no issues (embedded system, the function needed to run from RAM). The problem is when people write code that can blow right past the end of an array. They don't stop to think that the functions they call to dump data in there don't know where the end of the available space is. Oh right, the data told me how much space to allocate and I just allocated that much and read until EOF. ;-) ok, that's a heap (not stack) buffer overrun. Anyway arrays on the stack are not inherently bad.

    1. Re:Not quite by Teresita · · Score: 1

      The problem is when people write code that can blow right past the end of an array.

      Why not? This is the era of kerjillion dollar lawsuits that blow right past the GDP of the host country.

    2. Re:Not quite by TapeCutter · · Score: 1

      "Anyway arrays on the stack are not inherently bad."

      Maybe not "inherently bad", but certainly inefficient as regards speed and space since the entire array must be copied to the stack rather than just an array pointer.

      --
      And did you exchange a walk on part in the war for a lead role in a cage? - Pink Floyd.
    3. Re:Not quite by jorghis · · Score: 1

      I dont see why you necessarily have to copy an entire array.

      void foo(){
      int arr1[52]; /* a bunch of code that stores values into arr1 and then manipulates them and reads them back*/
      }

      The only overhead that had to be done here was moving the stack pointer down an extra 52*4 bytes, which is no more work than what it was doing already. Assuming you are in a language that doesnt initialize every element of an array when you declare it. Arrays on the stack are not inherintly inefficient although they certainly can be if you dont use them right.

    4. Re:Not quite by TapeCutter · · Score: 1

      Ah, my bad, I thought you meant something like...

      foo(char str[BIG_NUMBER])
      {

      --
      And did you exchange a walk on part in the war for a lead role in a cage? - Pink Floyd.
    5. Re:Not quite by Chrax · · Score: 1

      Are there any languages that copy the whole array when you do this?

      The array notation is equivalent to pointer, as far as the program is concerned. Its only use is in telling the programmer to expect an array, and not a pointer to a single value. I think every other language I know passes every variable by reference or does a copy-on-write (and I'm not sure any of them do that).

    6. Re:Not quite by TapeCutter · · Score: 1

      I belive in vanilla C that specifying of the size of the array in a formal parameter changes things slightly (for a start, you must pass an array of that particular size), but as you say it is probably optimised away.

      --
      And did you exchange a walk on part in the war for a lead role in a cage? - Pink Floyd.
  17. Irony by Anonymous Coward · · Score: 0

    Funny how Mozilla crashed continually after enabling this software. I'm glad I don't go to UMass...

    1. Re:Irony by Anonymous Coward · · Score: 0

      good point - thanks for validating the point of the software! are you sure you read the article?

      jeers for your stupid comment about umass though. They do pretty neat research there.

    2. Re:Irony by TrumpetX · · Score: 1

      Mozilla crashed for me as well... then I uninstalled it.

    3. Re:Irony by Anonymous Coward · · Score: 0

      I thought I had read the article... I'm pretty sure it mentioned something about the program ensuring that programs "run correctly". So yes, by definition of "correctly", the program failed at its purpose.

      And I was being sarcastic about UMass. You need to get a sense of humor.

  18. Way more memory by Anonymous Coward · · Score: 0

    FTA:
    ""Today we have way more memory and more computer power than we need," he says. "We want to use that to make systems more reliable and safer, without compromising speed.""

    I guess he hasn't tried Vista yet. Already out day; such is the industry.

  19. Buggy by The+MAZZTer · · Score: 2, Interesting

    Firefox 2 crashed for the first time ever (I've used it since beta 1 came out) for me today... suspiciously, less than five minutes after I turned DieHard on. Hrm.

    1. Re:Buggy by jomama717 · · Score: 1

      I used to write code for a company that made a runtime-replaceable (no re-compile) garbage collecting allocator for C/C++ apps and in the process came across numerous cases of our allocator causing crashes by fixing memory errors in the app. E.g. Netscape on Solaris would crash on our buffer-overrun detection flag because the app was depending on the word after the end of a buffer to be all zeros. When it hit our flag it puked (Maybe you are seeing the same bug!!).

      It only takes a couple of cases like this to make you believe that these products are just too intrusive to be practical for day to day use. I would bet that ~15-30% of all commercial software will react poorly with DieHard.

      --
      while [ 1 ]; do echo -n -e "\xe2\x95\xb$((($RANDOM&1)+1))"; done
  20. Sounds like systrace by methodic · · Score: 1

    Am I wrong in thinking this is just another implementation of systrace?

    http://www.citi.umich.edu/u/provos/systrace/

    1. Re:Sounds like systrace by napir · · Score: 1

      Yes. What does this have in common? Other than it's software and it has something do do with security or reliability or something?

  21. Don't need it...already have it.... by AetherBurner · · Score: 1

    It is called WindowsXP. When I kill it on a regular, daily basis, its Dies Hard.

  22. Anyone who professes to be involved by Anonymous Coward · · Score: 0

    with the computer software industry and still confuses the word "hacker" with someone engaged in bad behavior has to be considered clueless.

    1. Re:Anyone who professes to be involved by westlake · · Score: 1
      with [in] computer software industry [who] still confuses the word "hacker" with someone engaged in bad behavior has to be considered clueless.

      clueless is thinking you can reclaim the meaning of a word once a new definition becomes common usage in a larger world

  23. You must remember... by jd · · Score: 4, Insightful
    ...the number of programmers like ourselves who learned how to code correctly is vanishingly small in comparison to the number of coders who assume that if it doesn't crash, it's good enough. Whether you validate the inputs against the constraints, engineer the program such that constraints must always be met, or force a module to crash when something is invalid so that you can trap and handle it by controlled means - the method is irrelevant. What matters is less that you're using a method than you remember to use a method.

    Even assuming nobody wants to go to all that trouble, there are solutions. ElectricFence and dmalloc are hardly new and far from obscure. If a developer can't be bothered to link against a debugging malloc before testing then you can't expect their software to be immune to such absurd defects. A few runs whilst using memprof isn't a bad idea, either.

    This assumes you're using a language like C, which is not a trivial language to write correct software in. For many programs, you are better off with a language like Occam (provided for Unix/Linux/Windows via KROC) where the combination of language and compiler heavily limits the errors you can introduce. Yes, languages this strict are a pain to write in, but the increase in the initial pain is vastly outweighed by the incredible reduction in agony when debugging - if there's any debugging at all.

    I do not expect anyone to re-write glibc in Occam or any other nearly bug-proof language. It would be helpful, but it's not going to happen.

    --
    It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
    1. Re:You must remember... by jorghis · · Score: 1

      Thats quite bold of you to claim that you are in an elite group that can churn out large programs in C with zero bugs.

      Your claim that smart programmers using dmalloc, electric fence, or some other bounds checker will find all buffer overflows seems misguided to me. Those tools are great for catching buffer overflows that are actually being caused by your test suite. But arent most buffer overflow security holes caused by weird corner cases noone though of? I mean in the real world its never caused by something as simple as "=" versus "".

    2. Re:You must remember... by gillbates · · Score: 1

      I would go farther than that and say that writing a correct program in any language is not trivial. While it is true that certain languages (like Java) limit the kinds of errors a programmer can make, they do nothing to limit the number of errors a programmer can make.

      While I understand there are some languages more appropriate for solving certain types of problems, making a language programmer-proof is never a worthy goal. Usually, the attempt to make a "better COBOL" ends up evolving like this:

      1. Researcher notices that programmers have difficulty understanding concept X (i.e. pairing free() and malloc). Researcher notices that many programmers create bugs because of their misunderstanding.
      2. Naively, researcher thinks of better way(TM) to solve same problem (i.e. Garbage Collection). Researcher creates a new (language | library | program) which solves said problem. True, the solution encompasses only a subset of the original functionality, but the researcher feels the trade-off is worth the reduced functionality because it solves a very common set of bugs.
      3. New programmers learn to use researcher's solution. Instead of learning what is really going on under the scenes, they learn the new API/paradigm.
      4. Now, the new generation of programmers are one step farther removed from understanding how computers work. Due to lack of understanding, they create new kinds of problems (i.e. - creating an object/class instance for everything, even when unnecessary).
      5. Researcher notices that programmers have difficulty understanding concept Y (i.e. Garbage Collection). Researcher notices that many programmers create bugs because of their misunderstanding....
      6. Repeat ad infinitum. Oh - and don't forget to have the researcher collect his paycheck for delaying the real solution to the problem.

      There's no silver bullet to solve stupidity, or lack of rigor, or any of the several management "problems" which lead to bad code. It seems that whenever a different paradigm is introduced with the explicit purpose of reducing programming mistakes, it always backfires. Witness COBOL, for example. Instead of making things easier for programmers, it created a mess of unmaintainable spaghetti code - as it was marketted not to the experienced, knowledgeable programmer - but rather, to businesses with the implicit assumption that secretaries would be writing code.

      I think the problem is that some in the research community believe have a holier than thou complex when it comes to writing code. They assume programming errors can be eliminated by proper choice of language. In reality, the language used is the least relevant. My experience has led me to believe these are the top sources of program errors:

      1. Unrealistic schedules. Programmers are trained to do fast, now, and do it right, later. Problem is, later never comes. The poor programmer finds himself writing lousy code first as a matter of choice - to meet deadlines - and later as a matter of habit, having forgotten the importance of doing things right.
      2. Unrealistic designs - for example, requirements which go beyond what the language/programming environment is actually capable of doing.
      3. Inadequate/faulty design - designs that are incomplete, contradictory, or just plain wrong. Said designs force the programmer to make decisions beyond their level of understanding, with the attendant errors.
      4. Unrealistic management - i.e., outsourcing critical business programming overseas to programmers with no knowledge of the business or the implicit requirements of the project.

      Programming is a skill, not a commodity. It requires knowledge, rigor, and discipline. We'll all be better off when business wakes up and recognizes this.

      --
      The society for a thought-free internet welcomes you.
    3. Re:You must remember... by jd · · Score: 1
      Heh! No, it's not brave of me at all. It's just called Formal Methods and it's only an "elite" group because people prefer to have crappy results now over superior results later. (Actually, it's not that "elite". I'd say that virtually all European universities teach Formal Methods.)

      The point of Formal Methods is that there is no such thing as a case you haven't thought of. Formal Methods define the complete set of valid cases and (by definition) also the complete set of invalid cases. You explicitly define every boundary and can therefore test every boundary condition, but if you have followed the methodology correctly, there should be nothing much to test for.

      First, you draw up a specification. You define the preconditions of each and every function - those things that absolutely MUST be true on entry to that function. You define the postconditions of each and every function - those things that absolutely MUST be true when you apply the intended operations to the preconditions. You define the invariants which MUST hold true after external functions have been called or data has been loaded. You do not care at this point how the program is implemented, you are only concerned with what must hold true at any time that there is the potential for such a requirement to be invalid.

      Specifications should always be derived from the top down and should NEVER be skimped on. If the spec calls for a string of six characters and a null terminator to be placed in a dynamic buffer of seven bytes, you make damn sure that ONLY six characters are added AND that there is a null at the end AND that the malloc() function records that the structure is exactly seven bytes long.

      Second, and this has become fashionable with "Extreme Programming", you develop a test harness for each function, starting from the bottom and working up. Test harnesses should attempt to violate each of the conditions given, as well as test for every boundary condition identified and some valid cases.

      Third, you program to the combination of specification and test harness, again from the bottom up. It is a good idea to use assert() statements to ensure that the specification is totally adhered to. If a module meets all the specification requirements AND passes all the defined tests, then it is essentially free of defects for valid inputs.

      You build up a trust hierarchy which matches the program hierarchy. If X is called by Y and X is OK if passed valid data and Y will always generate valid data, then there is no circumstance in which X can ever be invalid, even if theoretical defects exists. You don't have to prove the non-existence of defects that cannot be exposed, although the above mechanism will have eliminated most such issues. You don't have to test every permutation of conditions - once X is verified as correct, you only have to prove Y is valid. You do not need to prove the pair of Y and X, other than to ensure invariants are adhered to on return from X. This means that the test requirements are superlinear, not exponential. Exponential complexities are not good. Superlinear isn't great, but it is well within the limits of what can be achieved.

      Once you have reached the point of showing that each module in the hierarchy is valid if the one(s) above are correct, up to the main program entry point, then provided you validate the parameters on startup, the program is as close to free of defects as has any meaning.

      None of this requires arcane wizardry (Ai! Ai! Cthulhu!). It only requires that you know what you are doing before you try to do anything, and to understand what the implications are.

      --
      It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
    4. Re:You must remember... by jd · · Score: 1
      I completely agree with what you say, with one caveat. There are some excellent special-purpose languages that are not "programmer-proof" in the least within that special-purpose but which should never be used outside of the field for which they are intended. Because they are not general-purpose languages, they can trap conditions that are just plain stupid for that purpose, preferably by crashing rather than to out-program the programmer. "Smart" languages generally aren't.

      (LOGO is great for controlling plotters or other simple X/Y-based robots - but I wouldn't write a wordprocessor in it.)

      --
      It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
    5. Re:You must remember... by jorghis · · Score: 1

      That may work great at the high level, but it doesnt gaurantee you made no mistakes in the implementation. It is inevitable that some functions are going to be very tricky. Add in enough functions and sooner or later someone is going to make a mistake that isnt caught in unit testing.

      As an example, I remember seeing code that looked like the following once:

      lock semaphore
      do 50 things safely
      unlock semaphore
      do one more thing that we should have done before unlocking

      Thats the sort of absent minded mistake that will never be caught by a test suite and will very rarely manifest itself. And of course the high level idea of what its doing will still be correct. I realize this is a simple example, but there are more complicated ones that crop up too.

      Testing boundary conditions and so forth may sound all wonderful in the world of academia, but in the real world it wont catch all bugs. And frankly, I cant remember the last time I saw a simple boundary condition error in the real world. Just putting in the "obvious" test cases usually doesnt do much in my experience.

      You are implying that unit testing every function is somehow equivalent to mathematically proving nothing can go wrong and that simply isnt true. I'll give you that it does improve quality to a degree, but bugs will still be there. Even if it were perfect, conforming to DO-178B, EAL or whichever standard is you favorite is cost prohibitive and not really practical for most software development.

    6. Re:You must remember... by jd · · Score: 1
      I favour ISO/IEC 13568:2002, although that would come as a shock to my former lecturers. :)

      You made one major error in your interpretation of what I outlined, in assuming it was unit testing. It is integrated testing that uses some unit testing methodology. In order to test correctly, you must test EVERYTHING below the point in the code structure you are interested in. The structure is a fundamental part of the code and must be tested in conjunction with that code. No exceptions and no shortcuts. And, yes, it would have caught that error you outlined. Let me illustrate how:

      You have the function itself, which would be roughly drawn up as:

      • Function preconditions, including that semaphore is unlocked
      • Lock semaphore
      • Lock semaphore postcondition (ie: semaphore is locked)
      • Do a task
      • Check semaphore is still locked (that is the invariant in this code block)
      • Unlock semaphore
      • Unlock semaphore postcondition (ie: semaphore is unlocked)
      • Buggy call goes here
      • If our formal spec requires the buggy call finish with the semaphore still locked, this gets tested here
      • Postconditions for the function, including that the semaphore is unlocked

      Now, remember that each call still validates its pre- and post-conditions in the methodology I described, along with all invariants. You don't exhaustively exercise them, but the checks are still there. Now, let's get into the buggy function call...

      • Buggy call's preconditions (which, if a lock is called for, damn well should include checking the lock - NO skipping steps and NO shortcuts are acceptable when doing rigorous testing)
      • Buggy call's code
      • Buggy call's postcondition (which, since the semaphore is left locked, MUST include the fact that the lock is there)

      Ok. We run the code. It gets to the buggy function call and hits the precondition. It fails and barfs on the lock test. We comment out the call to the function but leave the invariant check in place. (Since the function call shouldn't alter anything that's invariant - duh! - then the check must be valid whether the call is made or not.) The check fails, because the lock component of the invariant isn't true.

      The invariant is incorrect, so that rules out the call itself being incorrect (which would make the precondition fail but the invariant succeed). However, it does say that the function call is being run under the wrong conditions. We therefore establish the nature of the bug and the scope of the bug. From there, you can inspect the postconditions at the end of each scoping block to see where the conditions no longer satisfy the invariant. Ah! When we perform the unlock, we violate the conditions! Ergo, the call must be moved to before this point.

      You move that section of code back, the invariant is satisfied. Good. You uncomment the call. The precondition and postcondition are now also satisfied. Our code block structure is now correct.

      Some Software Engineers and Computer Scientists take shortcuts - testing individual procedures in complete isolation. This is invalid. I don't care if you use Jackson Structured Diagrams, Abstract State Machines, Z Formal Notation, Backus-Normal Form, or the back of an envelope. If you don't include the structure, the whole structure, and nothing but the structure, then all you have is meaningless scribble. Syntax alone says nothing without the semantics. Testing one and not the other is an exercise in futility.

      --
      It's a small world and it smells funny; I'd buy another if it wasn't for the money; Take back what I paid (SoM)
  24. going by the movies by game+kid · · Score: 1

    It would probably mean that you died hard with a vengeance.

    --
    You can hold down the "B" button for continuous firing.
  25. nothing to do with VMs - just exception handling by Anonymous Coward · · Score: 3, Informative

    Ada's been doing that kind of runtime checking and throwing exceptions for 20 years now without needing a VM to enable exception handling.

  26. Ren and Stimpy said it best by Dachannien · · Score: 1
  27. Speed being privileged? In these times? by Anonymous Coward · · Score: 0

    Still, programmers are privileging speed and efficiency over security, which leads to the famous "buffer overflows" which are exploited by hackers.

    ...Riiiight. Programmers are certainly privileging speed over security. That students are being taught nowadays that speed is the last thing you should care about, and that the inexplicable popularity of managed languages and so forth exists is completely irrelevant. And the combined losses in efficiency from many programs running at once causing things to run far slower than they have any good reason too...

    I'm sure that the buffer overflows certainly aren't caused by programmers just not realising that they're there. There's no way programmers are that absent-minded.

  28. Lots of memory available? by NorbrookC · · Score: 4, Interesting

    In reading this article, I started to wonder a lot about this. writing to conserve memory is a bad thing? I will say that I haven't noticed that in most software, regardless of whether it's OSS or closed-source. If anything, there seems to be a variation of Parkinson's Law in effect. Yes, computers these days have a lot more memory available, however, the number of applications and the size demands of each application has grown almost in lock-step with that. 15 or so years ago, yes, you had one OS and one application running - maybe, if you were lucky or were running TSR apps, two or three. These days, the OS takes up a hefty chunk, and it's not uncommon to see 8 or 9 (if not more) applications running at once. What they all seem to have in common is that they assume they have access to all the RAM, or as much of it as they can grab.

    I have to wonder if he's actually looked at things these days. I don't see where programming (properly done) to conserve memory is a bad thing. If anything, it seems that few are actually doing it.

    1. Re:Lots of memory available? by Jeremi · · Score: 1
      What they all seem to have in common is that they assume they have
      access to all the RAM, or as much of it as they can grab.


      They don't assume "access to as much RAM as they can grab", they assume "access to as much RAM as they need". Given the presence of gigabyte RAM modules, virtual memory, and near-terabyte hard drives, this is usually a reasonable assumption.


      I have to wonder if he's actually looked at things these days. I don't see where programming (properly done) to conserve memory is a bad thing. If anything, it
      seems that few are actually doing it


      Certainly one shouldn't gratuitously waste memory, but it's possible to go to far the other way too... you can become so wrapped up in reducing memory usage that the other aspects of your program (e.g. runtime performance, code simplicity, code correctness, or maintainability) suffer. I'd much rather have a program use a lot of memory and work well, than one that uses a teensy amount of memory but crashes, or doesn't get the job done. Memory is dirt-cheap these days, and if you've got it you might as well put it to use.

      --


      I don't care if it's 90,000 hectares. That lake was not my doing.
    2. Re:Lots of memory available? by laffer1 · · Score: 1

      As an open source developer and college student, I can clarify the problem. We are taught that memory is cheap and there will always be enough. Of course that is stupid. Anyone who uses Firefox, Gnome, KDE or Vista can tell you that modern software is using way too much RAM. Granted three of those products are trying to work on the problem a bit. In the case of Microsoft, it helps them sell new PCs which then ship with new versions of their software.

      If you want to solve this problem, professors need to teach that there is a tradeoff between performance and security. There are not unlimited resources to work with and yet we must try to maintain a reasonable level of security. Then again the age of the professor is important. Some like C++ or Java while others only live by .NET. A few I've had love linux or BSD. Their tastes seem to control what's taught in class.

    3. Re:Lots of memory available? by NorbrookC · · Score: 1

      Memory is dirt-cheap these days, and if you've got it you might as well put it to use.

      You have an interesting definition of "dirt cheap". Doing a quick check, 1GB RAM is running around $175-$200. Admittedly, that's a lot cheaper than 12 to 15 years ago, when it was averaging $25 a MB, but I don't consider that "dirt cheap." The problem, as you pointed out, is that they grab as "much as they need", or more correctly, as the developer(s) think it needs. That's fine in an isolated system, where it's the only application running, and usually developer's computers have more power than most people's computers, so it works there. It is not true in real life. I get a little fed up every time I get told to throw hardware at a problem. I'm running a computer that's more than an order more powerful than the one I had a few years ago, and I'm still running out of RAM.

    4. Re:Lots of memory available? by ip_fired · · Score: 1

      Don't know where you buy memory, but it looks like it's $100 for a GB of RAM (at newegg.com)

      Look, if you want to run RAM hungry apps, you need to either purchase more memory, or open fewer apps at once. Or, I guess you could go back to using the apps that you were using a few years ago. I'm sure they'll run with the same, small memory footprint that you want them to.

      --
      Don't count your messages before they ACK.
    5. Re:Lots of memory available? by Jekler · · Score: 1

      I think you're rightfully fed up with throwing hardware at a problem. Hardware isn't as cheap and easy to come by as some developers believe. Waste can be seen if you look at things like the ATI Catalyst Control Center (CCC). It occupies 60mb-70mb of memory persistently. Am I to believe that the CCC is several times more complex and contains several times more data than the entirety of the Windows 3.1 operating system? (obvious cracks about Windows aside)

    6. Re:Lots of memory available? by Anonymous Coward · · Score: 0

      I don't really care how cheap memory is, the amount of memory that can go in a single machine is a limiting factor as well. $100-$200 for another gig of memory isn't the end of the story. If it requires a second machine, it can easily involve: retooling procedures for a second machine or replacement, OS upgrades and subsequent regression testing, rack buildout, power supply buildout, switching buildout, failover and backup changes, etc, etc, etc.

      So the actual memory may be cheap, but throwing memory at a problem may involve a *lot* more than just buying a stick of memory and installing it in a machine.

    7. Re:Lots of memory available? by unicode · · Score: 0

      There is an interesting piece of software called FirstClass. It has advantages and disadvantages, as does any system. However, one of the biggest problems I see with this software is that under OSX it hogs %100 of the CPU, even when not doing anything.

      The developers need to sort this out. This is an example of people thinking that their software package is the most important package which will be running and therefore should have full access to resources.

      ***** PLEASE IF YOU WORK AT OPENTEXT RESOLVE THIS ISSUE *****

    8. Re:Lots of memory available? by Rich0 · · Score: 1

      If an app wastes RAM then it WILL slow down the system, even if it happens to use CPU cycles slightly more efficiently.

      RAM that is unused gets used by the OS for buffering and caching. So, even if the system has 50GB of RAM free, it will run faster if your application uses only 3GB rather than 4GB.

      And $100/GB isn't cheap - not when CPUs sell for $200-300 for a pretty nice model. In most systems RAM tends to remain rate-limiting, and so it needs to be treated as a valuable resource and not wasted.

    9. Re:Lots of memory available? by ip_fired · · Score: 1

      Oh, I agree that applications need to be more frugal when it comes to using memory. I'm just tired of people who complain about how a certain apps use more memory in new versions, when the programmer intentionally did that in order to improve performance or add some feature to the application.

      Swapping to disk is very slow compared to caching something in memory. In older programs, it was often necessary to only have in memory what you were working on at that very moment in time.

      There is a trade-off between performance and memory usage.

      And $100/GB *is* cheap. I had to pay $300 for 8MB back in the day. To get a GB of ram at those prices would have cost me $38,400 (I'm sure glad I don't have to use my Pentium-60Mhz anymore..heh).

      --
      Don't count your messages before they ACK.
    10. Re:Lots of memory available? by Rich0 · · Score: 1

      I'm just tired of people who complain about how a certain apps use more memory in new versions, when the programmer intentionally did that in order to improve performance or add some feature to the application.

      Swapping to disk is very slow compared to caching something in memory. In older programs, it was often necessary to only have in memory what you were working on at that very moment in time.


      Actually, I tend to get the best performance by keeping -Os in my CFLAGS - smaller code means more cache hits and less swapping.

      Some memory/speed tradeoffs are probably worth it. However, with modern VMs this isn't always the case. If you're going to dump stuff to disk you might as well do it and read it back when needed - or MMAP the file - the OS will swap in and out for you. If you need to hold a buffer temporarily you're best off just keeping it in RAM - let the OS decide when to swap it out (you might never dump it to disk that way).

      Basically, you need to keep in mind that sometimes the OS can do a better job managing memory than you can, and sometimes the reverse is true. If you put a lot of thought into your algorithm and it is tailored to what it needs to do, then it will probably beat the OS. If you just tossed something together the OS might do a better job. And of course if you use a popular library you're probably going to make good use of RAM.

  29. What is portable? by tepples · · Score: 1

    It doesn't matter that the tradeoff for that speed is flexibility, security, and portability.

    "Portable" can mean that it runs on more than one PC-type platform, or that it can also run on handheld platforms with small CPU, RAM, and battery. True, there's J2ME, but it's hard for an individual in North America to buy a device to run midlets that isn't locked down in some way by the operator of a mobile telephone network. There's a reason that GBA games are written in C and that Nintendo DS games are written in C++ and not Java.

  30. Mod parent up! by Anonymous Coward · · Score: 0

    This was one of the smartest jokes I've read here in ages. If I'd only have some mod points...

  31. Old News by Anonymous Coward · · Score: 1, Interesting

    Methodologies for writing secure code have been known for decades. A far more interesting article would be one that attempts to discover or explain why certain engineers and organizations refuse to use them, or, for that matter, why they refuse to learn them in the first place.

    Note: there are new breeds of software developers who do NOT buy into the old-school lines of bullshit that have brought us where we are. Hopefully, these smarter heads will prevail as we move forward.

    1. Re:Old News by Alioth · · Score: 1

      Some of it can come down to the lack of teaching things like assembly language in programming courses. Everyone says 'why bother' about asm. However, you only have to do some elementary asm programming in even just a simple 8 bit architecture to know at a visceral level WHY buffer overflows are bad things - because then you get to see your unchecked buffer write all over the call return address in the debugger. You realise how things tend to get arranged in memory, and why these things happen.

      People who haven't done asm generally have heard the term 'buffer overflow' but don't really understand why it's so dangerous because they've never watched the return address of their function call get replaced by something else. It's likely that they don't even understand that function call return addresses are not something that's held in a special internal CPU memory [0], and is just in normal RAM along with all their code and data. If they don't understand this it's unlikely they will have a gut understanding of what happens when their stack gets smashed.

      [0] well, unless it's a PIC microcontroller with a separate stack memory.

    2. Re:Old News by NormalVisual · · Score: 1

      A far more interesting article would be one that attempts to discover or explain why certain engineers and organizations refuse to use them, or, for that matter, why they refuse to learn them in the first place.

      In my experience, the article you suggest could be summed up in just one sentence:

      "Our quarterly numbers are dependent on getting code out the door, and it's far more important to management to hit those quarterly numbers than to guarantee quality."

      --
      Please stand clear of the doors, por favor mantenganse alejado de las puertas
    3. Re:Old News by NormalVisual · · Score: 1

      Not just PICs, but in general chips with a Harvard architecture don't run into these kinds of issues very often.

      --
      Please stand clear of the doors, por favor mantenganse alejado de las puertas
    4. Re:Old News by julesh · · Score: 1

      [0] well, unless it's a PIC microcontroller with a separate stack memory.

      I understand that a number of more recent CPU architectures have taken the step of putting the return address into a register, rather than on the stack. Itanium is an example.

    5. Re:Old News by julesh · · Score: 1

      Harvard architecture chips would still be susceptible to "return-to-libc" style exploit code: overwrite the return address with the address of code already on the system that you want to execute, and follow it with the parameters you want to execute it with.

    6. Re:Old News by Alioth · · Score: 1

      That's all very well, but it severely limits the depth of the nesting of your calls and limits the flexibility of the CPU (pretty much rules out recursion, and puts an arbitrary limit on the complexity of your programs unless you use special programming techniques to avoid the use of function calls from other function calls).

  32. Addendum by The+MAZZTer · · Score: 1

    I should probably clarify that I can't be 100% sure DieHard was the problem, but I still think it's possible. Sadly I can't reproduce the error (not surprisingly, given DieHard's random nature). Although given the sheer volume of drivers and apps interacting on this comp, which still manages to stay stable normally, it's surprising DieHard didn't bring my whole house of cards down instantly. :)

  33. Randomness. Nooooo! by istartedi · · Score: 2, Insightful

    The worst bugs are the ones that are hard to reproduce. In fact, when faced with a bug that's difficult to reproduce, I've been known to quip "yet another unintentional random number generator". The suggestion that they're going to apply a pseudo-fix that involves random allocations raises all kinds of red flags. I'd much rather have fine-grained control over which sections of code are allowed to access which sections of memory, and be able to track which sections of code are accessing a chunk of memory. I'd much rather have strict enforcement of a non-execute bit on memory that's only supposed to contain data (there is some support for this already). Introducing randomness into memory allocation? Worst. Idea. Ever. It's like throwing in the towel, and if they put that in at low levels in system libs and things like that, we're screwed in terms of every being able to *really* fix the problem. If their compiler is going to link against an allocator that has this capability, I hope they provide the ability to disable it.

    --
    For all intensive purposes, "whom" is no longer a word. That begs the question, "who cares"?
  34. has been done before by oohshiny · · Score: 1

    These techniques are old hats: several malloc implementations offer randomization, and ElectricFence finds pointer errors by spreading out and aligning allocations across virtual memory.

    In practice, however, a decent set of test cases together with valgrind will make any of those runtime gymnastics unnecessary.

    1. Re:has been done before by napir · · Score: 1

      No other (known) malloc implementation randomizes *every* allocation. ElectricFence requires a page (usually 4K) per object. A decent set of test cases is always nice, but many software packages don't have enough. In practice, Valgrind will find errors which manifest themselves every time, but not every time, as the most heinous-to-debug errors tend to do. It looks like DieHard (at least in non-replicated mode) mitigates all of the above problems.

    2. Re:has been done before by oohshiny · · Score: 1

      It looks like DieHard (at least in non-replicated mode) mitigates all of the above problems.

      First of all, none of what you say invalidates what I was saying: the underlying techniques are well-known, so DieHard is at most an engineering effort.

      Is it better than those other systems? I don't think so; DieHard just makes a different set of tradeoffs than other systems. In fact, DieHard can't even find all the problems that Valgrind finds.

      Overall, I think retroactive attempts to fix C/C++'s memory management and runtime safety problems by fiddling with the memory allocator are pointless: there just is no good solution that works well for everything. C/C++ with any such hack is still going to be worse than if you just port everything to Java or C#.

      (And are you sure you know what "mitigate" means?)

  35. Corrections by SuperKendall · · Score: 2, Informative

    Basically almost every point you raised can be addressed simply by saying "get your head out of five years in the past". Moderm GC can take little overhead, and will run when needed even with the CPU being consumed.

    Swing does not really have the problems you speak of any longer, if you are using it right... heck, it didn't really have those problem to any great degree about seven years ago when I was building a large custom client app all in swing for only desktop deployment.

    Complaining about the build system is like saying GCC has a bad build system - really it has no build system, and you should use something made for building Java. That is why we have Ant and the like...

    Of the remainder, I really only think #7 has much in the way of merit. Have you looked into the java.nio package? This makes working with binary data much simpler...

    --
    "There is more worth loving than we have strength to love." - Brian Jay Stanley
  36. Re:Correction -expansion by Umuri · · Score: 1

    "programmers are privileging speed and efficiency over security..."

    This comment, at least the way I read it, is actually rather language independent. It has to do with programmers writing bad code in the first place. It has to do with them using variables that are too small to hold what they need to hold. Other bad practices is allowing users to define what goes into a variable, but then not validating the user input to make sure it is a valid and nonerroneous input. Most programmers nowadays are just being taught to just write an error handler for the basic stupid shit that may happen, instead of just writing a handler to prevent stupid stuff from ever causing an error in the program in the first place, which brings why the parent post mentioned java, as it has better erroneous variable control then it's predecessors.

    However i again mention that it is language independent, and it's more bad programming practice then anything.

    --
    You never realize how much manually made unmanaged "linked" lists suck, till you have src.link.link.link.link...
  37. metaphors by Joseph_Daniel_Zukige · · Score: 1

    metaphors, you have to understand them.

    1. Re:metaphors by julesh · · Score: 1

      metaphors, you have to understand them.

      Judging by that article, I think a more appropriate response would be to wipe them off the face of the Earth.

  38. Code Optimisation - A lost Art by Anonymous Coward · · Score: 0

    Back in the days when Memory was indeed in short supply, a decent programmer would use all sorts of tricks to reduce the overall memory footprint of the code.
    It would often have the side effect of speeding up the code as well...
    However, in these days of C#, Java etc, code optimisation seems to be a dying if not lost art.
    IMHO, CS graduates these days do not understand the implications of the code they are writing. For example...
    I did a code review a few months ago where in one place that was inside a FOR Loop, there was a lot of statements that always returned the same values and never used any of the values that changed between iterations of the loop.
    I asked the dev why this 'redundant' code was there.
    His reply was that he had coded it as a single pass module and then later added the FOR loop controls. He had never been taught the costs in terms of CPU cycles the repeated recalculation of these unchanging values would have.
    He said that they always left it to the compiler or runtime environment to sort out and anyway all Computers these days come with lots of RAM so who cares
    Whereupon I proceeded to bang my head against a brick wall.
    I 'optimised' the code for him. Then we compared the compiled code size (using the JAVA compiler) and mine was almost half the size of his.
    so, we ended up with a module that was
    1) Smaller (less memory used)
    2) Faster (less CPU cycles used)
    And probably most important, given the end customer of this code
    3) More Maintainable (Easier for a human to read and understand)

    1. Re:Code Optimisation - A lost Art by julesh · · Score: 1

      IMHO, CS graduates these days do not understand the implications of the code they are writing.

      IMHO, lots of programmers today don't understand the power of the tools they use.

      For example...
      I did a code review a few months ago where in one place that was inside a FOR Loop, there was a lot of statements that always returned the same values and never used any of the values that changed between iterations of the loop.


      Did you try compiling it and looking at the resulting code? Most modern compilers automatically perform an optimization called loop-invariant code motion, which takes that stuff that does the same calculation on each iteration and only runs it once at the start.

  39. Virus signature? by krishn_bhakt · · Score: 1

    http://www.avira.com/ is picking SPR/Hook.MadTool.B signature in C:\WINDOWS\system32\madCHook.dll file.

    --
    The Answer Lies in The Genome
  40. Do NOT INSTALL THIS by cowholio4 · · Score: 2, Informative

    BTW Do not install this crap... I do software development and this program has made it impossible to compile/run my programs (even after I uninstalled it) and also while it was running it would not allow Eclipse to run. So basically this program screwed me over big time. I am writing a database that is is to be deployed tomorrow morning. **&**&**&*&* ..... Note to self: Do this crap in a virtual machine and not while developing a program.

    1. Re:Do NOT INSTALL THIS by cowholio4 · · Score: 0

      yeah im not a troll. It really messed things up for me. I ended up pulling an allnighter, I'm still not done with the DB I was working on but I did uninstall and fix all the errors caused by DieHard.

  41. It's the programmers fault? by X-Phile · · Score: 2, Informative

    I don't think it's typically the programmers fault that there are security issues with the software. If the programmer was taught how to do things properly, then they would do things properly. Also, if they weren't so rushed to get a product out the door, they would be able to do a proper review and test of the code and find a majority of the bugs before the product hits the streets (or the server room in the case of custom software)

    Typically, a programmer is doing their job. The programmers manager is doing their job, by squeezing the work and deadlines of the programmers.

    My $0.02 CDN

    --
    "Well you're not Fiona Apple, and if you're not Fionna Apple, I don't give a rat's ass."
    1. Re:It's the programmers fault? by DrSkwid · · Score: 1

      > If the programmer was taught how to do things properly, then they would do things properly.

      It is a programmer's responsibilty to find out what properly is.

      --
      There are places where the networks are not touching,and there are places where they are-Boeing's Lori Gunter
  42. Speed - buffer overflow? by BagOCrap · · Score: 3, Interesting

    Still, programmers are privileging speed and efficiency over security, which leads to the famous "buffer overflows"... Am I the only one who finds the above sentence just strange? In my books and experience, speed optimisations most certainly don't result in buffer overflows. Recklessness does, however.
    --
    -- Chaos, panic, pandemonium... My job here is done!
    1. Re:Speed - buffer overflow? by Lxy · · Score: 1

      He's talking about what aspects the programmer is focusing on. If you're concentrating on makign a program fast and efficient, you may not be looking at writing it securely. Speed doesn't create buffer overflows, but lack of attention on the programmer's part certainly does.

      --

      There is no reasonable defense against an idiot with an agenda
      :wq
    2. Re:Speed - buffer overflow? by TropicalCoder · · Score: 1

      programmers are privileging speed and efficiency over security, which leads to the famous "buffer overflows"...

      See my post a few comments above - a "my worst bug" story about a buffer overflow.

      "It turned out that I had made a bad assumption about the data that would enter that buffer - assuming (for good reasons) that it would always be some multiple of 8 bytes. I was doing some assembler language processing of that data in this module that realized a significant optimization based on this assumption."

      That was exactly my error - "privileging speed and efficiency over security, which leads to the famous 'buffer overflows'"

  43. are you sure it's not the sequel? by way2trivial · · Score: 1

    the film "live free or die hard" is on it's way. The synopsis alone makes me wanna gag..

    http://www.imdb.com/title/tt0337978/
    When a criminal plot is in place to take down the entire computer and technological structure that supports the economy of the United States (and the world), it's up to a decidedly "old school" hero, police detective John McClane (Willis), to take down the conspiracy, aided by a young hacker (Long).

    --
    every day http://en.wikipedia.org/wiki/Special:Random
  44. Double Jeopardy! by ptelligence · · Score: 1

    "DieHard is a piece of software which helps programs to run correctly and protects them from a range of security vulnerabilities." Isn't that what the operating system is for? Why is there such a huge market for third-party products that compensate for the shortcomings of unstable and insecure software. If you paid once for the OS and the software, why should you have to pay again for third-party applications to secure them? Doesn't make sense to me.

    1. Re:Double Jeopardy! by able1234au · · Score: 1

      Malware writers will target any holes in an OS. A more secure OS means less holes but malware writers will always find a way in. Many viruses will still work on a secure OS by tricking the user into running a program they shouldnt. So if we ever see a 100% secure OS there will still be viruses, spyware etc. Vista will not solve this problem (and Vista will not, and is not, 100% secure) As long as there are bad guys there will be the need for security products. Of coures, the OS providers could also provide the security products, and Microsoft is trying to do this. But there is a cost to write security products and so they will have to pass that cost along. Just because they might be good at writing Operating Systems doesnt mean they might be good at writing security products. Different skill set completely. In fact, the skills in being responsive and making tradeoffs to deliver security quickly is completely different to the skills required in writing Operating Systems so you could argue that it would make them BAD at writing security products.

  45. Why the restriction to "non-commercial" use? by grandpa-geek · · Score: 2, Insightful

    Why not just license under the GPL, LGPL or some other open source license? This business of being "free for non-commercial use" restricts users who use open source software for commercial purposes. This software is really "non-free" according to any definition of the FSF or Open Source Initiative, which explicitly forbid discrimination against fields of endeavor. Perhaps you should say "non-free, but gratis for non-commercial use."

  46. Re:Randomness. Nooooo! by DrSkwid · · Score: 1

    A rare voice of sanity, thank you.

    from the plan 9 fortune file :

    Almost all good computer programs contain at least one random-number generator.

    --
    There are places where the networks are not touching,and there are places where they are-Boeing's Lori Gunter
  47. And this is more efficient than a memory manager? by Anonymous Coward · · Score: 0

    I haven't seen problems that would be solved by this application in years--I've been using Java.

    The only reason left to choose C++ over Java seems to be some perception that it is significantly faster. Now you have a system that is tracking every allocation and deallocation you do. Heck, with Java's memory management there is absolutely no code run for 99% of the deallocations, so it's possible that Java-style memory management is actually quicker than a version of C++ that is almost as safe.

    I'm not saying Java is the only answer, but for OO programming, Garbage Collected memory management is absolutely the only way to go.

  48. Another Movie Sequel? by MidVicious · · Score: 1

    "DieHard is a piece of software which helps programs to run correctly and protects them from a range of security vulnerabilities. " So it's basically a Tron program?

  49. Die Hard has Split Personality by Anonymous Coward · · Score: 0

    On one hand you say that Die Hard is resiliant to random crashing due to double frees, etc. On the other hand, "It places guard pages around large chunks and frees such large chunks back to the OS (causing later references through dangling pointers to fail unless the chunk is reused)" - which encourages crashing. So, which is it? A bad-program crasher or a crash preventer?

    1. Re:Die Hard has Split Personality by Ristretto · · Score: 1

      No, that's what OpenBSD does. Sorry for any ambiguity -- that whole paragraph was about OpenBSD.

      -- Emery Berger

  50. Thanks but NO by ericartman · · Score: 1

    Installed it, Firefox became unusable due to freezing up continually, removed it. Thanks anyway.

    1. Re:Thanks but NO by Ristretto · · Score: 1

      If you encounter a problem using DieHard, I'd appreciate hearing some details (send me mail). Obviously, the system works fine for me and others. I'm using it now, and have been doing so for months without incident.

      Thanks,
      -- Emery Berger

    2. Re:Thanks but NO by ericartman · · Score: 1

      Done and done the night I tried die hard. Sent email to the first person on the first web page at your site. Will now try your address.

  51. Patented? by mkcmkc · · Score: 1
    The big question is: Will the author or his institution attempt to patent this?

    If so, it's essentially irrelevant for my purposes...

    --
    "Not an actor, but he plays one on TV."
  52. This is almost certainly not a troll. by drinkypoo · · Score: 1

    If you look back up through the stories you can see that others have reported problems. Programs which have workarounds for memory problems rather than actually fixing them (read: Mozilla and descendants) may be likely to fail when running in this environment. Whoever marked this guy as a troll is a) an idiot and b) should have their moderation powers taken away permanently for not familiarizing themselves with the material before moderating.

    --
    "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
  53. waitaminute... by Medievalist · · Score: 1
    OK, I don't use Java, but still:

    Swing does not really have the problems you speak of any longer, if you are using it right...

    I don't know of any case where a memory leak can be considered user error so saying "you have to use it right" sounds pretty fishy to me.

  54. We solved this in the 1970s by Medievalist · · Score: 1
    The 90/10 rule says that your program spends 90% of its time in only 10% of its code, and that optimizing the other 90% of the code is basically a waste. And yet people who want their programs to "go fast" are writing that 90% in a low-level language, effectively wasting a large amount of effort.

    Um, I recommend to you reusable code modules. In any language.

    At least 90% of that 90% should be implemented as library routines.

    Back in the day we talked about OTL and RTL, before the black ships came and we lost the secret of hose gartering that never ravels, er, but I digress...
  55. I guess I forgot something by DrSkwid · · Score: 1

    % sarcasm = `{hget 'http://slashdot.org/comments.pl?sid=214522&cid=17 431396' | grep comment_body_17431396 | sed -E 's/<[^>]+>//g'}
    % cat /env/sarcasm
            and I thought Perl was the king of write only code
    %

    --
    There are places where the networks are not touching,and there are places where they are-Boeing's Lori Gunter
  56. Developer by SuperKendall · · Score: 1

    Users do not "use" swing directly, they use application written using the Swing API. So by saying "you have to use it right" means you have to be careful to use the API correctly, or at least you used to. The swing app we wrote did not have memory leaks, it was meant for standalone desktop situations to be running at long stretches. We used a number of profilers extensively (including HAT) to figure out where memory leaks were coming from, and shut them down. Most people who think Swing leaks memory are probably not realizing some memory leaks are their own fault. People too often think that just because you have a GC, you need not be concerned about memory but it's just not the case.

    Java 1.5 features like weak references helped provide support for mechanisms to address a number of common programming patterns that lead to memory leaks, this is why I noted that the complaint was probably not against any modern version of Swing.

    --
    "There is more worth loving than we have strength to love." - Brian Jay Stanley
  57. Re:Randomness. Nooooo! by TropicalCoder · · Score: 1

    I fully agree with you to the extent that it would be a grave error to attach the Diehard or simlilar thing to software under development. We would never know where we are.

    A few weeks ago I had one of the worst bugs I had ever encountered in a decade of C/C++ programming. Something was overwriting the end of a buffer in a multithreaded program where each thread used the same algorithm, processing different data. Thankfully, the bug was reproducible under a complex setup of inputs, but for a long time I could not be certain which element in the series of test data was causing the problem, or why it caused it, or even in which thread it happened. In the end, it took quite some time to solve the problem. Rather than being in the new code, it was in a module that I suspected the least since it had been running in the field for over a year with no problems. It turned out that I had made a bad assumption about the data that would enter that buffer - assuming (for good reasons) that it would always be some multiple of 8 bytes. I was doing some assembler language processing of that data in this module that realized a significant optimization based on this assumption. The thing was, it turns out in the end that there are some potential generators of that data that just don't behave the way I expected. Fortunately they had never been encountered yet in the field. By luck rather than design, my test setup included such a generator.

    This leads me to my conclusion: We must always follow best practices and do proper testing. Then, when all is properly done and ready ship, I don't think it would hurt at all to recompile with the Diehard system or something similar, as an insurance policy against unforeseen circumstances.

  58. Oxymoron??? by Puppet+Master · · Score: 1
    ... -- and Microsoft. DieHard prevents crashes and hacker attacks by focusing on memory.

    Shouldn't Microsoft use this software on their own products to fix these types of problems?

    --
    The day Microsoft creates a product that doesn't suck, it will be known as the Microsoft Vaccuum Cleaner!
  59. Completely avoid buffer overflows: code in Pascal! by macraig · · Score: 1

    Perhaps the reason we endure so many buffer-overflow exploits and need stopgaps like DieHard is because too many mediocre programmers were playing with "dangerous" languages like C(++)? No rules and no boundaries leads to bad behavior... every parent knows this. Too bad IT project managers never figured that out....

  60. as far as i remember by Anonymous Coward · · Score: 0

    DieHard was a virus bad in the 386 days. Funny how virus names become security names suddenly

  61. ... less focused on speed and efficiency ... by krischik · · Score: 1

    These problems wouldn't arise if programmers were a little less focused on speed and efficiency, which is rarely a problem these days, and more attentive to security Indeed. And one could start of by using using a programming language which is "attentive to security" [1].

    I did and I never looked back. It is a damm lot easier then trying to fix the deficiencies of a speed, speed and only speed focused language (C/C++) by the means of tool.

    I tried [2] - and it did not work well. A add-on tool just can not beat build in buffer overrun protection by no means.

    In the case of Splint static analysis is just not enough, you need runtime checks as well.

    And in the case of Die-Hard all the protection bolted on later at runtime. And that will relay be great for performance.

    Only ... the JPEG-Virus was based not on a buffer overrun, it used an integer range overrun. Ada has build in protection for integer range overruns. Haven't read anything about Die-Hard protecting anything but memory.

    $360,000 wasted because the majority of programmers are to lazy to learn a new programming language (those present are of course not meant).

    Or there bosses rather buy a tool then a course for them.

    Martin

    PS: If you like to try Ada you get the free and open source version here [3].

    [1] http://en.wikipedia.org/wiki/Ada_(programming_lang uage)
    [2] http://en.wikipedia.org/wiki/Splint_(programming_t ool)
    [3] https://libre2.adacore.com/
  62. Memory protection is an architectural issue, by TheLoneGundam · · Score: 1

    The System 360/370 series, and their successors, solved the "memory overflow" problem decades ago by a combination of hardware and OS architecture. Each page of real storage in hardware has a "storage bump" containing, along with the recently-used bit that enables paging, a storage key. Programs do not allocate memory - instead they make OS calls and the OS allocates memory. It allocates this memory in the key of the program being executed, usually. OS and system-level programs execute in keys 0-7, and non-OS programs execute in key 8. Things like communication buffers and the like are allocated by system functions, not by your application program; and if your key 8 program tries to store into a key 0-7 area without calling some authorized system function to do so, your program is terminated. This mechanism prevents a lot of malicious stuff from happening because you cannot generally store into any OS-related areas. You can, of course, modify your own program via array overflows or whatever, but depending upon various ways you bound / linkedited your program that also could get it killed. I doubt that the current set of applications in Windows world will allow migration to the above kind of architecture on Intel hardware - but the example is there for any who want to follow it.

  63. Indeed: choose another language by krischik · · Score: 1

    Sad that our posts are at the bottom so almost no one will see them. I posted almost the same before I saw your post. Only I suggested Pascals more powerful sister [1].

    But anyway: they will just continue to produce new tools to fix the deficiency if C/C++ so programmers won't need to learn new languages, or because hirering will be easier.

    I have not much hope for the software developing industry.

    Martin

    [1] http://en.wikipedia.org/wiki/Ada_(programming_lang uage)

    1. Re:Indeed: choose another language by macraig · · Score: 1

      Yeah, Ada also makes the point and is a more functional strongly typed language, but I mentioned Pascal because it had wider familiarity and was used as a teaching language. Perhaps the trouble started when Pascal was replaced by C in classrooms?

    2. Re:Indeed: choose another language by krischik · · Score: 1

      Perhaps the trouble started when Pascal was replaced by C in classrooms?

      Yes, that could well be. The teachers/schools thought the students have to learn a language which is also used in the industry.

      And that is of course wrong. They should teach programming and software engineering.

      But I don't blame them, the pressure came and still comes from managers and personal officers. They think that learning a programming language is difficult - which is wrong - learning programming is difficult.

      Martin
    3. Re:Indeed: choose another language by macraig · · Score: 1

      Absolutely! The specific language itself and its syntax is immaterial; if students are taught proper techniques and principles - in effect taught how to solve problems logically and programmatically - then good coding form naturally follows. Unfortunately... it requires people of strong character who can resist temptation! It's certainly possible to forcibly code the functional equivalent of strong typing etc. in C(++), essentially SELF-IMPOSING rules and limits rather than the language imposing them, but that requires self-discipline and self-control that too many programmers just don't have: they'll stoop to pretty much ANY silly and risky coding stunt that the particular language syntax allows. Pascal (and Ada and others) produce more stable code merely because they impose "ten commandments" in stone rather than relying on an "honor system" like C(++) and others.

      Yep, too bad it's only two pair of eyes seeing this thread now! 8-/

      Mark

  64. Strike the Balance by krischik · · Score: 1

    No conserving memory or CPU cycles is not bad - but you have to strike a balance between that and safety, security, reliability. And C and it's successor C++ have got that wrong - especially now where almost every computer is wired to the internet.

    If you look at the great language shootout [1] then you will see that i.E. Ada [2] uses only marginally more memory or CPU cycles but it offers a lot more on the safety, security, reliability part.

    As for Die-Hard: From what I read it is going to be a lot more wastefull on memory or CPU without delivering what Ada can do.

    Martin

    [1] http://shootout.alioth.debian.org/
    [2] http://en.wikipedia.org/wiki/Ada_(programming_lang uage)

  65. Yes and No by krischik · · Score: 1

    I am possible one of the programmers who know C++ really in deeps. And yet there was allays room for surprise as the Ruby community would call it. Up to the point that I decided that C/C++ are not the right tools and I switched to Ada [1].

    C and C++ are so focused on speed - speed of execution and speed of code hacking:

    If:

    signed x;
    unsigned y;

    why must

    x = y;

    be allowed? I mean you will need:

    x = (signed)y;

    but do you really need that quick hacking shortcut which is difficult to maintain and may hide a book.

    And here comes the "NO" part: Most programmers are not allowed to choose there programming language.

    Martin

    [1] http://en.wikipedia.org/wiki/Ada_(programming_lang uage)

    PS: Yes I am a bloody Ada advocate who plasters this discussion with damm Ada links :-).

  66. Re:Correction -expansion by Anonymous Coward · · Score: 0

    then it's predecessors

    "than its".

  67. MOD PARENT UP!!!! by Anonymous Coward · · Score: 0

    +1 Insightful
    +1 Informative
    -1 Obvious
    ---
    +1 Total