All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sven Schnelle <svens@stackframe.org>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: "Helge Deller" <deller@gmx.de>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	qemu-devel@nongnu.org
Subject: Re: [PATCH 3/3] hw/display/artist: rewrite vram access mode handling
Date: Tue, 25 Jan 2022 17:29:53 +0100	[thread overview]
Message-ID: <87tudr6any.fsf@x1.stackframe.org> (raw)
In-Reply-To: <20220125082552.uupa7yyqdnpxgopw@sirius.home.kraxel.org> (Gerd Hoffmann's message of "Tue, 25 Jan 2022 09:25:52 +0100")

Gerd Hoffmann <kraxel@redhat.com> writes:

>   Hi,
>
>> +static void artist_vram_write4(ARTISTState *s, struct vram_buffer *buf,
>> +                               uint32_t offset, uint32_t data)
>
>> +static int get_vram_offset(ARTISTState *s, struct vram_buffer *buf,
>> +                           int pos, int posy)
>
>> +    case 0x13a0:
>> +        artist_vram_write4(s, buf, get_vram_offset(s, buf, pos >> 2, posy),
>> +                           data);
>
> That is asking for trouble.
>
> You should pass around offsets not pointers.  An offset can trivially be
> checked whenever it is within the valid range (i.e. smaller than vram
> size), or it can be masked to strip off high bits when accessing virtual
> vram.  You need that for robustness and security reasons (i.e. make sure
> the guest can't write to host memory by tricking your get_vram_offset
> calculations).

I'm not sure i understand the problem. get_vram_offset() returns an
offset, which is passed to artist_vram_write4() which itself doesn't
do anything on the buffer. artist_rop8() in the end accesses the buffer,
and that function checks whether it's < buf->size. Can you elaborate
a bit more? Maybe it's just so obvious that i don't see it.

Thanks,
Sven


  reply	other threads:[~2022-01-25 17:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-21 22:16 [PATCH 0/3] hw/display/artist: cursor & buffer mode fixes Sven Schnelle
2022-01-21 22:16 ` [PATCH 1/3] hw/display/artist: fix cursor position Sven Schnelle
2022-01-21 22:16 ` [PATCH 2/3] hw/display/artist: allow to disable/enable cursor Sven Schnelle
2022-01-25  8:11   ` Gerd Hoffmann
2022-01-21 22:16 ` [PATCH 3/3] hw/display/artist: rewrite vram access mode handling Sven Schnelle
2022-01-25  8:25   ` Gerd Hoffmann
2022-01-25 16:29     ` Sven Schnelle [this message]
2022-01-26  9:08       ` Gerd Hoffmann

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=87tudr6any.fsf@x1.stackframe.org \
    --to=svens@stackframe.org \
    --cc=deller@gmx.de \
    --cc=f4bug@amsat.org \
    --cc=kraxel@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.