Re: [PATCH] (IA64) Fix ugly __[PS]* macros in <asm-ia64/pgtable.h>

Jamie Lokier
2004-04-14T19:30:59Z

David Mosberger wrote:
> Jamie> Yes I have. Quite thoroughly.
>
> Then you should have noticed that drivers/char/mem.c is using PAGE_COPY.

That's an interesting bug in drivers/char/mem.c. PAGE_COPY is wrong,
for archs with separate execute permission or write-only mappings.

The correct argument in drivers/char/mem.c should be vma->vm_page_prot.

> Jamie> In theory the Alpha can do exec-only pages, but it's __[PS]*
> Jamie> map always gives read permission when there's execute
> Jamie> permission. I'm not sure if there's a reason for that, or if
> Jamie> it just historically copied the i386 behaviour (Alpha was the
> Jamie> first port).
>
> I know why: back in those days, GCC emitted code for nested C
> functions that assumed an executable stack. Also, Linus wasn't
> terribly eager to turn off execute-permission on data/stacks. Even on
> ia64 we started out that way, until I saw the error in my ways.

We're both wrong. I misread the Alpha code: it does have exec-only
pages. What it doesn't have is write-only. And exec-only pages
aren't relevant to GCC's requirements, which used to be
read-implies-exec (exec-only breaks exec-implies-read).

-- Jamie