qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: Peter Maydell <peter.maydell@linaro.org>,
	qemu-arm@nongnu.org, qemu-devel@nongnu.org
Cc: qemu-stable@nongnu.org, Jason Wang <jasowang@redhat.com>
Subject: Re: [PATCH 1/3] hw/net/smc91c111: Sanitize packet numbers
Date: Sun, 9 Mar 2025 19:52:35 +0100	[thread overview]
Message-ID: <a80f3d0f-2f74-41a3-96e3-c3fb9c0b7440@linaro.org> (raw)
In-Reply-To: <20250228174802.1945417-2-peter.maydell@linaro.org>

On 28/2/25 18:47, Peter Maydell wrote:
> The smc91c111 uses packet numbers as an index into its internal
> s->data[][] array. Valid packet numbers are between 0 and 3, but
> the code does not generally check this, and there are various
> places where the guest can hand us an arbitrary packet number
> and cause an out-of-bounds access to the data array.
> 
> Add validation of packet numbers. The datasheet is not very
> helpful about how guest errors like this should be handled:
> it says nothing on the subject, and none of the documented
> error conditions are relevant. We choose to log the situation
> with LOG_GUEST_ERROR and silently ignore the attempted operation.
> 
> In the places where we are about to access the data[][] array
> using a packet number and we know the number is valid because
> we got it from somewhere that has already validated, we add
> an assert() to document that belief.
> 
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>   hw/net/smc91c111.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
>   1 file changed, 45 insertions(+)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



  reply	other threads:[~2025-03-09 18:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-28 17:47 [PATCH 0/3] hw/net/smc91c111: Fix potential array overflows Peter Maydell
2025-02-28 17:47 ` [PATCH 1/3] hw/net/smc91c111: Sanitize packet numbers Peter Maydell
2025-03-09 18:52   ` Philippe Mathieu-Daudé [this message]
2025-02-28 17:48 ` [PATCH 2/3] hw/net/smc91c111: Sanitize packet length on tx Peter Maydell
2025-03-09 19:01   ` Philippe Mathieu-Daudé
2025-03-10 11:06     ` Peter Maydell
2025-03-11  8:20       ` Philippe Mathieu-Daudé
2025-02-28 17:48 ` [PATCH 3/3] hw/net/smc91c111: Use MAX_PACKET_SIZE instead of magic numbers Peter Maydell
2025-03-09 19:01   ` Philippe Mathieu-Daudé
2025-02-28 19:22 ` [PATCH 0/3] hw/net/smc91c111: Fix potential array overflows Peter Maydell
2025-03-07 10:40   ` Peter Maydell
2025-03-11  8:59 ` Philippe Mathieu-Daudé
2025-03-11  9:08   ` Jason Wang

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=a80f3d0f-2f74-41a3-96e3-c3fb9c0b7440@linaro.org \
    --to=philmd@linaro.org \
    --cc=jasowang@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@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).