Even though the user pointer is valid and it's mapped to the page table with U=1, if you're trying to dereference it from supervisor mode (S mode), you may experience page faults. This is due to the RISC-V memory protection mechanism.

In RISC-V, the U bit in the page table entry determines whether the page can be accessed by user mode (U mode). If U=1, the page can be accessed by both U mode and supervisor mode (S mode). However, S mode cannot access user pages if the SUM (Supervisor User Memory) bit in the status register is not set.

Therefore, to avoid page faults when dereferencing a valid user pointer in S mode, you should make sure the SUM bit is set in the status register. This allows S mode to access user pages.