Re: Security: Unix versus Windows
Warwick Molloy <[email protected]>
| Newsgroups | gmane.comp.security.programming |
|---|---|
| Message-ID | <[email protected]> |
On Mon, 3 Nov 2003 18:19:25 +0100 Jeroen van Drie <[email protected]> wrote: <snip> > How about what Bill Joy Co fouder of Sun had to say about C though? > http://www.interesting-people.org/archives/interesting-people/200310/msg00034.html > > quote "You have to find a way to structure your systems in a safer > way. Writing everything in Java [a programming language created by Sun] > will help, because stuff written in antique programming languages like C > [a widely used language created by Bell Labs in the early 1970s] is full > of holes. Those languages weren't designed for writing distributed > programs to be used over a network. Yet that's what Microsoft still > uses. But even Java doesn't prevent people from making stupid mistakes." Well actually Java does. I've recently been looking at Java bytecode for a test coverage analyser and wanted to insert opcodes into existing code... The Java class loader does two bytecode verification steps ensuring stacks aren't corrupted by a called method. It's actually quite difficult to screw up in terms of stack smashing or buffer overrun type problems. This means a certain stack switching trick I like to use for user-mode threading is practically impossible with Java. > > To what degree does Java lean on libraries that have been written in C > though? > > This is a good point. Also JNI requires C code to explicitly request for and lock Java heap space for passing data. When this crosses the boundary back to JVM it is difficult to execute this code by accident. You would need to write a custom class loader and populate a buffer of byte code. You could probably contrive examples that do it with Java or Java/JNI/C but this wouldn't be easy at all. Let's just say that Java makes the number of workable exploits for any given TCP server process drop dramatically. Warwick.