Question abort pmp

I want to know if RISC-V allows overlap of pmp configurations.

eg:
entry0 : 0 - 1024 Readable
entry0 : 0 - 512 Writable

if this is allows, will there be issues of obtaining privileges?

3.6.1 Physical Memory Protection CSRs

Priority and Matching Logic

PMP entries are statically prioritized. The lowest-numbered PMP entry that matches any byte of an access determines whether that access succeeds or fails. The matching PMP entry must match all bytes of an access, or the access fails, irrespective of the L, R, W, and X bits.

It seems that overlapping or nested ranges are ok. The first range specification that matches the address is used. RWX are taken only from that first matching range.

So in your example, 0 - 1023 is readable, and nothing is writable.

If you reversed the order of the entries then 0 - 511 is write-only, and 512 - 1023 is read only. The overlap is pointless as you could just make the second entry 512 - 1024 directly. There would be a point to the overlap if it was, say, 0 - 256 and 0 - 1024 because it would take more resources to specify 256 - 1024 (using power of two ranges).

This is just from my interpretation from reading the spec. I haven’t actually used or implemented it.

Thank you very much !