Slashdot Mirror


Bill Joy's Takes on C#

f00zbll writes: "Cnet is running an article by Bill Joy on security and how it relates to C# and Microsoft at large. BJ quotes verbatim: 'C# provides the ability to write unsafe code. In unsafe code it is possible to declare and operate on pointers, to perform conversions between pointers and integral types, to take the address of variables, and so forth.'"

186 of 561 comments (clear)

  1. What we should really call it... by mcrbids · · Score: 2, Troll
    C-Flat?

    --
    I have no problem with your religion until you decide it's reason to deprive others of the truth.
    1. Re:What we should really call it... by Dr+Caleb · · Score: 3
      IIRC, the beep made by the original IBM PC was musically somewhere between C Sharp and D.

      Guess that's why the sound was so obnoxious. C# kinda makes sense now, eh!

      --
      "History doesn't repeat itself, but it does rhyme." Mark Twain
    2. Re:What we should really call it... by Graspee_Leemoor · · Score: 2, Insightful

      You make a good point, bringing up the JNI. I would like to continue this by criticisizing language designers who like to claim that their language doesn't let you do anything dangerous, but then provide a native interface so that when you need to do something you can't do in their language you can link to the routine written in C or whatever. They can then bounce around when programs have security flaws, saying that "Java is secure" and "Well the hole was in the C part" etc.

      Especially when the extra functionality you need is written for this application and is not just a link to a previously-written module it is damn handy being able to write it in the same language. In my view it is very cool of MS to allow you to use c# for everything.

      graspee

  2. So what? by mosch · · Score: 5, Interesting
    Since when does the ability to use pointers mean that something is wrong? C allows a lot of 'unsafe' code to be written, yet we're all using operating systems writting in C, with very little trouble caused by the OS itself.

    Sure, it'd be great (for Sun) for everybody to rewrite the world in Java, but in reality nobody can justify requiring 50% higher CPU usage in exchange for the ability to let programmers be careless.

    I'm not saying Java is a bad thing at all, merely that C# isn't any worse than C, C++, perl or python. It's a shame when a press release manages to get linked from slashdot's main page, but that's all this is. Sorry Joy, but I'm not buying it.

    1. Re:So what? by BlackSol · · Score: 5, Insightful

      Uhmmm How many buffer overflow exploits & crashes have there been of the years?

      But I do love C though...

      --
      $sig=$1 if($brain =~ /idea\s+(.*)/i);
    2. Re:So what? by Hiro+Antagonist · · Score: 4

      I think the difference is that .NET and C# are designed as a network-based platform; e.g., you grab code off of the 'net as you need it, rather than storing everything locally. Having "unsafe" code in such an environment is utterly suicide, as it allows pretty much anybody who can put code on the network for you to use can do what they want to your system.

      Java actually does the opposite of "letting programmers be careless"; it forces them to be pedantic. In Java, you *have* to check that data is formatted properly, or your program will throw an exception and die. You have to properly typecast objects, define variables, and return from non-void functions, or the compiler will return an error. Java forces the programmer to handle all the boring, tedious work of making sure their code handles error conditions in a proper manner; because if it doesn't, the program will crash. But it will never allow access to the system outside of the JVM -- making Java a very safe network application platform.

      --

      --
      I Hit the Karma Cap, and All I Got Was This Lousy .sig.
    3. Re:So what? by Anonymous Coward · · Score: 5, Informative

      The willingness of people to post without knowing the fundamentals of .Net astounds me.

      You need a special security privilege to run unsafe code. Code downloaded from the net doesn't have this permission, so it can't run unsafe code.

    4. Re:So what? by good-n-nappy · · Score: 5, Insightful

      Or wait until Microsoft adds a dialog box that says "Allow unsafe code from Microsft? 'OK' 'CANCEL' 'ALWAYS TRUST MICROSOFT'"

      Then the problem is transferred to the weakest link - the user. Just like a Word file that asks if you want to run macros. How many users always know when they should say yes?

      --
      Never underestimate the power of fiber.
    5. Re:So what? by Hiro+Antagonist · · Score: 5, Insightful

      There's also (in theory) a special security privilege to run "potentially harmful" ActiveX scripts or Outlook macros; yet they seem to slip through on a regular basis. I have little faith in Microsoft's ability to successfully implement a decent security model, based on their track history alone. The JVM doesn't provide any memory manipulation capabilities whatsoever, so even massive bugs in the JVM don't necessarily open up your entire system. I'd place a bet that there are ways around C# security.

      I will admit that I'm not fantastically well-versed in .NET (who is?), but I do understand the fundamentals.

      Furthermore, using code that handles memory directly is a lousy way to implement platform independent software; why do you think there are so many little-to-big-to-little endian conversion functions in C?

      --

      --
      I Hit the Karma Cap, and All I Got Was This Lousy .sig.
    6. Re:So what? by jdavidb · · Score: 2

      In Java, you *have* to check that data is formatted properly, or your program will throw an exception and die.



      Even that isn't enough. You have to check that the data is formatted properly for the functions you call with it, or you will get an exception. (Maybe, if you're lucky.) But there's nothing in the language to force you to make sure that the data you use doesn't contain special characters with unintended effects (such as appending additional commands to delete files, etc.) For that, you would want Perl taint mode.

    7. Re:So what? by SirSlud · · Score: 5

      The very existance of such an 'unsafe' flag allows for the possibility of a bug in the VM's security architecture that /could/ (I said could) allow malicious coders to flag their 3rd party code as 'safe', or otherhwise circumvent said facility.

      I think the issue at hand here is one of transparency. If this goes the way MS wants it to go, you'll likely not be aware of when you're computer is fetching code to execute from the network, so you've very little idea of the risks you expose your computer to. You're left with far more possible ways of exposing remote users to malicious code. Should you: trick them into thinking it's local code via a dialog? trick the VM into thinking its local code? exploit the requirement for the 'unsafe' flag in order to run unsafe code? There are now numerous ways of going out attempting to execute unsafe code on remote boxes.

      Now, take C, which, yes, most apps are written in, but you download them, install them, and go through a process that essentially makes you aware that your computer now has additional code residing on it, which /could/ be malicious.

      Then take Java, where you /shouldnt/ be able to write unsafe code. A much safer (better, faster, etc are not the issue here) approach when you're dealing with situations in which you might be transparently running execution code fetched from remote untrusted or unfamiliar locations. Only a bug in the VM could lead to code being allowed outside the sandbox, and even then, there is nothing in the language that could let the casual programmer attempt to munch memory, etc ... I'm apt to believe this kind of achitecture likely leads to less possible problems than the .Net approach (of allowing unsafe code at the 'discretion' of the VM). Basically, there are far fewer 'paths' to exploit in the VM in order to execute malicious unsafe code in user memory, and once an exploit is discovered, you still can't really use java to write memory sniffers or access devices, or whatnot.

      Ah well. Thats my 2 cents, from what I understand. For transparent remote-code network applications, I'll take Java's slow-but-safe approach any day of the week over MS's yet-to-be-fulfilled promises of being able to properly manage their own can of (marktable) worms.

      --
      "Old man yells at systemd"
    8. Re:So what? by Hiro+Antagonist · · Score: 4, Interesting

      There is a gross difference between Javascript and Java; Javascript is an in-brower scripting language with a rather vague specification. Java is a different beast entirely.

      Java applets are actually different from Java applications; they don't have the ability to interact directly with the contents of the hard drive, in addition to all of the other limitations running in the JVM. The most malicious things that a Java applet can do are make lots of windows (not a problem on a Unix box), or present false information to the user -- essentially, Java applets are no more harmful than HTML.

      I direct you to a pertinent section of the CERT/CC Malicious Web Scripts FAQ:


      Should I disable Java applets?

      The risk associated with Java applets is significantly different
      from some of the other technologies. Java has a robust security
      mechanism designed to deal with situations like these that prevents
      sensitive information from being disclosed or client information from
      being damaged.

      However, Java applets written by an attacker can still be loaded
      while your are viewing a legitimate web page. The problems that can
      arise are similar to those involving the and other HTML
      tags. For example, an attacker could develop a "Trojan Horse" program
      that presented misleading information and prompted you for a password.
      If you failed to recognize the malicious applet for what it was, you
      could accidentally disclose sensitive information.

      You must make your own determination about disabling Java applets,
      based on your tolerance for these risks. If you choose to disable
      Java, please see the detailed instructions below.
      --

      --
      I Hit the Karma Cap, and All I Got Was This Lousy .sig.
    9. Re:So what? by GSloop · · Score: 5, Insightful

      So, it would be perfectly OK for GM to put a "change oil" button on the dashboard of all cars. When you push the button, all the oil is dumped out of the engine.

      Every year around 250,000 people destroy their cars from this button.

      Who's problem is it? The user - probably. But it's GM's problem too. Any problem that occurs in significant numbers is a DESIGN problem. Sure, the user shouldn't, but good design will make it more difficult for a user to screw themselves. It will ALWAYS still be possible - the goal is to make it less likely that the user will do so unwittingly.

      Thus, MS's bugs are mostly MS's fault. They don't care about decent design. To blame the user is a cop-out.

      Cheers!

    10. Re:So what? by Shiny+Metal+S. · · Score: 4, Insightful
      You're right. If there were no chainsaws, people wouldn't cut off their fingers with them. But that would also mean that other people won't be able to effectively do their work.

      My point is, that when your first priority is to protect stupid people from doing stupid things, you often also protect smart people from doing smart things.

      Maybe I'm just old-fashioned, but I like to understand decisions which I make.

      But I don't know if you understood me, I was commenting:

      Just like a Word file that asks if you want to run macros. How many users always know when they should say yes?
      and I said, that:
      It's a good practice to not agree for anything you don't understand... When you don't know if you should say yes - just say no.
      Do you really disagree with that?
      --

      ~shiny
      WILL HACK FOR $$$

    11. Re:So what? by Lazarus+Short · · Score: 5, Insightful

      I'm not too well-versed on .NET (or compiler/interpreter issues in general), so maybe this is a stupid question, but just because C# has features to manipulate "pointers" doesn't necessarily mean that you're really playing with actual memory addresses, does it? It could just be an (internally bounds-checked) index into a big ol' byte array or something, right?

      e.g.

      print(foo);
      // interpreter looks up "foo" in the symbol
      // table, gets (e.g.) 23, and outputs memory[23]

      fooaddr = address_of(foo);
      // interpreter looks up "foo" in the symbol
      // table, again gets 23; looks up "fooaddr",
      // gets 24, and does memory[24] = 23

      fooaddr = fooaddr + 10;
      print value_at(fooadr);
      // interpreter compares fooaddr (which is 33) to
      // mem_size (which is 30), and dies (or whatever)

      As long as you test in your "value_at" function, you should be clear (from this particular problem, at least)

      Oh, and nice nick, BTW.

      --
      The most valuable commodity I know of is information. - Michael Douglas as Gordon Gekko, Wall Street
    12. Re:So what? by arkanes · · Score: 2

      Perl taint mode doesn't do that at all... all taint mode does is force you to apply a regexp to your data before you can use it. ANY regexp. So it's still perfectly possible to screw yourself, just if you do you have only your regexp skills to blame.

    13. Re:So what? by km790816 · · Score: 3, Interesting

      Keep in mind that it is remarkably easy for an administrator, either for the local machine or the whole network, to specify .NET security policies that cannot be overriden. This includes never allowing unsafe code that has not been previously authorized by an admin. It's simple, it's powerful, it allows great inter-op with Win32 and COM.

      .NET Framework Enterprise Security Policy Administration and Deployment

    14. Re:So what? by Anonymous+Brave+Guy · · Score: 5, Insightful
      Uhmmm How many buffer overflow exploits & crashes have there been of the years?

      Many. Then again, how many OSes written in Java have their been over the years?

      --
      If you disagree, post your argument. (-1, Overrated) isn't your personal censorship tool for views you don't like.
    15. Re:So what? by km790816 · · Score: 5, Insightful

      On a side note: Does anyone really expect Joy to say anything even remotely suportive of C#. Even if C#/.NET was the greatest thing since sliced bread, (I'm not saying it is) does anyone really expect anyone from Sun, especially one of the guys that created Java, to say anything possitive, supportive?

      It's like asking BillG his opinion on Linux or LarryE his opinion on DB2.

      Let's keep things in perspective, kids.

    16. Re:So what? by ekrout · · Score: 2

      Ironic. Read my weblog entry for today -- it's about hardware support for pointer safety.

      --

      If you celebrate Xmas, befriend me (538
    17. Re:So what? by JamesOfTheDesert · · Score: 2
      Java is not a scripting language.

      Sure it is. Java is converted to byte code, which scripts a virtual machine. Try running 'top'; The application running is the JVM, not your specific program. You see 'java', not 'SunOwnsMyAss.class' or whatever your program is named.

      (Yeah, yeah, I know, JIT, compiled to native code, blah blah. That's an optimization on top of the JVM. You could do the same for Perl or Python, but that wouldn't mean they weren't scripting languages.)

      --

      Java is the blue pill
      Choose the red pill
    18. Re:So what? by Hast · · Score: 2, Insightful

      Naturally, you should make it possible for lumberjacks to use chainsaws. It is also "common sense" that you don't give a chainsaw to your 5 year old to play with.

      Choice is very good, but too much choice is generally bad. Particularly when you give the options to people which clearly shouldn't have them.

      This is why it's not a good idea to let unsafe code be executed on a machine. Even if the user presses "OK" and thus at least the programmer or Microsoft can't be blamed. After all, if the user had any common sense he would know that it is bad to run untrusted code.

      Unfortunately common sense isn't.

      And if people didn't agree to things they didn't understand a lot of people would never get past the first install prompt they faced. As said, if you make user friendly programs and OS's, then you should expect that you will have a lot of computer novices behind the wheels.

    19. Re:So what? by mcc · · Score: 3, Interesting

      And lots of administrators won't bother. The network of NT machines at the high school i went to, just for an example, had a random administrator who was given the job just becuase he'd been a teacher who knew some stuff about computers, and he knew how to set up racks of ethernet switches, and he read some books. This person didn't really have much concept of security; he just disabled anything at all anyone might possibly have wanted to have done, making the computers somewhat irritating to use. And then he went to the people who'd hired him and said, look, on the NT machines you can only run netscape and wordperfect and notepad! It is secure! You will not have to worry about the students abusing the computers! And they were content.

      Despite this, there really was no security to speak of. All he'd done was limit the programs that could be executed to a small list of "approved" software. But he did it by name-- which meant that if you dropped winamp on a machine and renamed it to "notepad.exe", you could run it. The machines all had borland 5 on them, and you could execute programs you had the source to by running them in borland. And those programs could exec() others. And the write permissions were set such that one user could install Snood!, and every other user who used that particular machine forevermore would have Gator Download Assistant or whatever the hell it's called popping up every time they used netscape.

      The point of my story is this: Admining is not all that simple, and many people don't try that hard at it. Windows administration gives you *lots* of options. Lots and lots of options. There's always going to be a couple configuration options that every administrator misses, somewhere, even if they're trying really hard. And lots of the administrators out there are just doing the bare minimum they have to to get their paycheck.

      So, basically, even if it *is* really easy for an organisation to set up a windows xp machine to be really secure and locked down and 'safe', and even if the vast majority of deployers do go in and work out the settings just the way they're meant to,

      If .NET blows up into something really, really big, then the networks of that minority of sysadmins who *don't* know what they're doing, like the one at my high school, are *all* that the next great internet worm needs to wreak quite a lot of havoc.

      Just a thought.

    20. Re:So what? by MikeBabcock · · Score: 2

      You're missing the type of "unsafe" code the poster was refering to -- unsafe in coding practice, not in whether it has been cryptographically signed or not. Just because a program is signed (or even distributed with the OS) doesn't mean it is _safe_.

      --
      - Michael T. Babcock (Yes, I blog)
    21. Re:So what? by tshak · · Score: 2

      I'd place a bet that there are ways around C# security.

      Yup, it's called C++.

      --

      There is no longer anything that can be done with computers that is nontrivial and clearly legal. -- Paul Phillips
    22. Re:So what? by sheldon · · Score: 2

      You know if you weld the hood of a car shut, the user will never be able to change their oil themselves so it will have to be done by a GM Certified mechanic.

      But the other day welding the hood shut was a bad thing.

      Oh, it's so hard to keep these car analogies straight!

    23. Re:So what? by Alsee · · Score: 2

      what difference does direct memory access have

      Because the computer gets it's instructions from memory. You have the risk of changing the next instruction in memory to "Format C:".

      -

      --
      - - You can't take something off the Internet! That's like trying to take pee out of a swimming pool.
    24. Re:So what? by bay43270 · · Score: 2

      Maybe I'm just old-fashioned, but I like to understand decisions which I make. That was fine when we were only effected by decisions we make on our own. But now, with these Microsoft bugs, we are constantly effected by the decisions made by others. I may not open email attachments, but if two people in my entire company do, I get 300 emails and I have to restore the backups from my shared drive.

    25. Re:So what? by quintessent · · Score: 2

      Should you: trick them into thinking it's local code via a dialog?

      Such a dialog wouldn't be very effective. The program would have to convince the user to dig into the system's system security policy settings and change them. But even in Java, if you can convince users to do that, you've got them.

      trick the VM into thinking its local code?

      To change its status from untrusted to trusted, your code would need to get outside the sandbox. But if it can get outside the sandbox, maybe it doesn't need to convince the VM after all...

      exploit the requirement for the 'unsafe' flag in order to run unsafe code?

      If the VM sees unsafe instructions in the wrong context, it will not let the code run. The unsafe flag doesn't matter.

      Java has many of the same potential vulnerabilities. Java, like C# has trusted and untrusted modes. The real risk in untrusted mode is that someone will mess up the files on your disk. But, in both languages, this will not happen unless code finds a way out of the sandbox. The advantage of Java is that it has been around longer; it is a more mature platform with a larger installed base. The advantage of C# is they could learn from Java's experience in making something with a lot of the same advantages, but with more flexibility.

    26. Re:So what? by jsse · · Score: 2

      This is just like disallowing certain functions to be run in Intranet. The admin here once disallow javascript running but turn out we cannot access to our cooperation database as some functions in javascript cannot be used.

      Similar case here, yes an admin can disable any function but what if they live on these functions? His point is that they shouldn't make such an design at the first place.

    27. Re:So what? by jsse · · Score: 3, Insightful

      On a side note: Does anyone really expect Joy to say anything even remotely suportive of C#. Even if C#/.NET was the greatest thing since sliced bread, (I'm not saying it is) does anyone really expect anyone from Sun, especially one of the guys that created Java, to say anything possitive, supportive?

      So you mean no Java developers can critize C#, especially those who work in SUN, even when the opinions might be reasonable and valid?

      Tell Microsoft stop calling GPL virus! :D

      Let's keep things in perspective, kids.

      I know you are not calling me kids, but I found this statement funny when you said it. :D

    28. Re:So what? by jsse · · Score: 2

      indexing arrays isn't the biggest application on using pointers. :)

      They are talking about abusing pointers, like buffer overflow, not the convenience of using pointers.

      Btw, Java offer similar convenience in using reference in arrays. Yes you may say performance-wise pointer is much better, but consider running code over network security usually outweight performance in most case.

    29. Re:So what? by Malcontent · · Score: 2

      " You're right. If there were no chainsaws, people wouldn't cut off their fingers with them."

      And yet chainsaws have all kinds safety devices built into them to prevent people from hurting themselves.

      --

      War is necrophilia.

    30. Re:So what? by AndrewHowe · · Score: 2

      Actually it's bird wee.

    31. Re:So what? by JWhitlock · · Score: 2
      It's a good practice to not agree to anything you don't understand... When you don't know if you should say yes - just say no.

      Do you really disagree with that?

      Wow - if I did that all the time, I may not be happily married now...

    32. Re:So what? by Salsaman · · Score: 2
      Java does a lot of optimisations automatically (such as inlining getters/setters).

      I wouldn't be surprised if indexed arrays ARE turned into pointers in the byte code.

    33. Re:So what? by gorilla · · Score: 2
      Buffer overflow exploits are technically different to pointer problems.

      With a pointer problem, you point the pointer to something you shouldn't have. With a buffer overflow, the pointer is pointing to the correct place, but you stuff too much data into it.

      Some languages have references instead of pointers. The difference between a pointer and a reference is that a reference can only be taken of a well defined object, not an arbitary address, and no arithmetic is allowed on references.

      This means that you can always be sure that a reference is either valid and pointing correctly to an object, or invalid, and not pointing towards anything (NULL in C terms).

      However, this doesn't actually gaurantee that buffer overflow exploits are impossible. If you take a reference of an object that can hold 255 characters, and try to stuff 1024 characters into it, then there is still a chance to cause a buffer overflow. To avoid this, you need to ensure that your low level functions for copying data between the objects ensure that both the reference is valid, and that the target object is sized apropriatly (perhaps by resizing it as required).

      Java, C# & Perl all do this, which is why they're relativily immune to buffer overflows, with only flaws in the language implementation leaving you vunerable.

    34. Re:So what? by gorilla · · Score: 2

      There is only so far you can go in making the programmer write reasonable behaviour into the program. Yes, you can write the wrong regexp and untaint something dangerous in Perl, but how could a program know this? Similarly in Java you can just catch an exception and ignore it, when you should do something with the exception. However, at least the language has tried. Without taint mode or exceptions, the programmer can accidentally do the wrong thing. With them, he has to be boneheaded deliberatly.

    35. Re:So what? by km790816 · · Score: 2

      No. I'm saying we should keep things in perspective. I'm a java developer and I love .NET. I'm saying that one should be careful to whom one listens.

      I'd say listen to Windows guys about what they think of Linux, but I'm not going to base my decision on what's on Microsoft.com.

    36. Re:So what? by Shiny+Metal+S. · · Score: 2
      It's a good practice to not agree for anything you don't understand... When you don't know if you should say yes - just say no.
      "Save changes to document Really Important Stuff? (yes/no)"
      No
      Aaaarrggh... look what you made me do!!!
      If you don't understand that, then you have much more serious problem than anything what I'm talking about here.
      --

      ~shiny
      WILL HACK FOR $$$

  3. Trustworthy Code by SteveX · · Score: 5, Interesting

    You can use C# to write "Unsafe" code, but it's the runtime that ultimately decides whether or not to let it run. For example, if the VM that the browser creates tries to launch a C# app downloaded from the Internet, and it's "Unsafe", the CLR will refuse to run it.

    Difference between C# and ActiveX in this case is that in ActiveX, everything is "Unsafe" and you either take it or leave it. In Java, of course, everything is "safe". C# can go either way.

    I really hope that Microsoft simply makes it impossible to run "Unsafe" CLR code in the browser. Not even an option.

    - Steve

    1. Re:Trustworthy Code by xphase · · Score: 3, Informative

      The problem is that even "safe" Java has had security problems. Not relating to the language itself necessarily, but relating to browser/platform implementations.

      See the Risks Digest:

      17.39

      17.83

      18.18

      and there are many more listed in the archives.

      So until the languge/CLR mature enough, then there will be more problems with an insecure language.

      Also, note that most early Java security problems were found because sun encouraged people to find them, and then Sun would fix the problems. Microsoft doesn't want people to find and disclose bugs in it's software, so it may take longer to mature security wise.

      --xPhase
      P.S. pardon any spelling errors, i'm tired.

      --
      The following sentence is TRUE. The previous sentence is FALSE.
    2. Re:Trustworthy Code by gergi · · Score: 2

      C/C++ is unsafe because it allows to have pointers.
      Java is safe because it doesn't.
      C# is either safe or unsafe, depending on how you write the code?
      So... why would we use C# in place of C++ for applications where safety isn't necessary (or more likely, practical)? and why use C# over Java when safety is desired?

      --
      Nosce te Ipsum
    3. Re:Trustworthy Code by TWR · · Score: 2
      Except that you can't run native code in an applet unless the applet is signed AND the user has granted recognition to the signature.

      -jon

      --

      Remember Amalek.

    4. Re:Trustworthy Code by Glock27 · · Score: 2
      In Java, of course, everything is "safe".

      Not for at least two usages of the word "safe".

      First, Java can run C code using JNI, just not by default in the browser sandbox. Any Java application can use JNI. This is the direct comparison with the "unsafe" keyword in C#. The main difference here is it is much less easy to mix unsafe code throughout your project in Java.

      Second, Java can do "unsafe" (in the generic sense) things like delete files, just not by default in the browser sandbox.

      Finally, a signed Java applet running in the browser sandbox can request additional privileges outside the sandbox, but it is up to the user to grant them.

      I hope that helped.

      299,792,458 m/s...not just a good idea, its the law!

      --
      Galileo: "The Earth revolves around the Sun!"
      Score: -1 100% Flamebait
    5. Re:Trustworthy Code by FastT · · Score: 2

      One clarification. Potentially unsafe code in Java, such as deleting files, must be written to explicitly request permissions from the Java security infrastructure. Code that does not ask permission will not run in a sandboxed environment. Java's security infrastructure is not tied to running in a browser or other hosted environment--the user can change the permissions for running any piece of Java code, anywhere on the system.

      --

      The only certainty is entropy.
    6. Re:Trustworthy Code by Glock27 · · Score: 2
      One clarification. Potentially unsafe code in Java, such as deleting files, must be written to explicitly request permissions from the Java security infrastructure. Code that does not ask permission will not run in a sandboxed environment. Java's security infrastructure is not tied to running in a browser or other hosted environment--the user can change the permissions for running any piece of Java code, anywhere on the system.

      The default behavior for Java applications, though, is no sandbox.

      299,792,458 m/s...not just a good idea, its the law!

      --
      Galileo: "The Earth revolves around the Sun!"
      Score: -1 100% Flamebait
    7. Re:Trustworthy Code by spongman · · Score: 2

      it verifies the code instruction by instruction. Java VMs do this too. it's pretty simple.

    8. Re:Trustworthy Code by gorilla · · Score: 2

      It's very important to seperate the design, and the implementation. In an ideal world, they will be the same, but we don't live in an ideal world. If the design is good, then it's possible to fix the implementation. On the other hand, if the design is bad, then nothing you can do with the implementation will fix it. This is the problem that MS Office, MS Outlook and Javascript have, in that their basic security model is flawed, and have had to be tweaked as exploits were discovered.

  4. C# FUD? by glh · · Score: 4, Interesting

    This sounds like FUD. He didn't really post any examples about what kind of problems C# has for security, that would have been helpful.

    I think a lot of people are upset because MS has actually come out with something that can compare with Java finally.. The ability to write unsafe (unmanaged is what that really means, meaning the garbage collector and built in memory management features of the CLR won't touch it) is an added bonus to Java.

    I think the real question is- how secure is the .NET common language runtime?

    1. Re:C# FUD? by Zeinfeld · · Score: 2
      This sounds like FUD. He didn't really post any examples about what kind of problems C# has for security, that would have been helpful.

      I really would hope that Joy would be above stooping to a FUD strategy. But apparently not.

      What Joy does is to conflate two separate issues. The first is network code, the second is adding runtime code safety to C.

      Nobody disputes the fact that network code should be safe. Microsoft's security policies don't let you download unsafe code by default and the CLI runtime checker kicks in in precisely the same way it does in Java.

      That is not the same as saying that there is no use in any circumstance for unsafe code. The vast majority of the Linux kernel is 'unsafe code' if you want to be pejorative. Java simply refuses to ever let you write a piece of code of that type in Java and tries to make interfacing to that type of code as hard as possible. Microsoft on the other hand have rather a lot of legacy C++ code that they want to access even though they can't rewrite every line in C#. I think that Microsoft's interest here is closer to that of most developers.

      As for the MIME type FUD, it is a real pity that sun deliberately bypassed the MIME type system in HTTP to prevent firewalls being able to block Java. I made the protest at the time, they ignored it.

      Equally criticising Microsoft for not implementing the Javascript security model is a bit rich since few people outside Netscape would agree that Javascript has a security model. By their own admission Javascript was thrown together in a fortnight and thrown out the door with almost no checking.

      Sun would do much better to consider how they are going to survive as a specialist hardware manufacturer as Linux comoditizes the UNIX workstation market rather than spend their time engaged starting stupid arguments with Microsoft. As Balmer himself points out lots of companies have lost their way by focussing on Microsoft's business model instead of their own.

      The problem with Java is that it is a closed, proprietary language whose primary design criteria has become 'get Microsoft'. In the process Java has been deliberately made less useful to windows programmers, which means the vast majority.

      I think that Sun is playing right into Microsoft's hands by balkanizing software development into Java and Windows camps. History suggests that the larger developer pool will win out in the end. A stupid, stupid strategy.

      --
      Looking for an Information Security student project suggestion?
      Try http://dotcrimeManifesto.com/
    2. Re:C# FUD? by Zeinfeld · · Score: 2
      Also, it'd be great if you could point out how exactly Java has become "anti-Microsoft" in any way except by Microsoft itself?

      There is nothing to prevent people writing to a portable sub-set of C# if they chose to do so. That is very different from Java which denies choice, programmers are forced to program to the lowest common denominator.

      The problem with Java is that the language will always be limited to the subset of functionality that it serves Sun's interests to provide. Optimised i86 code and direct access to native O/S features don't meet those interests. So they will never be first class features of the language, even if Sun does not sick its lawyers onto companies that try to provide them.

      While C# reflects Microsoft's interests those are much more closely tied to those of developers. It is not in Microsoft's interest to limit functionality in any way.

      --
      Looking for an Information Security student project suggestion?
      Try http://dotcrimeManifesto.com/
    3. Re:C# FUD? by RickHunter · · Score: 3, Informative

      The problem with Java is that it is a closed, proprietary language whose primary design criteria has become 'get Microsoft'. In the process Java has been deliberately made less useful to windows programmers, which means the vast majority.

      Care to explain just how Sun is doing this? Every Java tool I've seen has either been totally platform-neutral (which I suppose can be interpreted as 'get Microsoft') or heavily biased towards Windows users. The 1.4 JVM adds a whole load of useful new stuff - again in a platform-independant way. How is this evidence of a "get Microsoft" mentality? Or making it any less useful to Windows programmer?

      And network code and runtime code safety aren't two seperate issues. They're the same issue. Making sure code that's been fetched and run from a remote source, perhaps as a small part of a larger program, doesn't go on a wild romp through the system sounds pretty damn similar to a "runtime code safety" issue to me.

      Finally, what exactly do you mean by "prevent firewalls from blocking Java"? Do you mean "blocking Java applets"? "blocking Javascript"? (Which is NOT Sun, BTW)

    4. Re:C# FUD? by Zeinfeld · · Score: 2
      This is completely untrue. First of all nobody is holding a gun to anyone's head to program in Java.

      That is not what I said. Java only allows you the choice to use it or not. If you try to develop a version of the language that meets your needs that Sun does not like, Sun will sick lawyers on you.

      Again total bullshit. If it were only Sun's interest the JCP wouldn't exist. If it were only Sun's interest Oracle wouldnt have created a native compiler for Java in the Oracle DB.

      My experience of JCP is that Sun decides who gets to chair your group then the chair goes off to do what they damn well please. It is not an open process at all. Oracles's java compiler is clearly in the interests of Sun as well as Oracle.

      --
      Looking for an Information Security student project suggestion?
      Try http://dotcrimeManifesto.com/
  5. Wow by mosch · · Score: 2

    Wow, so Sun doesn't like MS technologies. What's next, Microsoft spreading FUD about Open Source?

  6. define "unsafe" again please by JDizzy · · Score: 2

    "In unsafe code it is possible to declare and operate on pointers"

    I'm not a computer scientist, just a unix admin. My question is: Since when has operating on pointers been considered unsafe? Pardon my lack of understanding, but with that definition, wouldn't 99.9% of all code then be considered unsafe? And does't JAAVA use pointers too? Honestly I duno..

    --
    It isn't a lie if you belive it.
    1. Re:define "unsafe" again please by ArthurDent · · Score: 3, Informative

      Pointers are pretty ubiquitous in C, and a large percentage of existing code is in C, but not 99%. Now, you can write good pointer code and bad pointer code just like anything else. To declare all code that uses pointers to be unsafe is bizarre. The danger with pointers is that you can get them pointing at weird places and get weird results. :)

      Java (unless things have changed recently) does not use pointers. That, IMHO, is one of it's benefits, not because pointers make things unsafe, but because the code is easier to follow and understand.

      Ben

    2. Re:define "unsafe" again please by gergi · · Score: 2

      Java doesn't have pointers... well, at least not that you (as the programmer) can see.

      --
      Nosce te Ipsum
    3. Re:define "unsafe" again please by watanabe · · Score: 4
      The reason that one considers working with pointers unsafe is that, for example, in C, one uses the pointer to get at an actual location in memory, and do something with what is there. Programmers frequently want to work quickly and directly with the actual bytes in RAM; for example a 10x10 integer array may be implemented in C for performance / algorithm reasons as a 1 dimensional array of 100 integers.

      The problem occurs when the programmer writes their code to work through that array using pointer / address arithmetic. Perhaps the programmer is one byte off in their math, but only on the 100th integer. That is, they read the 101st number.

      Maybe the 100th number is 99% of the time 0, and 1% of the time is 1 (I know, I'm mixing my bits and bytes, but, bear with me, please). The 101st number is just some random value in RAM. It might be 0, or it might be 1. It might be used by some other structure, it might not be used. YOU DON'T KNOW. However, the bug will only show up in the event that you use the number, and that the number is different than you expected. Those two don't happen so often. Ergo -> Jane programmer spends two weeks of her life tracking down a random crash triggered by a function that relies on that last value being 0 based on certain preconditions.

      This isn't about computers crashing, it's about memory error bugs. I once wrote a ray tracer which got the colors terribly wrong once the light sources got too bright. After some checking, it turns out my light values weren't being capped at 8 bits. They were overwriting into the adjacent byte, and screwing up color values for pixels near them. Oops. Things like that don't _ever_ happen in Java, say.

    4. Re:define "unsafe" again please by Anonymous Coward · · Score: 4, Insightful

      The key point here is memory safety, which C (and C#'s with the unsafe keyword) lack. In a language with memory safety, buffer overrun vulnerabilities and the like can't happen.

      Typically, memory safety is tied to type safety. (But, memory safety really has nothing to do with pointers. For instance, SML/NJ allows pointers, but is memory safe, since the type system won't let you treat an integer as a pointer. In SML/NJ, the type system essentially provides you with a proof that your code is memory safe). So, if your code type checks, it *is* memory safe.

      The two concepts are distinct, though. Java is memory safe, but you can break the type system with casting. So their is no *static* guarantee that your code is memory safe, but the VM includes runtime checks to make this a dynamic guarantee.

    5. Re:define "unsafe" again please by Chris+Burke · · Score: 2

      I'm being pedantic here, but the 286 was actually where protected mode was introduced. It was a 16-bit protected mode, and thus not very cool, but it did provide a modern notion of segmentation where you could prevent programs from accessing memory outside of those areas defined in their segment descriptors.

      What's too bad though is that when the 386 came out and introduced the vastly more flexible paging mechanism, the segmentation stayed. Now, basically all programs run with 1 code and 1 data segment, with base address 0 and range 4GB, and paging takes care of everything else. But what's a little more cruft in x86? :)

      --

      The enemies of Democracy are
    6. Re:define "unsafe" again please by markmoss · · Score: 5, Informative

      First off, I'm primarily a hardware engineer, who writes small programs in C or assembly that deal directly with hardware. So I use pointers and other "unsafe" code a lot; they are both extremely useful and extremely frustrating when it comes to debug time.

      Pointers let you use just about any arbitrary number as an address and poke data in there. The virtual memory system might block this on the grounds that you don't have a page at that address -- but not all computers have the hardware to do that, you can still do horrible things by writing to the wrong place in the pages you do own, and if the protection does block the misplaced write, the resulting invalid page error is not pretty from the user's point of view.

      Pointers can be used safely -- if you program very well, like checking every address before you use it (which takes a hell of a lot of extra code), or checking the data going into the pointer calculations to ensure that no way could a wrong value come out (which assumes you didn't make any programming mistakes). And if it is a case of running downloaded code where there is a finite chance that the programmer is _maliciously_ misusing pointers, there is no way for the computer to analyze the code and detect this before you run it. Hence Microsoft's attempt to make internet and e-mail user friendly by automatically running any included executables spawned a plague of viruses, worms, and trojans...

      C++ gives you the choice of traditional pointers or references. A "reference" is a sort of super-pointer that includes data on where valid targets must be, and gets checked for validity every time you use it. I don't do Java, but I am under the impression that it uses references only. That isn't enough in itself to prevent writing Java viruses, but it gives the OS a fighting chance of confining them to the sandbox...

      OTOH, no computer is going to run entirely on "safe" code. At some level, the code has to read and write hardware registers. To do that, you take the numeric address of the register, and use that as a pointer. True, a good, secure OS would confine all such activities to drivers, which can only be installed by the administrator, who ought to know the difference between a driver and a trojan. But Microsoft doesn't write OS's like that -- NT/2000/XP is rather improved on DOS where direct writes to the video card were almost mandatory, but the security is still swiss cheese.

      Incidentally, the original reason for C allowing all sorts of unsafe activities (pointers everywhere, strcpy with no length check, etc.) was performance. Checking the length of a string every time it was used took CPU cycles and RAM to hold the extra machine code. So the creators of C left it up to the programmer to shove in an if statement to check the length when the string was input, and to do the math and pop in another if statement anywhere it was possible for the string to grow too long. This was efficient, but puts quite a load on the programmer. About that time, I was running an 8 bit computer with 16K of RAM, clock speed under 1M, and all the accounting, class schedules, grade reports, etc. for a small college went through it. Efficiency was important! Now, who's going to notice whether the program runs in 1 millisecond or 2? It's better to be reliable. And it's necessary to get the program up and running pretty fast -- that's a lot easier if you don't have to worry about pointers going wild except when you do go to the hardware.

      In C# apparently the programmer has the choice of using references and avoiding all "unsafe" code, or of declaring a module "unsafe" and programming any way that gets the job done. By making "unsafe" a PITA, they've encouraged programmers to avoid it except when absolutely necessary. I have a suspicion that once the coders get used to it, that will increase their productivity overall. In addition, it gives any tool that may run code from outside a quick way of determining whether the code was written to be safe or not. In theory...

      I have serious doubts about whether that (being able to run "safe" C-sharp programs) will actually work. First off, won't a virus-writer be able to hack the tags that say "unsafe"? Second, ways to do unsafe things in "safe" code will be discovered. Third, if your OS has security like swiss cheese, no program is going to really be safe. Do e-mail viruses actually have to do anything that isn't allowed?

      From what I've heard, Microsoft's idea of securing Outlook was to have it look at the HTML tag, and if it said executable pop up a warning which is incomprehensible to the people who are actually ignorant enough to get e-mail viruses. ('Yeah, it's from a trusted source. See the "From" line...') But if the HTML said "text", then it passed the attachment on to the Windows "open" command, which determines the type of the attachment by looking at the attachment, and if it was .exe or dozens of script-containing formats, it would let it run. Surely virus writers wouldn't be _dishonest_ and change the HTML tag so their .exe's would slip through...

      Until that sort of thinking changes, giving people a way of tagging the programs "safe" or "unsafe" is just asking for trouble.

    7. Re:define "unsafe" again please by JDizzy · · Score: 2, Troll

      That statement is a dangerous one for you reputation as a good admin.

      Really, how so... is my reputation damaged for asking silly questions? I don't do c/c++, or java.. the most I do is perl, and php... so my reputation for the job I do is in good form in that regards.

      Clearly, the lack of pointers to me would indicate an advantage in the fact that managing the pointer would be anoying for a developer. Why not let the compiler take the burden?

      --
      It isn't a lie if you belive it.
    8. Re:define "unsafe" again please by JDizzy · · Score: 2

      I AM A Unix systems Admin for my company. I do not program in C/C++, nor do I write JAVA. So by your logic, that means I'm not a Unix system admin? By that logic, it would mean all Unix admins would have to write in a lang that used pointers. I hardly think all Unix admins fall under that catagory.

      --
      It isn't a lie if you belive it.
    9. Re:define "unsafe" again please by unclefucknut · · Score: 2, Interesting

      "C++ gives you the choice of traditional pointers or references. A "reference" is a sort of super-pointer that includes data on where valid targets must be, and gets checked for validity every time you use it. I don't do Java, but I am under the impression that it uses references only. That isn't enough in itself to prevent writing Java viruses, but it gives the OS a fighting chance of confining them to the sandbox... "

      Actually, references are nothing but pointers under the hood. You can think of it as a constantly dereferenced pointer if you wish. References have the extra requirement that it must always have been initialized with a reference to an existing object. This is what the compiler enforces. But the compiler may be fooled as well:

      Object& func()
      {
      Object x;
      Object& obj = x;
      return x;
      }

      Object& y = func();

      What is y refering to now? This is perfectly legal C++ in some weird way. You can use y if you wish, and in most cases it will work (depending on compiler).

      ( Pointer version would look like:
      Object* func()
      {
      Object x;
      return
      }

      Object* y = func();

      I just hade to clear that up ;)

    10. Re:define "unsafe" again please by swillden · · Score: 3, Insightful

      "C++ gives you the choice of traditional pointers or references. A "reference" is a sort of super-pointer that includes data on where valid targets must be, and gets checked for validity every time you use it."

      This is not true. C++ references are exactly like pointers, except that you cannot rebind them. With a pointer you can point it one place, then point it another. With a reference you have to define the place it points when you create it and you cannot move it later. So:

      Foo& f = *(Foo*)0;
      cout << f.someValue;

      will still shoot you in the foot just as effectively as:

      Foo* f = 0;
      printf("%d", f.someValue);

      OTOH, in Java, they call everything a reference, but it's really more like a C pointer except that there is no pointer arithmetic. Oh, and it *is* always checked. Try to use a null reference? Exception. Try to typecast a reference in an invalid way? Exception.

      --
      Note to ACs: I usually delete AC replies without reading them. If you want to talk to me, log in.
    11. Re:define "unsafe" again please by markmoss · · Score: 2

      Excuse my ignorance of c++, but isn't *(Foo*)0 using pointers, so the declaration

      Foo& f = *(Foo*)0;

      would be "unsafe" in c#?

    12. Re:define "unsafe" again please by markmoss · · Score: 2

      Obviously I know less about c++ than I thought I did (I've never programmed in it), and got some things I heard about Java references mixed up with c++ references. OK, in C++ references are checked at the time of creation, rather than the time of use. That's less unsafe than pointers that are _never_ checked, but there are bound to be ways that the reference can become invalid later.

      In c, I did shoot myself in the foot with something similar to your second example once. Not twice, but that's mainly because I do such low-level programming that I do have to always think about how it comes out in machine operations... (The low-level view: x is a local variable, allocated from the stack. It goes away when the function ends, leaving y pointing to space that will be re-used for something else on the next function call. In debugging, you will be scratching your head as to why the value of *y keeps changing.)

      In your first example, it is possible for the compiler to interpret that in such a way as to make the code correct. That is, since x is returned, this object should be allocated space that outlives the function. I have no idea whether the c++ specs call for it to work this way, but if c# is purporting to be safe they certainly should do this. But is it possible to cover every way that an originally valid reference could be come invalid?

  7. The Furor about C# by Astral+Jung · · Score: 4, Funny

    I still don't understand what's so evil about C#. If you don't want to use it, you don't have to. But personally, I find that not using C# leaves a sizable gap in several different keys, meaning a lot of stuff comes out just sounding wrong.

    --
    "What's so random about flipping a coin? Ever heard of the I Ching?"
    1. Re:The Furor about C# by dstone · · Score: 3, Funny

      If people taking a disliking to C# they could always look forward to the upcoming E#. There are suspicions that this language might turn out to be vaporware, however.

      There's nothing vaporous about E#, however I do know that enthusiasts (in the music field field, at least) commonly refer to it as F.

  8. Music lesson... by jeffy124 · · Score: 3, Informative

    There is no C-Flat. Occasionally it is written on a piece of music, but it refers to a B. Lowering a C half a step gives you a B-Natural. Someone suggested C-Double-Falt. That would be a B-Flat.

    The reason for this is on the piano, the player needs to be able to look down and determine where their hands are based on the missing black keys between the notes B,C and F,E.

    Although, calling C# "B" might be interesting. But then again, there was a language B by K&R that preceded C.

    --
    The One Rule Of Chess You'll Ever Need: Don't play someone who carries a kit in their bookbag.
    1. Re:Music lesson... by Ieshan · · Score: 4, Funny

      And actually, that stands for C-Sharp, not C-Flat at all. You could call it D-Flat, but that'd be like a boob-job gone wrong instead of a programming language.

    2. Re:Music lesson... by Anonymous Coward · · Score: 2, Informative

      > There is no C-Flat. Occasionally it is written on a piece of music, but it refers to a B. Lowering a C half a step gives you a B-Natural. Someone suggested C-Double-Falt. That would be a B-Flat.

      If you want to get technical, get your facts straight. There IS a C-Flat. And there is also a C-double flat. It just so happens that Cb is enharmonically equivalent to B, and Cbb to Bb. The reason all this seeming complexity is kept around is so that, say, you are playin in the key of Ab minor. In Ab minor, the minor third is up by 3 half-steps, or a B. But the second is a Bb, so in order to write sheet music for Ab minor, we'd have to have a whole lot of accidentals. Therefore, we call what looks like a plain ol' regular B on the piano a Cb so that we can give scale degrees 2 and 3 different positions on the staff.

      > The reason for this is on the piano, the player needs to be able to look down and determine where their hands are based on the missing black keys between the notes B,C and F,E.

      Umm. Last time I checked music theory was not designed for incompetent pen^H^Hianists like yourself.

    3. Re:Music lesson... by TeknoHog · · Score: 2, Interesting
      To be precise, D-flat is different from C-sharp. D-flat is a little lower in frequency than C-sharp. However, most instruments today use an 'equally tempered' scale where e.g. D-flat and C-sharp are the same note, for example the piano and anything that has a keyboard.

      The reason that classical composers wrote their works in many different keys, is that they actually sounded different. In the equally tempered scale there is no difference (except the overall pitch change).

      Disclaimer: I used to play the trumpet, which can play C-sharp and D-flat (and similar #/b pairs) differently. I believe this can also be done with string instruments.

      --
      Escher was the first MC and Giger invented the HR department.
    4. Re:Music lesson... by Golias · · Score: 3, Interesting

      The tempered scale was needed so you could build a keyboard instrument capable of playing in tune in more than one key. Otherwise, a keyboard tuned to one scale would sound horribly dissonent when playing chords for another scale. Every Fifth, Fourth, and Octive on a tempered keyboard is perfect (there's lots of web sites that breakdown the wavelengh patterns of the perfect fifth... feel free to check it out if you care), and the thirds and chromatic notes are fudged a little bit to make that possible for every note on the keyboard.

      --

      Information wants to be anthropomorphized.

    5. Re:Music lesson... by Graspee_Leemoor · · Score: 2, Funny

      "Isn't it like saying, in cooking, we have all these herbs and spices, they're too difficult for me, lets throw them out and make everything taste the same?"

      Aha! You have stumbled onto the secret of English cooking!

      Graspee (UK)

    6. Re:Music lesson... by AndrewHowe · · Score: 2

      Humphrey: "Oh, Stop!"
      Noon: "That's sick."
      Frenchy: "I agree. Nutter, you were singing in the wrong key!"
      Nutter: "No I wasn't. It was Loutzenheiser. I was singing in Eb minor."
      Frenchy: "The song's in F# major!"
      Bell: "I think they're the same thing. I mean, Eb is the relative minor of F#."
      Frenchy: "No, it isn't. The relative minor is 3 half-tones down from the major, not up!"
      Noon: "No, it's 3 down. Like A is the relative minor of C major."
      Loutzenheiser: "But isn't A# in C major?"
      Bell: "Wait, are you singing mixolydian scales, or something?"
      Frenchy: "A# is tonic to C major. It's the 6!"
      Humphrey: "No it isn't!"
      Swan: "Well, it'd be like a raised 13th if anything."
      Frenchy: "Oh well. You guys are just a bunch of loser diggers anyhow!"
      Humphrey: "Oh see. You know we're right!"

      - from Cannibal! The Musical

    7. Re:Music lesson... by jbailey999 · · Score: 2

      The Piano is "not entirely accurate" in the same way that a cat fight is "Not exactly pretty".

      But what do you expect from firewood and car parts?

  9. Re:Secure code IS NOT related to language. by MtViewGuy · · Score: 2

    I think someone should throw the gauntlet down: let's see Bill Joy come up with a truly secure code for Java. And I mean some that meets the C2 standards for security, too.

    What is known is that you can write some pretty destructive programs in Java, too. Why do you think Network Associates and Symantec have spent a lot of time with their antivirus programs to protect against unsafe Java programs?

  10. FUD machine in overdrive by coonsta · · Score: 4, Interesting
    To serious developers not familiar with C# and .NET, either don't read Joy, or be willing to look into the details yourself. You could be embarrassed if you repeat the gist of this article as lore. At the very least, you can easily convince yourself that this article is bogus in that it doesn't mention that C# has three kinds of pointers-- managed, unmanaged and transient.

    C# does allow pointers and pointer manipulation. This is mostly for programmers seeking extra performance. Like a cast in Java, declaring code as "unsafe" is equivalent to saying to the VM, "Hey, I know what I'm doing." C# pointers are definitely not as liberal as C ones (just like casts in Java are not as liberal as casts in C).

    For those sincerely seeking an intelligent discussion of pointers in the CLR, see Gough, J. "Compiling for the .NET Common Language Runtime (CLR)" Prentice Hall, NJ 2002.

    1. Re:FUD machine in overdrive by roca · · Score: 5, Insightful

      > Like a cast in Java, declaring code as "unsafe" is
      > equivalent to saying to the VM, "Hey, I know what
      > I'm doing."

      This is wrong. A Java downcast is dynamically checked and cannot compromise the integrity of the virtual machine. It is not "unsafe" in any meaningful sense of the word.

    2. Re:FUD machine in overdrive by rossjudson · · Score: 2
      C# does allow pointers and pointer manipulation. This is mostly for programmers seeking extra performance. Like a cast in Java, declaring code as "unsafe" is equivalent to saying to the VM, "Hey, I know what I'm doing."

      And therein lies the truck-sized security hole, my friend. "I know what I'm doing" is exactly where the vast majority of security compromises start. Think about it -- you trust the vendor, so you permit their "performance enhancing" code to run. Well, they didn't have any bad intentions, but it turns out that there was a buffer overrun anyway. Crap. Now you have an executable stack 'cause a clever d00d found a way.

      C#'s Unsafe Code is trust-based security, through and through. It's another point of failure. Java's decision to prevent the running of machine code is a good one.

      I get tired of dorks who think that Java is some kind of least common denominator. It's a pretty high denominator, in my opinion. .NET looks pretty cool to me too. I just don't think "unsafe" code is a good idea.

    3. Re:FUD machine in overdrive by sql*kitten · · Score: 2

      This is wrong. A Java downcast is dynamically checked and cannot compromise the integrity of the virtual machine. It is not "unsafe" in any meaningful sense of the word.

      The VM can be configured to allow unsafe execution or not - that's the point. There are situations in which, if you trusted the code and were airgapped from the Internet, you would be happy to permit unsafe execution. It's up to the administrator of the VM(s) to make the decision.

    4. Re:FUD machine in overdrive by rossjudson · · Score: 2
      No security hole, huh? None, Nada, Zilch? I'm sure that's what the inventors of the Java sandbox thought when it first went out there. I'm sure that's what just about everybody has thought about every security sandbox variant that's been produced. Not one of them has come out clean.

      The bottom line is, it's a big, unknown, potential point of failure. Yes, it makes sense for the runtime to cordon off memory. No problem there. Can you assemble anything you like inside the memory? Can you run what you want there? Is it purely a buffer? Can you make things there and pass them to other, system routines? I just don't trust it. I don't think you should either.

  11. Anyone who read the article by Tribe · · Score: 2, Interesting

    Would know that right after he quoted from C# specification about unsafe code, he quoted again

    ""Unsafe code is in fact a 'safe' feature," the C# specification continues, "from the perspective of both developers and users. Unsafe code must be clearly marked with the modifier 'unsafe,' so developers can't possibly use unsafe features accidentally, and the execution engine works to ensure that unsafe code cannot be executed in an untrusted environment.""

    Seems like a good idea to me, whats wrong with that?

    1. Re:Anyone who read the article by Reality+Master+101 · · Score: 2

      Seems like a good idea to me, whats wrong with that?

      Sun and Bill Joy didn't do it that way, therefore, it's bad.

      --
      Sometimes it's best to just let stupid people be stupid.
  12. Uhhh, its supposed to...... by CDWert · · Score: 4, Interesting

    Uhh, and the problem with this is ???????

    All lll allow this, C3 may not be a lll but theyre trying to appeal to the uper end of that segment.

    C# allows you to write managed, OR unmanaged code as well, This is an option. As well as the coders ability to write "unsafe" code. YOU MUST INTENTIONALLY flag the code to be written as UNSAFE !

    If you dont know what you are doing and choose to do this so frigging what ???

    C# has the fundementals of a good language, forget its from MS, if it where from GNU, you;d be eating it up saying look how much better it is. I am looking forward to working with it, the .NET Visual Studio is written in C# itself , it should be pretty thouroughly debugged before its released.

    Play with it for a week , if youre a beggining C programmer youll love it, if youre experienced, youll love it for the same reasons, My bet is most of the people bitching havent read or written a single line of C#, if have and dont like it Id like to know explicity WHY ?, Ms bashing aside.......

    --
    Sig went tro...aahemmm.....fishing........
  13. Re:Different targets, confused Joy by night_flyer · · Score: 2

    Just because the language supports *clearly marked* "unsafe" (as in, the programmer is able to shoot-himself-in-foot) coding practices, does not mean that IE will allow controls that require that feature to run.

    what will make this unsafe feature any different thatn any other unsafe feature that IE runs?

    --


    Thanks to file sharing, I purchase more CDs
    Thanks to the RIAA, I buy them used...
  14. Taint mode? by chrysalis · · Score: 4, Insightful

    A language can be both 'safe' and 'unsafe'. Take a look at Perl. You can do a lot of insecure things with it. But as soon as you launch with the -T switch, your script will run in a special mode. Values coming from an insecure source will be refused by potentially dangerous functions, unless you explicitely mangle them before the call. This is extremely powerful and prevents a lot of classical security flaws.

    I don't know much about C#. But a taint mode for it would make the language pretty safe, despite the presence of pointers.


    --
    {{.sig}}
    1. Re:Taint mode? by crawling_chaos · · Score: 4, Interesting
      Two words: buffer overflow

      A "taint" mode would do nothing to catch these. Perl doesn't let you manipulate pointers and storage directly, so it's no big thing there. C#'s unsafe mode code does, and that's the big problem.

      --
      You can only drink 30 or 40 glasses of beer a day, no matter how rich you are.
      -- Colonel Adolphus Busch
  15. The ultimate secure language by mrroot · · Score: 5, Funny

    There's been alot of controversy lately over security holes in programming languages. There is one language that has stood the test of time and proven to be the most secure language of all, with a record zero (0) reported security holes.

    Here is the link if you want to learn more.

    --
    I Heart Sorting Networks
    1. Re:The ultimate secure language by mrroot · · Score: 2

      I think we just slashdotted LOGO!!!!!!! :)

      --
      I Heart Sorting Networks
    2. Re:The ultimate secure language by plaa · · Score: 2

      How about BF?

      --

      I doubt, therefore I may be.
  16. Joy FUD Club by Master+Of+Ninja · · Score: 4, Insightful

    Yep, I think the guy's getting quite jealous of MS. Love or hate these people, the .net programming specification look very powerful, and coupled with the hard-as-nails win2k/xp combination, they will be quite hard to compete against.

    What Sun should really do is get off there behinds and match C# for features. From what I understand (not much admittedly), the Java VM just has to be extended to give it the breadth of additional languages that the CLI has (in terms of being able to use unsafe methods if the programmer wishes, so allowing C to work through it). The problem with Java has MS has the dominant desktop (and a good one it is now - really this is fact if you have to use them all day long), and they have the "standard" tools for programming. This will generate massive mindshare, and might get everyone from VB to C# (at least being "safe" might be good for programs knocked up at home).

    On an unrelated topic, I think cloning the fundamentals of C# to a open-source basis is a very good idea. I might not agree how ximian are going about it, but at least the FSF has a parallel project that can bring the new language to the world - it could persuade casual safe programming, while allowing the breadth of accessing the OS directly.

    When it comes to web services, I honestly can't see the difference between Java and C# (apart from the fact everyone will use C# as the MS-sponsored dominant language). It's all down to FUD: the .net services are basically going to be the same as before - just with a .net after them, and maybe re-written in C# now.

    Java is great, but Bill Joy think he should go get it optimised - working faster, able to compete effectively with C#.

    1. Re:Joy FUD Club by gergi · · Score: 2

      sorry but i can't let this go...

      coupled with the hard-as-nails win2k/xp combination
      hmmm... beginning to suspect you have no idea what you're talking about. it was hard getting past the hard-as-nails part. i have a new computer in my lab right now that won't install win2k and is locked up in the (default) install process where it thinks it's already installed but it really isn't.

      dominant desktop (and a good one it is now - really this is fact if you have to use them all day long)
      dominant in marketshare only... i find it endless frustrating and difficult to use. Macs are infinitely easier to use and as far as I'm concerned, so is KDE. I used to use Win9x/NT before I found linux.

      can't see the difference between Java and C#
      Java - multi-platform
      C# - windows only (you don't think MS is going to extend C# like they tried to extend Java for windows?)
      So, if you have a server running, it has to be windows if you develop in C#. Now, you'd have to be insane to use windows as a production-level server. Unix is the only way to go... thus, Java.

      Sure, I think Java could use some competition but seriously, a Microsoft Windows-only solution is not the answer.

      --
      Nosce te Ipsum
    2. Re:Joy FUD Club by CaseyB · · Score: 2

      Best subject line ever.

    3. Re:Joy FUD Club by radish · · Score: 2


      What "features" does Java miss compared to C#?? The "feature" which allows me to write buffer overflows? Whooppeee!!

      Why do I need my JVM to run other languages? I like writing in Java thanks.

      Why do I care what the dominant desktop is? I use NT, write Java on it, and run said Java on a Solaris server farm. I personally prefer an NT desktop to a Unix one, but one of the nice things about Java is that I can use either.

      Sure, people will use C#, but I don't know a single Java developer in our firm who is even thinking of doing so...the switch will be from VB and C++ coders, and to be honest, I don't care. As long as I get to keep my JBuilder I'm happy, sitting and laughing as their servers get cracked again.

      --

      ---- Den ene knappen er powerknapp, den andre er Bender voice knapp "Bite My Shiny Metal Ass"

  17. Bill Joy the media whore by partingshot · · Score: 3, Insightful

    I stopped reading after this line:
    • "So Microsoft built ActiveX, a technique within Windows for automatically downloading and executing arbitrary programs"
    Maybe Mr. Joy should read up some more:
    --
    Anonymous posts are filtered.
    1. Re:Bill Joy the media whore by rreyelts · · Score: 2, Insightful
      Pfft... Now, why, oh why, would Mr. Joy ever say anything like that? Here's an excerpt from "The COM and COM+ Programming Primer" about ActiveX that might explain why:
      None of the other names has caused even nearly as much confusion as this one.... The reason so many people are confused by the name ActiveX is because the definition has changed. Originally ActiveX was a brand name for all COM-based Microsoft technologies that had utility on the World Wide Web.

      Emphasis mine.

      Hope you don't feel silly, because you've been taken in by Microsoft re-writing history.

      God bless,
      -Toby

    2. Re:Bill Joy the media whore by trenton · · Score: 2

      I'm not sure he can. The microsoft.com domain is blocked from within Sun, so that their researchers can troll and flame MS without knowingly being wrong.

      --
      Too big to fail? Does that make me to small to succeed?
    3. Re:Bill Joy the media whore by DavidpFitz · · Score: 2

      Rubbish! (Unless this is new!)

      I worked at Sun before, and microsoft.com was deinfitely not blocked.

      How else would we have been able to get Internet Explorer for Solaris? (Yes, some people at Sun use IE for Solaris.)

      There's loads of times when a Sun developer might need to look at MSDN, for example. And, Java support guys would definitely need access to MSDN.

  18. .NET security is not an afterthought by Oink.NET · · Score: 2, Insightful

    Security in .NET has been built into the foundations of the CLR, not added as an afterthought as Bill Joy implies. Read more about it at the .NET Framework Security Overview. The reason Microsoft seems so cocky about their new "trustworthy computing" crusade is because they know their new framework makes it a lot easier to follow through on their promises. Although there is still room for programmer error, that room is now the size of a broom closet, not a stadium.

    1. Re:.NET security is not an afterthought by Tony-A · · Score: 2

      Try WWW.TrustworthyComputing.com
      Considering Microsoft's track record, I think Bill Joy is actually being kind to Microsoft.

  19. He does have a point... by gillbates · · Score: 2
    In allowing a program to be either "safe" or "unsafe", C# is little different from any other programming language - the best and highest performing code will be written in "unsafe" mode. Which leaves the users in the same position as they were before with signed/unsigned ActiveX controls; do they dare download and run an unsigned/unsafe program? Or do they give up web page features for the sake of running "safe" code?

    Java was a step in the right direction. C# may be promoted by Microsoft heavily, but the prospect of "unsafe" code is only going to send up red flags with the average users. The average desktop user doesn't want to have to worry about safe/unsafe code - they just want to be able to browse the web safely - which is what Java already provides. Sorry, Microsoft, but Java already does better what C# was intended to do.

    --
    The society for a thought-free internet welcomes you.
  20. Sun shouldn't be complacent by astrashe · · Score: 5, Interesting

    Obviously Bill Joy knows a lot more about this stuff than I do; but I think he, and many of Microsoft's critics as well as supporters, are missing a crucial piece of the puzzle.

    Many of the features that have contributed to MS's insecurity were there not because MS's engineers were too dumb to think clearly about security, but because other people decided that there was an overriding business interest that the features would serve.

    Specifically, these features usually tend to be part of the MS strategy of leveraging success in one sector into another. If you use office, it makes sense to choose VB as your scripting language. If you know VB, it makes sense to run IIS. That's why there's a VB interpreter inside every office app.

    I think that what we've seen from MS is an official change in policy -- they're saying that business considerations now suggest that security should be the #1 priority. They're admitting that the market will punish them for security holes, and that they can't sacrifice security to establish leverage from one sector to another.

    MS has always put business concerns over technical ones. For that reason, a lot of /. posters have make comments to the effect that MS isn't capable of delivering technically. It used to be the conventional wisdom here, for example, that any MS OS was destined to crash repeatedly.

    It turned out that when MS saw Unix and Linux as a threat, and when they decided that reliability was one of the biggest advantages that Unix/Linux offered, they took reliability seriously and made enormous progress in a relatively short period of time. This suggest that Windows crashed not because MS *couldn't* make it reliable, but because it wasn't a *priority* for them to do so. As soon as they saw a change in the business climate on the edge of their radar screen, they changed their behavior.

    Windows and its applications haven't been secure because MS hasn't felt it was worth making security a priority until now. There is no evidence that they couldn't cover a lot of ground very quickly in security if that's what they decided to do. And it seems as if they've decided to do just that.

    I do agree that .NET and C# are technologies that predate this new ordering of MS's priorities, and that they probably won't be very secure. Passport, the most important .NET application yet written, coded by people who ought to know the technology best, has been hacked (and patched, it's only fair to point out). If MS's people don't write secure apps with .NET, are the low end VB coders the platform is designed for going to do a better job?

    But the problem that Sun faces is that MS has proven time and time again that they're willing to spend lots of money and go through lots of iterations to take a market. They're relentless. They usually don't get it right the first time, but they usually do get it right after four attempts or so.

    I'll say something else that will probably get me modded down. After the recent flirtation between AOL and RedHat, I'm not sure that the moralistic arguments against MS hold up so well. Linux has been at the center of some pretty slimey stock swindles -- our gracious hosts, here at /., work for one of those companies.

    Meanwhile, the Bill and Melinda Gates foundation is giving extraordinary sums of money to real nuts and bolts making the world a better place kinds of causes. Gates could literally turn out to be the most significant philanthropist in the history of the world. They're giving so much money that you can almost see a chunk of what you spend on MS going to a good cause.

    All of which suggests to me that politics and the morality play that have always clouded the linux vs. windows debate should probably be put to rest.

    Windows is horribly insecure -- viruses do incredible damage in the real world, especially among the least sophisticated users. That's not political, that's a fact.

    But they're saying they're trying to clean up the mess. Sure, it's a big mess, and sure it's going to be a big job to clean it up. I give them credit for admitting it, and to taking on the task.

    1. Re:Sun shouldn't be complacent by The+Cat · · Score: 2

      If MS's people don't write secure apps with .NET, are the low end VB coders the platform is designed for going to do a better job?

      Because there'll be a great big bloatware wizard there to clicky clicky clicky your way through alllllllllllllllll the problems. And then your boss will think you're a real "goooooroo" and you can get to the day-long meeting on time so you can compare PowerPoint slides with 'Bob' from accounting.

      (The sad part about this is that I just described about 80% of "IT departments") sigh...

    2. Re:Sun shouldn't be complacent by gillbates · · Score: 2, Offtopic
      Gates could literally turn out to be the most significant philanthropist in the history of the world. They're giving so much money that you can almost see a chunk of what you spend on MS going to a good cause.

      Who said, "I tell you the truth, this poor widow has put more into the treasury than all the others. They all gave out of their wealth; but she, out of her poverty, put in everything - all she had to live on."?

      What people fail to realize is that Bill Gates' money was obtained through immoral and oppressive means. One might as well count the drug lords in South America as philanthropists as well.

      The fact that Bill Gates is giving away money doesn't make him generous. Were he a benevolent individual, he wouldn't have drummed Microsoft's competitors out of business, or artificially raised the price of Microsoft software. Do you really believe that the man who claimed that church was a waste of time is giving money for purely altruistic reasons? Isn't it more likely that he's doing these things to make he and Microsoft look good?

      In case you didn't know, the second quote is from Jesus Christ (Mark 12:43).

      --
      The society for a thought-free internet welcomes you.
    3. Re:Sun shouldn't be complacent by PhotoGuy · · Score: 2
      Meanwhile, the Bill and Melinda Gates foundation is giving extraordinary sums of money to real nuts and bolts making the world a better place kinds of causes. Gates could literally turn out to be the most significant philanthropist in the history of the world. They're giving so much money that you can almost see a chunk of what you spend on MS going to a good cause.
      An awful lot of his charitable contributions are for putting Windows in schools. Not only cranks up Windows sales, gets a tax credit, and further entrenches Windows' monopoly in one of the most critical places. Seems like a pretty good deal.

      I believe his foundation (run by his dad, I think) does also contribute to other things, but the overall contributions, while large in absolute terms, are tiny in comparison to his wealth. Wasn't it Ted Turner that challenged Bill and the other Billionaires, to contribute more significant portions of their fortunes to the public good? And set a good example through his own contributions. (And I don't Bill or friends rose to the challenge at all.)

      -me
      --
      Love many, trust a few, do harm to none.
    4. Re:Sun shouldn't be complacent by sql*kitten · · Score: 2

      I believe his foundation (run by his dad, I think) does also contribute to other things, but the overall contributions, while large in absolute terms, are tiny in comparison to his wealth. Wasn't it Ted Turner that challenged Bill and the other Billionaires, to contribute more significant portions of their fortunes to the public good?

      Remember that most of BillG's wealth is in MSFT, and he can't tap that for liquidity without the market misreading it as a sign of impending doom. Relative to his paper wealth, he's not cash-rich at all.

      Still, when Mr. surprised-by-wealth ESR starts matching BillG dollar for dollar, maybe you will have a point.

  21. Where do you get your facts? by Carnage4Life · · Score: 5, Interesting
    I think the difference is that .NET and C# are designed as a network-based platform; e.g., you grab code off of the 'net as you need it, rather than storing everything locally.

    Really??? What gives you this idea? Java + VM is relatively equivalent to C# + CLR (as mentioned in my article that appeared on Slashdot a while ago). Code can be downloaded from the Internet and run just like with Java applets or RMI applications but this is far from the primary design of the platform .

    Of all the people in the world I'd expect to criticize a technology without adequately reading up on it first, Bill Joy would have beemn one of the last I'd expect to do such a thing.

    Bill Joy (and your post) go on and on about the vulnerability of network programming then ends with the reference to unsafe code which aims at giving the impression that downloaded .NET code can be unsafe. However this is incorrect, and I quote
    From a technical viewpoint, the term unsafe refers to whether the program is known to be safe. Before a program is converted from intermediate language (IL) to native code, there's a part of the runtime security system known as the verifier that looks at the IL to determine whether it's safe to execute. In this context, safe means that the verifier can prove that the IL doesn't do anything unsavory.

    IL safety is important for certain Microsoft .NET scenarios--it's nice to know that the chunk of code that you downloaded from a Web site isn't going to do anything bad to your machine. The default policy for remote code (either from a Web site or from a net share) is that the code must be verified safe to execute.

    In other situations, it's useful to write code that can't be verified to be safe. In C#, any use of pointers generates unsafe code, as does any use of interop, such as COM interop or platform invoke.

    Since you don't want to write such code inadvertently, C# requires you to use the unsafe keyword on your class or method whenever you write code that deals with pointers. When you use the unsafe keyword, the resulting IL is marked as unsafe and can only run in a fully trusted environment (usually, security policy only trusts local assemblies). In the current version of the runtime, unsafe is defined at an assembly level, so having any unsafe code in assembly makes the entire assembly unsafe.
    1. Re:Where do you get your facts? by cicadia · · Score: 4, Insightful
      First off, Joy admits that code declared as unsafe "cannot be executed in an untrusted environment," at least according to the spec. He goes on to point out that we're trusting Microsoft's implementation here, which hasn't always been the best policy, at least for security issues.

      > When you use the unsafe keyword, the resulting IL is marked as unsafe and can only run in a fully trusted environment

      This bit still scares me. Does this mean that the C# compiler marks the IL as unsafe, and that the CLR trusts this marking? If that's the case, what is there to stop someone from bypassing the compiler, and editing the IL directly? (And please don't tell me it has anything to do with signed, trusted code :)

      At least the Java model is based on fairly solid theory. The environment has a lot of nice properties which make it easy for the JVM to ensure that all code executed is safe. It begins with the position, "don't trust this code," and refuses to execute anything which it cannot prove to be safe. It doesn't rely on the programmer, or the compiler, to flag unsafe sections of code.

      --
      Living better through chemicals
    2. Re:Where do you get your facts? by west · · Score: 4, Insightful

      Everyone seems to assume that most C# programs will not have unsafe constructs, making it generally practical to disallow code with unsafe constructs.

      I'm willing to bet that most C# code will contain unsafe constructs. Programmers mostly come from a C background and, like all other humans, are basically lazy. Since unsafe code is both faster and easier to write, there will be tremendous impetus to write unsafe code so as "to get it done now".

      With enough code that has unsafe constructs in it, system admins/users will end up allowing unsafe code to run by default.

      In almost all cases, users want the maximum features and least security possible. Java's "least secure" mode is a lot better than "C#"s. Therefore Java is likely to be a lot more secure than C#. Blame the users? Sure. But it's the security that is actually used that counts, not what's available.

    3. Re:Where do you get your facts? by wadetemp · · Score: 2

      This bit still scares me. Does this mean that the C# compiler marks the IL as unsafe, and that the CLR trusts this marking?

      No. The runtime itself will not support the interop functionality and will instead throw exceptions when a block of code with a network origin point tries to run. It has zero to do with the compiler.

  22. He's so unbiased by WildBeast · · Score: 2

    I mean this guy is the chief scientist of Sun Microsystems and the co-author of "The Java language specification", what exactly do you expect him to say about C# ?

  23. This one's just too funny... by Uttles · · Score: 2

    BJ quotes verbatim: 'C# provides the ability to write unsafe code. In unsafe code it is possible to declare and operate on pointers, to perform conversions between pointers and integral types, to take the address of variables, and so forth.'

    First of all (go ahead and call me a troll, like I give a fuck): it's not nice to call someone BJ, even if their initials are in fact B. J.

    "Unsafe code" has no meaning to Microsoft. I'll put it this way, code monkeys are spewing out of Devry and ITT tech (and 4 year institutions under the mask of "computer information systems" majors) daily, with no real understanding of what makes good software development, and they want a language that will be as easy as possible and will fulfill all the buzzwords like "object oriented" and "self-specification." C# will provide this, and Microsoft will support it.

    --

    ~ now you know
  24. For those browsing at 1 or higher... Read parent by Chris+Burke · · Score: 3, Informative

    Since he's the only one who got the point, despite being an AC.

    The whole point of a safe language is to prevent a program from accessing memory it shouldn't. This means not only buffer overruns, but the ability to fabricate a pointer itself. Which means that trusted code won't compromise security with a buffer overrun, and untrusted code can't get a pointer to anything it might want (like, say, a capability descriptor it doesn't own).

    And the dynamic aspect is critical. Static guarantees are useless, because in the untrusted code case you weren't there to see it compile. But if you can run code from someone else, and be assured that the VM is going to prevent the program from doing anything it shouldn't, then running untrusted code becomes feasible.

    Assuming you believe the VM itself can be trusted. ;)

    This is all from memory of a lecture I had in Adv. Op Sys almost 2 years ago, so take that as you will. :)

    --

    The enemies of Democracy are
  25. All [programming] languages have an "unsafe" mode by alexander.morgan · · Score: 2, Insightful

    ...even English. To try it, go into a biker bar and tell the toughest looking guy you liked his mother. If that doesn't do it, ask him if he has a sister. Make sure to call 911 before you do ;-)

    Yes, C# has an unsafe mode. So does Perl, Python, Java Script, and guess what--Java.

    The only difference is that C# lets you write unsafe code in C#. In Perl, Python, etc.. you would write a shared library (or link extensions into the language executable). And then of course you have to trust that the shared library is "safe."

    Yes, there are going to be security holes in programs written in C#. Only careful programming, and as much peer review as possible can reduce those mistakes. In the end, only time will tell if an application has holes.

    Long live the Department of FUD! Let's go scare some suits :-)

    --AM

  26. Nice troll, Bill Joy by borgboy · · Score: 2, Informative

    Bill makes a lot of sniping little attacks on C# that really amount to very little. So what if C# looks a lot like Java? That's what all the C++ people said about Java back in the day.

    Then, he confuses the C language and it's inherent propensity for buffer overruns and various other pointer-math related problems with the C syntax - which is about all C# really inherits from C.

    C# executes in a runtime context, just like Java does. You have several means for controlling things like "do I let downloaded code execute file I/O?" or "do I allow unverified code to execute?"

    The crucial point here is the term unverified. The C# compiler can, and by default does, generate verifiably type-safe code. It has a compiler switch (oddly enough, "/unsafe") that enables unsafe code generation that includes unverifiable code. You have to use this switch when you use a unsafe directive in your code, and you have to use that directive to employ the pointer methods that Joy references. You might even take this a step further and think that, in an config file somewhere, there is a setting to disallow unsafe code that originated from the internet.

    Bill even hints at this, and I hate to think that he is disingenuous to the point that he's failed to actually follow up and look at the mechanisms .Net uses for code access security, but he plays it off with the FUD statement that the security was tacked on to the framework after the C# language was built. That statement utterly fragments once you have taken a close look at the security infrastructure in the .Net framework. It isn't perfect, but from what I've seen, the tools are there to allow the clueful to secure the box with a fine degree of granularity.

    --
    meh.
  27. Certainly FUD by wackysootroom · · Score: 2

    MS Creates a language that is similar to Java, and even though it has been left unsaid by MS, they would like to lure Java programmers away fron Sun and towards .NET.

    MS Creates ads in DDJ and other tech publications with benchmarks that show C# trouncing Java J2EE.

    This is almost certianly a FUD tactic in retaliation to MS trying to lure developers away from the Java platform.

    1. Re:Certainly FUD by radish · · Score: 2


      Those benchmarks were a joke, really. They compared an example application (written as a tutorial, designed to be easy to read & understand) with a heavily optimized, built for performance app.

      --

      ---- Den ene knappen er powerknapp, den andre er Bender voice knapp "Bite My Shiny Metal Ass"

  28. Re:You don't say... by elmegil · · Score: 2
    It's not the program so much as the environment that he's concerned about. Ok, so the language lets you write unsafe code. Whoopty. Except you're passing that code around the .NET environment where it could do some really nasty things if you aren't careful.

    The fallacy in your argument is that for every 10 developers who are working to write secure code (whether in a safe or unsafe language) there are at least 1 or 2 crackers working specifically to exploit how the code and the environment it runs in are unsafe. C# inherently makes this easier than java. Why would anyone allow .NET/C# code run on their machine is a mystery, because given Microsoft's track record, it seems that it will likely be yet another fruitful petri dish for crackers.

    --
    7 November 2006: The day Americans realized corruption and incompetence weren't addressing 11 September 2001
  29. Java has the exact same design by X · · Score: 2

    Do the following search and replace in this article:

    s/C#/Java/
    s/unsafe/native/

    And it still is true. Java has it's own "native" methods, which have all the same problems that C#'s unsafe methods have. In C#'s case it's a bit easier to work with because you don't have to change languages, (Java native methods can't be written in Java).

    Man, I hope someone calls Joy on his hypocracy.

    --
    sigs are a waste of space
  30. I use Db by epepke · · Score: 2

    C# is just Microsoft's imitation of Db. Once again, they take something that's been around since the equally tempered scale and claim it's an innovation.

  31. Sun is attempting diversionary tactics... by Stickerboy · · Score: 3, Funny

    ...before unveiling its secret weapon in the language wars:

    COBOL#!

    Yes, with the power of COBOL# Sun will be able to monopolize the huge untapped market of legacy COBOL code that could be easily modified and brought up to cross-platform, bytecode standards.

    Since there is so much more legacy COBOL code than C/C++ (75-80% of all existing code in businesses is still COBOL), Sun will one-up Microsoft, and along with Java will be able to win over developers with its advanced security features like a rigid sandbox and no direct memory manipulation.

    Next up for Sun, Java++... it's rumored that Sun's pulling out all the stops with this one, and even including a full-fledged graphical developing environment with the J++DK, complete with an intelligent "Programming Assistant" that will warn you when you're writing unsafe code! Dancing Bill Joy or paper clip graphics optional.

    --
    Light a fire for a man and he'll be warm for a day. Light a man on fire and he'll be warm for the rest of his life.
    1. Re:Sun is attempting diversionary tactics... by Oink.NET · · Score: 2, Informative
      COBOL#!

      COBOL for .NET has already been done by Fujitsu.

  32. Direct memory manipulation is unsafe. by barjam · · Score: 2, Insightful

    Languages that use direct memory manipulation do have drawbacks in the safe/secure area.

    I don't care how good a C/C++ programmer you are, you WILL create buffer overrun situations in your code. Period. End of story.

    All it takes is one program running as a priveleged user to have a buffer overrun and bam, compromised system.

    Thats not to say Java doesn't have the same problem. All it takes is one buffer overrun situation in the VM and boom, compromised system. It is probably safer though, you only have one large c/c++ program that many folks are looking at.

    Anyhow, my opinion.
    Barjam

  33. Java has the same stuff by benwb · · Score: 2

    We can do this in java too- but instead of being able to write unsafe code in java we're forced to use JNI and code in C.

    1. Re:Java has the same stuff by pinkpineapple · · Score: 2

      JNI actually can not be ran in a sandbox. So in that respect, Java applets are safe because they can run JNI libs.

      PPA, the girl next door

      --
      -- I feel better now. Thanks for asking.
    2. Re:Java has the same stuff by pinkpineapple · · Score: 2

      Make that : CAN NOT run JNI Libs.

      --
      -- I feel better now. Thanks for asking.
    3. Re:Java has the same stuff by benwb · · Score: 2

      Actually you can do it if your applet is signed and you have granted it the UniversalLinkAccess permission. Currently it looks like this still doesn't work under mozilla, but it should. Sun claims that it works with their Java Plug-in, see JNI and Java Plug-in

  34. Damn! Great troll. by brad.hill · · Score: 2, Insightful
    You had me going until I got to "Has Bill Joy ever written any kind of serious application? Does he know the first thing about programming?"


    ROFL

  35. Sandbox for compiled code? by kindofblue · · Score: 3, Interesting
    On a decent Unix system, it's not possible, or at least difficult, to destroy other peoples data. (Not counting, of course, buggy system call implementations.) But implemented properly, even things like "while (1) { fork(); }" will not kill the whole machine, because the OS will limit the consumption of virtual memory or CPU time, and then kill the errant process or swap it out.

    So why couldn't executable code, like ActiveX or CORBA code, be sandboxed also? This should just require that the component be put into a restricted execution context, that perhaps has lower priveleges than the user's context. The component would operate like a GUEST user, and would not have access to the invoking user's priveleges and resources, like files, etc. This guest user could have it's own scheduling priorities and quotas for a subdirectory, and so on.

    All the system calls, e.g. to DLL's or DSO's would be intercepted or remapped, or something like that, so that priveleges are checked and enforced, just like java does. Since modern CPU's can trap anything from illegal memory access to code or data, to illegal port access, it should be possible to fully isolate the code. Right?

    Of course, the performance would be inferior because of the context switching between different privelege levels. But in a "safe" mode, this would be a fantastic way to run plugins for PDFs, Flash, a whole game, or some downloadable application.

    I'm not a kernel expert, but I thought that mainframes could do this forever. What about Linux? e.g. with Wine?

    BTW, this would also make peer-to-peer style distributed computation (like the SETI project) safe and still fast.

    1. Re:Sandbox for compiled code? by josepha48 · · Score: 5, Insightful
      On Linux while(1) fork() may take down the whole system. Also while (1) malloc(1024) may start to cause problems as well. Other UNIXes can be attacked by runaway proceses as well. Windows and UNIX have that problem. One process that goes awire can take down just about any system if it has the provelidges. Especially if it is run suid or as root.

      Building a system with the sandbox design in minds is easier than taking an existing system and putting it in a sandbox. Active X is already out there. How do you handle the existing Active X and put that in a box? You'd basically have to redesign active X. Word, Excell and Access all rely heavily on VB macros. How do you put them in a sandbox? Actually that may be easier to do but it would also be limiting. In the sandbox that Javascript runs in you are not supposed to be able to access files on the users filesystem. (note not supposed to there have been errors on that though). The idea was there though.

      Okay so you operate it in a GUEST account. If that guest is set up or can access files there goes security.

      The reality is that 28 days is not enought time to focus on security and Microsoft does not have a good track record when it comes to security. While it may be possible to start building in security into the existing system. Security is a continuous effort that must be thought of as part of the design. When a programmer creates a new language they must start to think security right off the bat. This was done with Java, but not C#.

      I say good luck Microsoft, but you have a lot of work ahead of you to prove to me that you can get security right without comprimising usability.

      --

      Only 'flamers' flame!

    2. Re:Sandbox for compiled code? by josepha48 · · Score: 2
      "Who said they were only spending 28 days on security? I thought it was bugfixes. "

      I read that somewhere. I also read that it was for bug fixes. Still 28 days is not enought for bug fixes either. I work at a software company and we do it every release. We even back code many of the bug fixes that clients want. We also listen to our clients.

      "True, but a bit disingenuous:"

      Your analogy of cars is .. well off. Cars and operating systems are two completely different things. But since you made the comparison... cars have one button push door locks and some cars have 'automatic seat belts'. Also cars have air bags that just work most of the time. Cars think about security cause the goverment and people make regulations on how they should function and how they need to be safe. Air bags in teh front were found to save lives and then it became a requirement that ALL cars in the US have them. They don't have any regulations like that for software. Maybe we should require all software to have some sort of waranty and exchange. Maybe a firewall or something should be a requirement of ALL operating systems. Maybe virus software should too. If you look at Microsoft though they started with DOS, no security there. Then Win 3.1, no security there, just virus software. Then Win 3.51 NT, which had some security. Then Windows 95 which had little to none more like fake security. Then NT4.0 which had some. Now NT 2k I believe is the first offering that has a firewall or so I am told. Wow it only took them 10 years of working on the OS to figure out that it may be good to ship with a firewall. Hmm Linux started a firewall when? Ipchains was the first I remember using in about 98, but I know they had ipfwadm earlier than that. Hmmm OpenBSD worked solely on the premise of security since when?? Sun, the other BSD's?? Lets face it they are finally realizing that it is more important to users to have easy security and easy use and less bugs and less features.

      I'd like them to have there OS secure and stable as my parents use the OS. They don't and shouldn't have to learn about the OS and the computer. Microsoft also markets to people who don't want to learn about computers. Isn't doing things 'easier' supposed to be part of their XP marketing??? It is so easy to reinstall your OS cause it fell victum to a script virus that you got in an email.

      "The security responsibility lies with the infrastructure, NOT the language."

      Well acutally both. Since the language is reflective of the infrastructure. If the infrastructure allows for security holes so will the language. Then it is up to the programmer. I know I am not perfect. I like perl and scripting languages cause they handle most of that crap. I can code.

      "Your attempt to bash C# fails."

      I was not attempting to bash C#. I am only pointing out that like all things Microsoft it is uncertain as to how well it will actually be.

      Examples of how well they think things out and there track record are in the article. Word / Excel macros that let you open up other files. Ohh great, but security was never an issue. VB script in the email. Do users really want this? Do they need this? What are the security issues? They never though of any of this.

      Do we really need C#? Probably as much as we need Ruby, and the myrid of all the other languages that are poping up. Not really, but people will use them. You like C# great use it. Someone hacks your site cause of it, then don't come to me and don't complain about it.

      --

      Only 'flamers' flame!

    3. Re:Sandbox for compiled code? by quintessent · · Score: 2

      How do you handle the existing Active X and put that in a box?

      They are in a sort of box. If you don't want ActiveX controls on the web to run, turn them off. But even by default, you won't even have the option to run an ActiveX control unless it has a secure digital certificate telling you where it came from.

  36. Talk about flames by f00zbll · · Score: 2, Insightful
    Sure I submitted it, but I thought it was a good joke. Who would have thought it would get accepted.

    As others have said time and time again, it's about the developer who is writing the code. Sure it's FUD, but everyone is throwing it in every direction. The only thing half way useful from the article is about each company's approach to development, which doesn't necessarily validate their products. It's good people are thinking critically about the article and poking holes in Bill Joy's article. The only problem with providing the power and benefit of unsafe code is, when some uses it inappropriately or incorrectly, it creates headaches for everyone in the project. No news there. Good developers will spend appropriate time to learn the tool and use it "correctly." Here's to the hope C# will not only be developer candy, but that it will promote good coding practices.

  37. The Emperor still has no clothes... by the_skywise · · Score: 2, Flamebait

    What kind of syntatical gobbeldy-gook is this!?!

    If I put the keyword UNSAFE in front of any line of code, C# generates a flag (similar to CONST in C/C++), that sends the keyword all the way down to the code emitter which sets a flag in the .EXE header that states "the unsafe flag was set in the code, so don't run it if you don't run "unsafe" code...

    There's NOTHING, NADA, ZIP in this system that makes the code in this program "safe". All you're REALLY saying is "MICROSOFT WARRANTS THAT THIS CODE HAS NO POINTERS! (TM)"

    That's what Joy is saying... When Microsoft has to state in their documentation "The keyword UNSAFE, marks code that is UNSAFE to run, because the code being run would be UNSAFE when it is run. This actually makes the code SAFE." There's something VERY WRONG here...

    Stop buying the Orwellian newspeak... THE EMPEROR HAS NO CLOTHES!

    1. Re:The Emperor still has no clothes... by grammar+fascist · · Score: 2

      Read this again: In the current version of the runtime, unsafe is defined at an assembly level, so having any unsafe code in assembly makes the entire assembly unsafe.

      Assembly level. Therefore also opcode level. The bare instructions themselves are either inherently unsafe or marked as unsafe. It's not something in the executable header.

      It's not too difficult to imagine an instruction set like that.

      --
      I got my Linux laptop at System76.
    2. Re:The Emperor still has no clothes... by spongman · · Score: 2
      The CLR won't even load an assembly that contains unsafe methods unless the ApplicationDomain that requests it has the required privilege. Privilege levels cannot be raised, only lowered. The CLR checks both the metadata of the class and the individual opcodes (some of which are specifically marked as unsafe) during JIT compilation and verification (much like a JVM). The assembly will also be rejected if the metadata is innacurate.

      From 'Unsafe at the Limit' by Eric Gunnerson:

      From a technical viewpoint, the term unsafe refers to whether the program is known to be safe. Before a program is converted from intermediate language (IL) to native code, there's a part of the runtime security system known as the verifier that looks at the IL to determine whether it's safe to execute. In this context, safe means that the verifier can prove that the IL doesn't do anything unsavory.
      I little bit of R-ing the FM goes a long way.
  38. Let's assume MS *tries* to secure dotNET by JohnDenver · · Score: 2

    There's also (in theory) a special security privilege to run "potentially harmful" ActiveX scripts or Outlook macros; yet they seem to slip through on a regular basis. I have little faith in Microsoft's ability to successfully implement a decent security model, based on their track history alone.

    I think we can all agree that if there was any attempt to secure IE and Outlook from threats, it was either ignored or done half-assed.

    Just to be careful, I wouldn't compare a half-assed attempt at security to thier upcoming crusade (last crusade it was the Internet).

    I'd place a bet that there are ways around C# security.

    We'll have to wait and see. From what I understand, MS hasn't implemented a sandbox for executing applet like applications. When they do, I'm pretty sure it will be as restrictive and secure as the JVM (obviously pointer manipulation wouldn't be allowed). Why wouldn't they? It's not like they don't have experience making virtual machines.

    Furthermore, using code that handles memory directly is a lousy way to implement platform independent software; why do you think there are so many little-to-big-to-little endian conversion functions in C?

    It's not for building cross-platform code. It's for developing system code when you need to write system code.

    --
    "Communism is like having one [local] phone company " - Lenny Bruce
  39. Re:You don't say... by paulbd · · Score: 2

    i suggest you read the man page for strncpy(3). The strncpy() function is similar, except that not more than n bytes of src are copied. Thus, if there is no null byte among the first n bytes of src, the result wil not be null-terminated. this is a classic source of bugs in string manipulating code written in C.

  40. Isn't he the guy ... by zangdesign · · Score: 2

    whose afraid the world is going to be taken over by giant genetically engineered killer robots or something? Probably afraid the AI will be written in C#.

    --
    To celebrate the occasion of my 1000th post, I will post no more forever on Slashdot. Goodbye.
  41. Re:#unsafe and unmanaged pointers by borgboy · · Score: 2, Informative
    --
    meh.
  42. Even more... by GCP · · Score: 2

    Notice that Joy's article starts off sounding very technical, but never quite gets to any specific technical flaw in .Net. He just implies that it probably has a lot, without offering a single example, based on historical complaints about the company.

    If you think the "untrusted code" part was a (single) example, note that he doesn't actually point out any specific flaw.

    Java itself allows a program to delete user's entire hard drive, or write the binary op codes for a virus into a file and label it "readmeNOW.exe", if that user chooses to run the program as a standalone app. So Java has the concept of trusted and untrusted, too.

    If Joy wants to convince a technical audience that C# is dangerously insecure, you'd think he could come up with an example.

    Otherwise, it's nothing more than a fluff "I just don't like Microsoft, the company" piece.

    --
    "Those who have never entered upon scientific pursuits know not a tithe of the poetry by which they are surrounded."
  43. Low-level features are necessary by Florian+Weimer · · Score: 2

    Some tasks simply need low-level features. If you want to use a high-level language most of the time, you have got several choices: You can write the low-level parts in a different, low-level language, you can try to outgess the compiler vendor and write source code which compiles to the required machine code using a specific compiler version (in many cases, this is the C approach), or you can use a high-level language which supports low-level programming. The third choice does not have to be the worst, especially if the low-level language features are clearly separated from the high-level ones (C fails miserably in this area).

    Remember that many mission-critical computer systems are implemented in Ada, which offers a wide range of very low-level features (interrupt handling, representation clauses, unchecked conversion of objects, and so on). Unlike C, there is also explicit support for machine addresses and address arithmetic.

    However, you should keep in mind that only certain types of security problems can be avoided automatically by choosing an appropriate programming language. Buffer overflow and format string bugs are found in almost all C software, but they are not the only cause of problems.

  44. rreyelts the media whore by partingshot · · Score: 2



    You've been taken in by the anit MS FUD.

    Here is the most recent definition from MSDN:

    "A set of technologies that enables software
    components to interact with one another in a
    networked environment, regardless of the language
    in which they were created. ActiveX(TM) is built on
    the Component Object Model (COM). "

    Quite a step from "automatically downloading and
    executing arbitrary programs" don't you think?

    More specifically:
    "An ActiveX control is essentially a simple OLE
    object that supports the IUnknown interface. It
    usually supports many more interfaces in order to
    offer functionality, but all additional
    interfaces can be viewed as optional and, as
    such, a container should not rely on any
    additional interfaces being supported. "

    --
    Anonymous posts are filtered.
  45. Two Kettles Arguing over whos Blacker by MagikSlinger · · Score: 2, Troll

    Alas, I doubt anyone will be reading this, but I'll say it anyway:

    Java's security model always felt tacked on to me, but even still, it's pretty decent for the kinds of security issues it was meant to deal with. The problem is that Java can still be used to create viruses and other nasty problems, especially if it can sweet talk to user into giving the Java code more permissions than it would otherwise have. The same thing is true of ActiveX: all the security in the world won't protect you from a user who cranks the security in his IE down a few notches. The reason users would do this is to get access to a control or java app that can do something interesting or useful. For example, a virus scan of your harddrive.

    This leads me to a basic observation: the usefulness and capabilities of a language or programming environment is directly proportional to the amount of damage it can inflict on a system. Both languages and environments have their benefits and drawbacks, but deciding based on security is pointless: security is fundamentally a user-developer level issue. No amount of language-level or environment-level features can make computing secure if the user and developer aren't willing to think securely as well. If you do add more secure language and environment security measures, then the usefuleness of your language/environment decreases (e.g., to protect your local hard-drived files from unwanted operations, you lose the ability to save/read anywhere on your harddrive from your application). You cannot have a useful programming language/environment and still make guaranteed secure programs.

    C#'s unsafe section problems are not security problems, but robustness problems. The unsafe sections make it very easy to create code as crashable and bug ridden as a pure C/C++ app! Java's constraints don't make it more secure than C#, but they do make it easier to write robust code.

    Even with the unsafe sections, you can still write really high quality C# code because no language/environment feature can ever replace the programmer's diligence in writing secure code. And if you want code that's less bug-ridden and more robust, avoid unsafe code sections like the plague.

    My greatest qualm with C#'s unsafe section is knowing that a bunch of programmers raised on MS's crappy coding style will create components and other applications with great reams of unsafe code forcing everyone using .NET to drop their security precautions in order to get basic applications running thus creating the backdoor every script kiddie is waiting for.

    --
    The bitter lessons of a veteran coder: http://bitterprogrammer.blogspot.com
  46. Actually COBOL *is* part of .NET by eples · · Score: 3, Informative



    Actually, Fujitsu COBOL is part of the .NET framework. There's also Eiffel, and I think PERL too! Adding language support is easy, just build a compiler that can compile to MS's IL (Intermediate Language) instead of machine code.

    --
    I'm a 2000 man.
  47. C# - The speed of Java with the safety of C by AJWM · · Score: 3, Funny

    What a wonderful combination!

    --
    -- Alastair
  48. Sun and MS are both of the same kind by pinkpineapple · · Score: 2

    I suspect that Bill Joy's article is not totally objective here. I was almost expecting the word "Advertisement below" to flash above this article.

    See, the problem is that MS may have the killer Java technology here on the server side, and Sun smells it. So expect to hear more from people at Sun bashing hard on .NET and C#.

    What's Bill's point anyway? Ok, he knows stuff as he wrote vi and csh both in C, so he probably got into pointer trouble while writing his code. But, I am not sure about what he claims here. Is he asking MS to add the keyword "unsafe" into the C# language and is he bitching because MS already moved to the ECMA?

    At least MS had the decency to move their language to a standard body right away, instead of tip toeing for about 2 years like Sun did with Java. And Sun still controls Java BTW.

    Visibly, the guy with the gray goo on top of his head is running of fuel. It shows.

    PPA, the girl next door.

    --
    -- I feel better now. Thanks for asking.
  49. Can Someone explain the UNSAFE flagging? by rlowe69 · · Score: 2

    I've been reading a lot of comments about the IL code having some sort of flag mechanism indicating unsafe portions.

    My question is this: since the end-user JIT executes IL, what stops someone from editing the IL so that it becomes 'unflagged' as unsafe and tricks the end-user into thinking it is a safe portion? Are there a group of unsafe instructions? Is the IL obfuscated in some way? Or is it just as simple as an 'unsafe=1' in the .exe header?

    I think many of our concerns about unsafe code could be answered by knowing these details. Could someone with the technical knowledge step forward?

    --
    ----- rL
    1. Re:Can Someone explain the UNSAFE flagging? by rlowe69 · · Score: 2

      If it fails the verification check due to using any unsafe feature, it won't be allowed to run in a safe context.

      So it is the feature or instruction that is unsafe and if the program is in a sandbox which is not allowed to use the feature, then it flat out doesn't allow it. It doesn't sound like UNSAFE code is a security risk then .... is Bill just blowing FUD?

      --
      ----- rL
    2. Re:Can Someone explain the UNSAFE flagging? by mikera · · Score: 2

      Theoretically, you're right, and that's how it should work.

      However, that's not to say that there won't be some subtle and ingenious way to escape the sandbox, and given the complexity of .NET I'd say you have to accept that as a possibility. So it's probably harsh to say that it's all FUD given that the technology is as yet unproven.

  50. C$$ by peter303 · · Score: 2

    Despite its flaws it is much better than anything MicroSoft has had before from a developer's viewpoint. It makes it easy to write money-making apps on the worlds large operating system.

  51. Sun's FUD by markj02 · · Score: 5, Insightful
    The use of "unsafe" in C# is roughly analogous to the use of JNI in Java: modules using unsafe features (or native code) are identifiable as such by the runtime, and applications with security needs can exclude them. As such, C# isn't any less safe than Java. In practice, the C# approach is likely to be safer and more secure than the Java approach, since using "unsafe" inside a C# program is much more localized and much easier to get right than writing a JNI module.

    Furthermore, C# isn't even going after the same market as Java. Java's security model primarily comes into play for applets and mobile code, but that's only a tiny fraction of all applications. C#'s purpose in life is to allow programmers to create desktop and server applications more easily. For that purpose, an easy and robust interface to native code (regular expression libraries, XML parsers, etc.) is much more important than security.

    The major problem with C# isn't technical, the major problem is that there aren't any good implementations available yet (no, Microsoft's implementation isn't all that great yet) and that C# comes from Microsoft. But once there are C# implementations that are competitive with Java implementations and once C# has a life outside Microsoft, C# will be a serious threat to Java. And we may see a truly open source, efficient implementation of C# before we see one for Java.

    For the time being, I still think Java is the more logical choice for open source applications. It may yet be a few years before competitive C# implementations and libraries come along. Sun still can keep their lead by innovating and extending the Java platform, cooperating with the open source community, and being honest about the strengths and limitations of the Java platform. But if Sun continues along their current course, they will lose sooner or later.

    1. Re:Sun's FUD by micromuncher · · Score: 2, Interesting

      [ JNI and Unsafe ]
      JNI was not intended to be used as a portable solution, but Unsafe is. I have to jump through serious hoops to get Applets out of the sandbox.

      [ C# implementations ]
      What? No good implementations... the amusing thing here is I know many companies that jumped onto the C# and .NET wagon simply to avoid the problems with ASP! Even the immature technology is better that crap that just don't work right.

      [ Logical choice for Open... ]
      This argument is non sequetor. Any language can be used in open source, just as any library can be written in open source. Java won't go away, and NET# won't ever be a threat, because Java somehow managed to dominate the enterprise space. I don't think the thousands of enterprise users from oil companies to stock exchanges are going to replace their Weblogic-Oracle-Solaris systems any time soon. Consider that IIS is not an effective app. server (can't scale without external clustering), Access still can't do record locking or distributed transactions, and NT Server scheduled reboots are not acceptable...
      failover for reboots. What a joke.

      The cynic...
      p.s. Bill can lick my Salty Black Balls

      --
      /\/\icro/\/\uncher
    2. Re:Sun's FUD by markj02 · · Score: 2
      Well, as I was saying: for now, Java is still the better choice. But if good C#/CLR implementations become available on many platforms, Sun may well be in trouble. In fact, the most likely outcome is that you will see implementations that support both JVM and CLR and that allows developers to mix the two freely.

      JNI was not intended to be used as a portable solution, but Unsafe is. I have to jump through serious hoops to get Applets out of the sandbox.

      You can't get applets out of the sandbox, and neither can you use unsafe code from a C# sandbox. The point is that C#'s "unsafe" construct is very useful for non-applet applications and, as you point out yourself, Java has nothing equivalent. That's why "unsafe" is an advantage for C#: you get the same security model as with Java, but you get additional capabilities for desktop and server applications.

    3. Re:Sun's FUD by jsse · · Score: 2

      Java's security model primarily comes into play for applets and mobile code, but that's only a tiny fraction of all applications

      Good post but like a lot of Java developers I found the above statement untrue. Java's security model is used extensively in server-side Java. Say I'm working on the EJB loader which rely heavily on it. Also, 70% of the Java development here is around server-side. Java applets may be very hot when you switch to C#, but it's definitely not the case now.

      Also, java applet does not play a too important role in mobile, as an applet eats up more memory than normal java application does. Yes it'd be a problem here but tackling space requirement in mobile devices has the priority at this moment. Btw, I don't think mobile application is a tiny market afterall! :)

    4. Re:Sun's FUD by markj02 · · Score: 2
      I don't see much use for "unmanaged applet code" (no more than for applet code that calls JNI on Java). But I see a lot of use for unsafe constructs and unmanaged code in C# applications, and that's where the unsafe features and C++ linkage in C# just look a lot nicer than JNI in Java. Hooking up a C-based regexp or image processing library to C# looks pretty simple, whereas with Java, it's a major effort.

      As for memory addressing, I don't see a big issue there. Using unsafe constructs or unmanaged code, you can, of course, write machine dependent code, but you don't have to. And unlike C/C++ or JNI, such code is explicitly marked and clearly distinguishable from safe C# code.

      What C# does is really not all that different from what Modula-3 and Ada have been doing with unsafe code. It's a pretty sensible, down-to-earth approach. As far as I can tell, there really isn't anything wrong with C#; it's a clone of Java with a few additional, useful features thrown in.

      Of course, to be absolutely clear, I won't touch C# with the proverbial 10ft pole until some decent, open, non-Microsoft implementation comes out. Even if I wanted to use Windows, which I don't, Microsoft's current implementation is pretty iffy. And, despite Sun's FUD, Microsoft clearly still out-FUDs Sun.

    5. Re:Sun's FUD by markj02 · · Score: 2
      Java's security model is used extensively in server-side Java. Say I'm working on the EJB loader which rely heavily on it.

      Well, there are several issues there. First, EJB isn't the same as server-side Java. In fact, I suspect EJB represents only a tiny fraction of server-side Java. Second, the mere fact that EJB calls some security APIs doesn't mean that that actually accomplishes anything (class loaders are, of course, essential, but they are needed because of namespace issues, not for security). Third, C#/CLR does have similar functionality anyway.

      (Incidentally, I am a Java developer myself, and have been since the first release in 1995.)

  52. interpretation is the only way to guarantee safety by mrm677 · · Score: 3, Insightful

    Java is safe because it is interpreted. Sure, it is compiled, but the compiled code doesn't run on hardware.

    If .NET code is interpreted, then they can make it safe. If they have a silly marker saying "This code is safe because it doesn't operate on memory directly", then that is just silly because some hacker can easily remove this marker.

    Running code downloaded from the network, directly on your hardware, will always be somewhat dangerous. Of course that is what operating systems are for. However, there is always some way to figure out how to run malicious code in a privileged fashion.

  53. Re:Look out MS is innovating again. by the_verb · · Score: 2, Insightful

    Linux = UNIX
    Gnome = MacOS/Windows GUI (without the consistency.)
    Gimp = Photoshop (without the cluefulness.)

    Your point is? There are certainly grounds to criticize Microsoft, but sticking to legitimate complaints rather than knee-jerk name calling does a lot of good.

    I'm an old MacOS user, and I lost count of how many technologies cut their teeth as features in the MacOS, then became successful as MS refined them and implemented them in Windows.

    It's not as if that's a *bad* thing.

    --the verb

  54. No, no, I think this was a joke. by doom · · Score: 2

    Don't you get it? "...and so forth".
    Forth, you know?

    On second thought, if you haven't heard of
    Bill Joy before...

  55. Why doesn't Bill Joy just fix the problem? by blair1q · · Score: 2

    I mean, he's Bill Joy. If he can't knock out a safety-checker for C# units in a couple of weeks, then he's not the Bill Joy we grew up with.

    --Blair

  56. Fundamental approach is wrong by Xerion · · Score: 2, Insightful

    There seems to be a load of discussion on the actual functionalities and implementations of C#/.NET so far. But I think we should all take a step back and look at how MS approached the whole process of designing a supposedly platform-independent, net-oriented runtime system + language.

    I think we all agree that being the language of the NET, security is of priority #1, way ahead of functionality and flexibility. However, to design any kind of secure system, it is essential that you make the strictest system, and only then relax the security restrictions to allow more functionality. But it looks like MS wanted C# to do everything, and then add security as an afterthought. It is dangerous to achieve security by incrementally restricting the system.

  57. In Java, everything safe -- NOT by GCP · · Score: 2

    I like Java. I'd just like to point out that even in Java you have safe and unsafe runtime environments.

    I could easily write a Java app that would write binary op codes for a virus directly into some of your favorite application executables. The sandbox runtime wouldn't execute you it, but the standalone runtime would if you told it to.

    Bill Joy claims that there is a form of coding called "unsafe" in C# and expects you to draw the conclusion that C# is dangerous to use. Pretty pathetic argument for someone with his technical background.

    --
    "Those who have never entered upon scientific pursuits know not a tithe of the poetry by which they are surrounded."
  58. No "unsafe" code in browser? by GCP · · Score: 2

    I really hope that Microsoft simply makes it impossible to run "Unsafe" CLR code in the browser. Not even an option.

    No, that's not necessarily what we want, at least in the long run. It's more limiting than necessary for many purposes.

    .Net has a security model that lets you configure your runtime to allow various levels of access depending on digital signature. If I'm the family computer guru, I might set up my parents' computers and my sister's computer to run -- with full access -- anything stamped with my digital signature. I would do that locally on their machines during a holiday visit.

    After setting the security admin rules locally on their machines, I can thereafter deploy full-power software that I write to their (and my own!) browsers.

    --
    "Those who have never entered upon scientific pursuits know not a tithe of the poetry by which they are surrounded."
    1. Re:No "unsafe" code in browser? by Steveftoth · · Score: 2

      It it possiable to write code that scales to the security level it runs in?

      For example in java, since everything is runtime, if you are say... accessing the file system and get a security exeception doing it, then it's possiable to catch the exception and then say not write to the disk or just otherwise keep on going. Does the security precautions just stop any of the code from executing in the first place?

    2. Re:No "unsafe" code in browser? by GCP · · Score: 3, Interesting

      .Net uses security exceptions, too. It's finer grained than Java (or ActiveX) and is managed by a security admin system local to the client. You maintain the security rules yourself, or your office "helpdesk" guys do it for you, but it's done locally.

      It would be a very common thing for code to ask the runtime for permission to save a file automatically, and if permission is denied to then drop back and ask for a "safe file save" dialog box, which lets the user decide where to put the file and what to call it. The safe file save dialog doesn't even tell the app the name or location of the file that was saved. It just gives it a certificate for it, like having a valet park your car. The app doesn't know where it went, but if it wants it back, it can request it and have the contents only (not name or location) delivered back to it.

      If even this is denied, then the app can save files in a walled-off section of the hard drive managed by the .Net runtime, as something akin to a super-cookie. In this region, max file size, amount of allowed disk thrashing, etc. are all moderated by the .Net runtime.

      Java has nothing like this, and Bill Joy is hardly likely to bring that to your attention.

      --
      "Those who have never entered upon scientific pursuits know not a tithe of the poetry by which they are surrounded."
    3. Re:No "unsafe" code in browser? by Steveftoth · · Score: 2

      So basically .Net has a 'safe local storage' while the JVM doesn't? Well if this feature of .Net becomes at all popular, Sun could release this feature in a heartbeat. The security model of Java allows for this no problem.
      I was really just wondering how closely they copied the features of Java. I hope that they made their APIs such that it's easy to switch platforms. Is MS implementing the .Net framework for any other platforms? (Not some group of OS people)

  59. Not a stupid question by GCP · · Score: 2

    It's a good question. .Net has several categories of pointer. Some are there to allow you to use efficient indirection as a programming paradigm without simultaneously exposing the underlying memory system of the machine. The two do *not* have to go together.

    --
    "Those who have never entered upon scientific pursuits know not a tithe of the poetry by which they are surrounded."
  60. *fwoosh* by Wakko+Warner · · Score: 2

    That's the sound of the sarcasm plane darting swiftly over your head, safely unseen. If you look up quickly you might be able to spot the vapor trail.

    - A.P.

    --
    "Remember when the U.S. had a drug problem, and then we declared a War On Drugs, and now you can't buy drugs anymore?"
  61. Re:interpretation is the only way to guarantee saf by quintessent · · Score: 2

    Java's code does run on hardware.

    The Java compiler compiles it to byte code. Then at run-time the JIT (just-in-time compiler) available on many Java platforms compiles the byte code to native code.

    C# does the same thing. It compiles to a byte code called MSIL, and then at run-time it gets JITed to native code. And, just like Java, a C# app that you run from the web gets run in a sandbox to protect the user from malicious code.

  62. What "features"? by SuperKendall · · Score: 2

    Java has had for quite a while the ability to call C code, external DLL's, or whatever - JNI, the Java Native Interface. In fact it's also defined how external code (well, C and C++) can call into Java as well and launch a JVM from inside a native program. I've used it myself and it works just fine.

    Apart from that, I can't really think of any features the CLR or C# language has that Java is missing. What you could possibly say is missing are tools like MS provides - though Java does have many amazing tools like TogetherJ, JBuilder, Netbeans, and others. Still if for sme reason you bought into the cross-language idea (in my mind a total farce but I can see where people would find it appealing on the surface) the JVM does support many languages but there's really no tool that brings them all together at the moment.

    I agree with you on the web services aspect.

    --
    "There is more worth loving than we have strength to love." - Brian Jay Stanley
  63. Signed applets? by SuperKendall · · Score: 2

    What I like a lot about about the applet model is not just that it keeps things in the sandbox, it's how fine grained your control is over what the sadbox really is.

    An applet can do anything up to altering parts of your OS if you give it the scope. It can also be given just the barest permissions it needs, such as the ability to read and write to one directory on your computer and no other.

    --
    "There is more worth loving than we have strength to love." - Brian Jay Stanley
    1. Re:Signed applets? by markj02 · · Score: 2

      At least on paper, Microsoft is supporting pretty much the same model with C#/CLR (but I wouldn't want to vouch for their implementation). And where in Java, you need permission to call JNI code, in C#, you need permission to call native or unsafe code.

  64. Bill Joy should have done some research. by dannannan · · Score: 2, Insightful

    He should have checked out the MSDN docs. He should also have read some security studies or even done his own. Perhaps then he would have realized that the security of the CLR has nothing to do with an arbitrary bit set to mark a block of code as "safe", but rather to do with a type-safety verifier that is completely independent of the compiler and language used to generate the code in question.

    C# is not tied to the CLR like Java is tied to the JVM. The CLR (Common Language Runtime) is designed to run IL code, and there are compilers for many different languages besides just C# that can generate IL. That said, it should be clear that the security of a C# program is not derived from the C# compiler. It comes from the CLR, so the security policy is enforced at the IL level, not prior to compilation. (It would be laughable if the security of the CLR was enforced only by the C# compiler rejecting "unsafe" code. I'd just write my own C# compiler that allowed it, or I'd whip out my IL assembler.)

    The "unsafe" marking of code occurs only at the source code level. Whether or not code is considered type-safe by the CLR is not determined by an arbitrary flag set by the developer; it's a function of the IL code itself. It needs to be that way, otherwise programs compiled with my evil compiler for my own non-type-safe language would slip through the cracks. Note that even if my IL code is actually type-safe, if the CLR's type-safety verifier can't prove it, it won't be considered type-safe.

    That being said, "unsafe" is just a compiler feature. Perhaps Bill Joy would have had nothing to say if Microsoft had decided to use a keyword other than "unsafe", like maybe "dont_generate_an_error_at_compile_time_if_the_cod e_inside_this_block_fails_the_type_safety_check_ev en_though_it_is_going_to_fail_when_the_CLR_tries_t o_run_it_in_a_context_that_requires_type_safety". (Actually you can achieve this if you don't mind adding a #define to your C# source and then running it through a C preprocessor first.)

    But why take my word for it? Check out an interesting study into C# and the CLR's security done by some students at Rice University at http://www.owlnet.rice.edu/~jsinger/comp527/propos al.html. They have a lot of detail there about tests they ran, as well as a good paper summing up their results.

    D

  65. Backlashing and Frontlashing and Sideways Lashing by DaveWood · · Score: 3, Insightful

    It's funny that everyone here is saying Sun is spewing FUD and joking about Slashdot being rigidly anti-MS. As far as I can see, almost everyone here is rigidly pro-Microsoft and eager to heap abuse on Java and praise on Brave Microsoft for making the "Genius" C# and .NET.

    There's a tremendous amount of well-rated lies here about the article itself. It's really astounding in its volume - ranting on for pages about how Bill Joy is jealous, and C#'s pointers are totally safe, and Sun is making up lies about C#... "Insightful"! It's like some kind of geek guilt or something - we have to be hard on ourselves, and have a backlash against our backlash now?

    I prefer to actually look at the objective truth on a given day. What's the article about? Joy is saying that C# doesn't force you to be safe. It lets you choose. And the problem is that if you let people choose to be unsafe, then they sometimes will be unsafe, because it's easier, or faster, or because they don't know any better.

    Despite rampant misquoting here to the contrary, Joy wrote explicitly that he knows pointer-massaging code is marked "unsafe" in C#, and is recognized and treated differently by the CLR. It's right there in the article.

    The point is that it just brings us back to square one security-wise - to ActiveX. Break out your digital signatures. Do you trust this code? Yes or no. If you want to run it, you better. Some of it might be "unsafe." Once you start flinging pointer arithmetic around, you can stand up and piss right over the sandbox wall.

    So many choices. So much freedom. .NET is going to be asking your permission all the time. Let me tell you, I just spent the day with a secretary in a law office who was just wrapping her head around loading and saving documents. If her web browser asks her whether or not she "trusts" someone's code, she's going to just click a button at random no matter how many times I try to explain what to do.

    Joy's point is that in the context of network computing, certain kinds of flexibility are dangerous and ultimately destructive.

    I can just see all these rah-rah-C# people making the same kind of arguments I'm hearing about pointers for being able to do powerful word macros and having IE rendering emails. It's so powerful! "Just don't open any word documents from people you don't trust!" they say. Heh.

    What we've learned is that we can't dump this security dillemma on the world under the guise of "choice." We've made that mistake (MS certainly has) over and over again, and the result is the same every time. For something like .NET, without having ironclad and unequivocal guarantees - as Java can give you - you're setting yourself up to have another MS security disaster.

  66. Nasdaq uses Win2k, Shell uses Win2k by Otis_INF · · Score: 2

    I dunno, but Royal Dutch (Shell), one of the biggest oil companies in the world, uses Win2k worldwide in their wan (more than 70.000 machines), server, desktops, you name it.

    Nasdaq also uses win2k based solutions.

    Anyway, my NT server has now an uptime of 127 days and counting. Where are the reboots? I dunno, perhaps you don't know what you're doing, and considering your humourous remark about access I'm pretty sure you really don't have a clue.

    --
    Never underestimate the relief of true separation of Religion and State.
  67. And where is MS' C# implementation 'bad' ? by Otis_INF · · Score: 2


    The major problem with C# isn't technical, the major problem is that there aren't any good implementations available yet (no, Microsoft's implementation isn't all that great yet) and that C# comes from Microsoft.

    Big words, and I don't see any proof of it. In what way is the C# implementation of MS bad? (and others thus good?) Seems like you're recylcing a lot of hot air without adding anything useful to the conversation.

    --
    Never underestimate the relief of true separation of Religion and State.
    1. Re:And where is MS' C# implementation 'bad' ? by markj02 · · Score: 2
      In what way is the C# implementation of MS bad?

      I didn't say it was "bad", I said "it isn't all that great yet". That primarily refers to the fact that performance in it is still lacking (relative to Java or C++). That's based on benchmarks that I did myself.

      Also, C#'s APIs are nowhere near as mature and complete as Java's; exposing COM and Win32 just isn't enough.

  68. Inexperienced fool by EnglishTim · · Score: 2

    Only baby programmers and script kiddies and VB wienies are afraid to handle pointers.

    You've evidently never programmed anything of any size, a notion that is backed up by a quote on your webpage: "We're studying for our Masters Degrees in Computer Science at NSU and hopefully we'll be finished on June 20, 2002."

    When you get out into the Big Bad World Of Real Employment(tm) you'll find that those cute little pointers that you're so fond of in your toy CS101 code have grown up into big, badly behaved monsters that will bite you at any opportunity.

    If you're doing a project of any complexity, keeping track of all your data pointers becomes a non trivial problem - more so when you start working with several other people on the same codebase. What is the lifetime of an object? whose responsibility is it to see that that object is destroyed? How do these rules change under faliure conditions? How do you ensure that all the rules you've put down are obeyed?

    Jeez, why do you think Smart Pointers have become increasingly popular?

    1. Re:Inexperienced fool by EnglishTim · · Score: 2

      So you've never had to track down an annoying bug that was to do with uninitialised memory, freed memory, bounds overflowing or memory leakage? Evidently I underestimated you.

      I'm not trying to say that programmers routinely have problems understanding pointers, but that there are many places in large complex programs where they make it very easy to make a mistake. They also often result in errors that do not show themselves up immediately, and in fact do not show up until after you've shipped the product...

  69. Re:You have missed the point I believe by spongman · · Score: 2
    cunningly enough it pretty simple for a trusted application (like, say outlook.net) to create a 'safe' execution environment withing its own process (a separate ApplicationDomain) in which it can run untrusted code.

    The current episode of the .NET show is about exactly this. Well worth checking out if you want to be informed about such things.

  70. God forbid you do anything powerful like... by Kymermosst · · Score: 2

    Write a just-in-time compiler for an emulator. You can't do this in Java, or any other "secure" language that doesn't let you write directly to memory, access it via pointers, and use pointers to functions in that memory.

    You will NEVER see fast, efficient emulators or just-in-time compilers written in any so-called "secure" language. Instead, you need a language like C, or assembler... or both.

    --
    "Alcohol, Tobacco, Firearms, and Explosives" should be a convenience store, not a government agency.
  71. And who cares about Bill Joys marketing here...? by joto · · Score: 2
    C# provides the ability to write unsafe code. In unsafe code it is possible to declare and operate on pointers, to perform conversions between pointers and integral types, to take the address of variables, and so forth.

    One of the most annoying aspects of java is that you can't do that. Java is the perfect lock-yourself-in language. If you want to escape, the only standard mechanism is JNI, which is completely useless (the verbosity and ease of failure when using JNI is mind-boggling, when I tried to use it a year ago, I eventually had to write a tool for generating JNI. What should have been a simple foreign function interface is really a complete mess.)

    If C# offers mostly the same as Java, but with added features for real-world programming, such as the ability to add a dirty hack where it's needed, without going through all the torture and pain that Java makes you suffer, then I and many other developers will be much more happy to use C# than Java.

    If all you care about is security, you wouldn't be using Java anyway, and you would certainly not download executable code over the web (applets). And if all you want is applets, then by all means, go ahead and use Java. But for people looking for something to use for enterprise-wide programming systems, having to integrate lots of legacy code, I'll bet C# will make a strong contender just because of this feature.

    True, making it simple to do unsafe things is potentially dangerous. But making it unecessarily complex to do simple things also adds complexity, which isn't good for security either.