In this case I think the translation is doing what it should and what you want, but when the mappings are set up in the first place they aren't being marked as read only, or if they are that marking isn't making it into the TLB. I think it's most likely the loader and/or the process setup code isn't doing anything special for read only segments and is just mapping them in as normal. Most of the time it doesn't matter, so I don't think anyone has put in serious effort to make sure that's wired up correctly.
Gabe On Thu, Mar 19, 2020 at 2:58 AM Boris Shingarov <[email protected]> wrote: > To add to my previous message re: "buried very far behind the > functionality of the MMU", I wouldn't say the old SE address translation > went very far in terms of basic fidelity, and I am wondering whether the > new design is making things better. > > For example. Consider the following: > > char *hello = "Hello"; > main() { > hello[0] = 'A'; > return hello[0]; > } > > This will compile to something like > > .section rodata > hello: > .string "Hello" > > On every machine I tried this (of various ISAs including ppc32, mips32, > amd64 and riscv64), the segment gets loaded into a R/O page, resulting in > segfault. gem5's SE treats all memory as R/W, so the above program happily > exits with code 65. > > For me, this has been a problem for a while (illegal page access is one of > the most critical elements of our guest workload), so I've been doing > various workarounds but have always looking towards one day implementing a > trap returning an actual "S05" to the controlling GDB. So I'd like to > understand. Is this latest change, in tune with allowing to mark those > pages that are marked r/o in the ELF as r/o for the proxy's translation? > In which place in the code should this marking be added? > > > > > _______________________________________________ > gem5-dev mailing list > [email protected] > http://m5sim.org/mailman/listinfo/gem5-dev _______________________________________________ gem5-dev mailing list [email protected] http://m5sim.org/mailman/listinfo/gem5-dev
