All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Weil <sw@weilnetz.de>
To: P J P <ppandit@redhat.com>, Alexander Bulekov <alxndr@bu.edu>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Jason Wang <jasowang@redhat.com>, Li Qiang <liq3ea@gmail.com>,
	Ruhr-University Bochum <bugs-syssec@rub.de>,
	QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [PATCH] net: eepro100: validate various address values
Date: Fri, 19 Feb 2021 09:08:31 +0100	[thread overview]
Message-ID: <00338810-b72e-6a9c-eef0-3c0adc764695@weilnetz.de> (raw)
In-Reply-To: <6qo84891-7or2-7p58-rr4-n2n46o5730rq@erqung.pbz>

Am 19.02.21 um 07:11 schrieb P J P:

>    Hello Alex, Stefan, all
>
> +-- On Thu, 18 Feb 2021, Alexander Bulekov wrote --+
> | Maybe the infinite loop mentioned in the commit message is actually a DMA
> | recursion issue? I'm providing a reproducer for a DMA re-entracy issue
> | below. With this patch applied, the reproducer triggers the assert(), rather
> | than overflowing the stack, so maybe it is the same issue? -Alex
> |
> | cat << EOF | ./qemu-system-i386 -display none -machine accel=qtest, -m \
> | 512M -device i82559er,netdev=net0 -netdev user,id=net0 -nodefaults \
> | -qtest stdio
> | outl 0xcf8 0x80001014
> | outl 0xcfc 0xc000
> | outl 0xcf8 0x80001010
> | outl 0xcfc 0xe0020000
> | outl 0xcf8 0x80001004
> | outw 0xcfc 0x7
> | write 0x1ffffc0b 0x1 0x55
> | write 0x1ffffc0c 0x1 0xfc
> | write 0x1ffffc0d 0x1 0x46
> | write 0x1ffffc0e 0x1 0x07
> | write 0x746fc59 0x1 0x02
> | write 0x746fc5b 0x1 0x02
> | write 0x746fc5c 0x1 0xe0
> | write 0x4 0x1 0x07
> | write 0x5 0x1 0xfc
> | write 0x6 0x1 0xff
> | write 0x7 0x1 0x1f
> | outw 0xc002 0x20
> | EOF
> |
>
> * Yes, it is an infinite recursion induced stack overflow. I should've said
>    recursion instead of loop.
>
>    Thank you for sharing a reproducer and the stack trace.


Okay, I can confirm the infinite recursion now.

The test case triggers memory writes by the hardware which cause new 
actions of the same hardware and so on.

I don't know how the real hardware would handle that case.

For QEMU we can extend the current code which tries to prevent endless 
loops: the device status EEPRO100State can be extended by a recursion 
counter to limit the number of recursions, or maybe a boolean flag could 
be used to stop any recursion of action_command(). I prefer the second 
variant (no recursion at all) and suggest to add a diagnostic message as 
well like it is done for the endless loop case.

Stefan





  reply	other threads:[~2021-02-19  8:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-18 14:06 [PATCH] net: eepro100: validate various address values P J P
2021-02-18 14:18 ` no-reply
2021-02-18 14:41 ` Peter Maydell
2021-02-18 16:10   ` Stefan Weil
2021-02-19  1:54   ` Alexander Bulekov
2021-02-19  2:06     ` Li Qiang
2021-02-19  2:14       ` Alexander Bulekov
2021-02-19  4:43         ` Li Qiang
2021-02-20  3:05           ` Alexander Bulekov
2021-02-19  6:11     ` P J P
2021-02-19  8:08       ` Stefan Weil [this message]
2021-02-19  8:26         ` Stefan Weil
2021-02-19  9:26           ` P J P
2021-02-19  9:52             ` Stefan Weil

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=00338810-b72e-6a9c-eef0-3c0adc764695@weilnetz.de \
    --to=sw@weilnetz.de \
    --cc=alxndr@bu.edu \
    --cc=bugs-syssec@rub.de \
    --cc=jasowang@redhat.com \
    --cc=liq3ea@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=ppandit@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.