qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Catherine A. Frederick" <agrecascino123@gmail.com>
To: qemu-devel@nongnu.org
Subject: mmap2 is probably still broken in linux-user & other things
Date: Sun, 8 Nov 2020 10:53:28 -0500	[thread overview]
Message-ID: <cceb3d0d-958f-91f0-770e-4acb01fedd7f@gmail.com> (raw)

Hi, I submitted a patch a while ago and then dropped off the face of the 
planet like most people do. In my journey to fix DRM/radeonsi in 
user-mode emulation I discovered a few bugs. I don't really have the 
time to write the infrastructure to make wrapping DRM IOCTLs remotely 
not-ugly, but I do want to get patches in for the last bug I encountered 
as it's kinda sneaky.

Currently(as of 6 months ago, and I doubt anyone noticed) mmap2 is 
completely broken for it's intended use(mapping pages outside the 
address limit). The value of the address input to mmap is clipped to an 
abi_ulong(4 bytes of 32 bit platforms afaik?) and because of this the 
value in pages when converted to addresses and passed to mmap on the 
host is invalid and this breaks radeonsi(and probably any other GPU 
driver in linux-user.

I don't really know how to fix this in a sane way so I'm looking for ideas.

Another thing I'm looking for ideas wrt is I'm thinking about is some 
form of automagic(opt-in, through a new type) pointer/union translation 
in IOCTLs over the guest barrier. Currently it's really ugly to wrap 
most of the IOCTLs in DRM and amdgpu because the DRM ioctls frequently 
pass pointers to the kernel and because of this I don't feel comfortable 
merging my patches(manually translating the struct to the types of the 
host sucks and feels like redundant work). On top of that AMDGPU uses a 
lot of structs where currently having one type for the call would 
corrupt the data in the return union.

Last thing: I never really got any performance benefit out of my 
scheduler, but I think that's mostly from bad implementation. Is there 
any information on TCG's performance characteristics? Thanks.



             reply	other threads:[~2020-11-08 15:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-08 15:53 Catherine A. Frederick [this message]
2020-11-08 17:06 ` mmap2 is probably still broken in linux-user & other things Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cceb3d0d-958f-91f0-770e-4acb01fedd7f@gmail.com \
    --to=agrecascino123@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).