> Hmmm.  The dangling else clauses are pretty gross,

I hoped you wouldn't notice.  I guess I shouldn't have
commented them :-)

"It was the cleanest thing I could come up with".  Every
other thing I tried ended up as a maze of #ifdefs or some
incomprehensible cross-jumping mess; and I was aiming for
a minimal fix, too.

Or, perhaps, it was just a ploy to trick you into writing
a patch yourself.

> and in fact we have
> the same problem on POWER3 and RS64 processors

Right.  Too bad there is no public documentation for either :-/

> (to be fair, we had
> the problem before and didn't notice, but we should still fix it).

Yeah.

> How about this instead?

It's the better way forward, consider my patch withdrawn :-)

> -             if (!(vma->vm_flags & VM_EXEC))
> +             /*
> +              * Allow execution from readable areas if the MMU does not
> +              * provide separate controls over reading and executing.
> +              */
> +             if (!(vma->vm_flags & VM_EXEC) &&
> +                 (cpu_has_feature(CPU_FTR_NOEXECUTE) ||
> +                  !(vma->vm_flags & (VM_READ | VM_WRITE))))
>                       goto bad_area;

Should you really be testing VM_READ|VM_WRITE, or should it just
be VM_READ?

Oh, and that conditional might benefit from being split into
two separate "if" statements, it's a bit hard to read this way.


Segher

_______________________________________________
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Reply via email to