POV-Ray : Newsgroups : povray.off-topic : Computer Security : Re: Computer Security Server Time
3 Sep 2024 11:23:07 EDT (-0400)
  Re: Computer Security  
From: Darren New
Date: 19 Apr 2011 17:22:38
Message: <4dadfd1e@news.povray.org>
On 4/19/2011 11:50, Lars R. wrote:
>> As I said a while back, C (and C++) has a harvard architecture.
>
> Not by definition. The machine model of C and C++ just does _not_
> require a von-Neumann architecture. :-D

Well, yes, by definition. You can't write to executable code in C. You ca
n't 
change the running program in C. Data and code are in separate address sp
aces.

In practice, no. But by definition, yes. :-)

Now, the fact that your hardware doesn't *enforce* that doesn't reflect o
n 
C. The fact that the operating system can escape out of C in order to scr
ew 
with the return stack contents and the memory mapping in order to change 
the 
executable code of a process at runtime doesn't mean that's something you
 
can do with C.  The fact that you can use undocumented compiler-specific 

behavior to cast a data pointer to a code pointer doesn't mean it's a C 
language feature.

Here, have a C interpreter. Now tell me how to write some C code that 
changes what code can run while it's running.

Perhaps we're saying the same thing. C doesn't require a Harvard 
architecture because you can simulate a harvard architecture on a von 
neumann architecture. C doesn't take advantage of a von neumann 
architecture, and indeed the biggest security hole in computer science is
 C 
(and others) running on von neumann hardware emulating a harvard 
architecture but not enforcing it. (Aka buffer overrun code injection, et
c)

>>> http://roker.spamt.net/c++/datatypes_c55x.png
>>
>> The Xerox 560 (aka Sigma 9, […])
>> The Burroughs B series […]
>
> Thanks for the examples of "unusual" architectures! I still need some
> exotic or awkward ones for the C++ course I'm lecturing. :-)
>
>> I worked on an HP machine […]
>
> Which one?

Oh, got me. 46xx maybe, is the only thing that comes to mind 30 years lat
er, 
but don't even believe that. :-)

To be fair, the X560 wasn't really what you'd call an unusual architectur
e. 
It just had an odd way of specifying pointers.

> a prostration to lazy (or incompetent?) C programmers.

I wouldn't say that. C says you can have a single int* pointer variable 
point to either automatic (i.e., stack-allocated) or heap allocated data.
 
It's built into the language that the same code has to work for both.

Now, if you put the segment register into the variable, sure, you can do 

that on the 8086. But then you have 32-bit pointers.

-- 
Darren New, San Diego CA, USA (PST)
   "Coding without comments is like
    driving without turn signals."


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.