home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / arch / 9075 < prev    next >
Encoding:
Internet Message Format  |  1992-08-27  |  3.4 KB

  1. Path: sparky!uunet!usc!cs.utexas.edu!sun-barr!news2me.ebay.sun.com!exodus.Eng.Sun.COM!rbbb.Eng.Sun.COM!chased
  2. From: chased@rbbb.Eng.Sun.COM (David Chase)
  3. Newsgroups: comp.arch
  4. Subject: Re: Program behaviour (was Re: trapping speculative ops
  5. Date: 27 Aug 1992 23:59:23 GMT
  6. Organization: Sun Microsystems, Mt. View, Ca.
  7. Lines: 61
  8. Message-ID: <l9qr2rINNbpq@exodus.Eng.Sun.COM>
  9. References: <l9q6e0INN919@exodus.Eng.Sun.COM> <1992Aug27.202845.10747@bcars64a.bnr.ca>
  10. NNTP-Posting-Host: rbbb
  11.  
  12. In article <1992Aug27.202845.10747@bcars64a.bnr.ca> schow@bqneh3.bnr.ca (Stanley T.H. Chow) writes:
  13. >Also, there are languages and systems that actually specify the
  14. >behaviour for incorrect programs - typically, trap if dereferencing
  15. >a wild pointer. Given that most MMUs do quite a good job, it is 
  16. >strange to force those compilers to generate slower code.
  17.  
  18. Note that the MMUs don't do a perfect job, else there'd be no market
  19. for products like Purify.  People make performance tradeoffs.  I'd
  20. like to stake out a little territory at the fast end of the curve.
  21.  
  22. Since all I proposed can be done in software (enabled or disabled with
  23. a system call), you have no complaint -- the run-time systems for
  24. those languages will request that traps be reported, and page zero
  25. will be unmapped.
  26.  
  27. For C, this can be accommodated fairly easily by providing some way of
  28. identifying loads that ought to fault.  Any "volatile" load or store
  29. falls into this category.  You can use a bitmap of your text space, or
  30. hash on the addresses, or precede the volatile loads with a tagged nop
  31. instruction (on Sparc, "sethi #notzero,%g0").  Or, you can reserve one
  32. destination register as the I-mean-it register, and generate code to
  33. use that one when traps are required, and otherwise don't.  The trap
  34. code can check whether or not a fault is required by the code.
  35.  
  36. >The question is whether
  37. >the gain in performance justifies the lost in security. I expect
  38. >different people will answer differently.
  39.  
  40. Since I propose a software solution, different people can get what
  41. they want.
  42.  
  43. >I assume you mean no change to "Instruction Set Architecuture". You
  44. >are certainly implying changes to "System Architecture".
  45.  
  46. Not necessary, but it helps.  A suitably motivated user can get this
  47. for a Sparc box with an afternoon's hacking in non-OS code.  (I did
  48. it.)  It works better if you get cooperation from the OS, but this
  49. isn't required.  The penalty for actually taking the trap is pretty
  50. stiff, but my hunch is that (once page zero is readable, and excluding
  51. misaligned accesses) taken traps will be very rare.
  52.  
  53. >>Remember, we've got tools to help us debug our code.  
  54.  
  55. >But only during the "debugging phase". What happens when the program
  56. >is released into user hands?
  57.  
  58. That is up to the user and vendor.  Many people write code in C, which
  59. means that (unless they use Centerline or Purify or some similar tool)
  60. most of their array accesses are never, ever checked, let alone after
  61. release.  Their pointer casts aren't checked, either.  You've got no
  62. guarantee that the vendor did coverage testing of the code, unless
  63. this is specified in the contract or advertised.  People seem happy
  64. with the status quo.  Failing to trap some wild pointer accesses is a
  65. small departure from the current state of the world, especially given
  66. how easy it is to perform this check in debugging mode (let the MMU do
  67. it, just as it does today).  
  68.  
  69. Where this isn't appropriate, don't do it.  It's a software solution.
  70.  
  71. David Chase
  72. Sun
  73.