On Mon, Jun 17, 2024 at 12:45 AM Robert Henry <rrh.he...@gmail.com> wrote: > I do not think I will have the time or focus to work on improving this patch > this summer, as I will retire in 2 weeks and need to make a clean break to > focus on other things (health, for one) for a while. > If anyone wants to put into place Richard's ideas, I will not be offended!
Great, I'll do the work and make sure your analysis and contribution to the patch is recognized. > I do not see any of this chatter in this email thread on the bug report > https://gitlab.com/qemu-project/qemu/-/issues/249 Yeah, that happens - the discussion in the bug report often focuses more on what the bug is than how to fix it. I had looked at the patch and came to roughly the same conclusion as Richard, though he beat me to answering. More precisely: - the main issue with your patch is that it only affects IRETQ and I think (going from memory) RETFQ. All IRET and RETF operations should use the CPL for the access. - a secondary issue with the patch is that you can use the *_data variant for both CPL0 and CPL3 accesses. - it's a good idea to also solve the related issue, that interrupts should use a data access for the DPL of the interrupt/call gate. That one cannot use *_data, so there are two alternatives: using an if like you did, or using the *_mmuidx variant with the MMU index computed in advance. Yet another related issue (going back to *really* legacy stuff) is that call gates need to use *_data when reading the parameters from the stack, so that it's possible to use call gates from CPL3 to CPL0 with CR4.SMAP=1. Paolo