This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] C undefined behavior fix


Albert D. Cahalan writes:

> These examples make perfect sense. Here is another example, which
> you will surely hate:

The thing is, I wouldn't consider an AS/400 user process a suitable
environment in which to implement a kernel, so I don't hate it. :)

> Consider a machine like the CISC-based (non-PowerPC) AS/400.
> There wasn't any hardware-enforced memory protection, but the

There is, actually; there is an extra bit in each word of memory and
each register which says whether the value is a valid pointer or not,
and the hardware enforces that (user programs can't set that bit
themselves AFAIK).

> OS was secure. Your ability to create a pointer was restricted.

Still is, with the current PowerPC-based AS/400s.  I must ask someone
what happens if you cast an int to a pointer in a C program on an
AS/400.

Linux does run on recent AS/400 machines, but it runs in a partition
where it has a certain amount of memory that it controls completely
(i.e. it isn't an AS/400 process), and it runs with the cpu in the
mode where it doesn't check whether pointers have the valid bit set.

Paul.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]