public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: "Richard W.M. Jones" <rjones@redhat.com>
Cc: sbrivio@redhat.com, passt-dev@passt.top
Subject: Re: [PATCH passt v2 4/7] passt, tap: Process data on the socket before HUP/ERR events
Date: Fri, 18 Nov 2022 12:32:53 +1100	[thread overview]
Message-ID: <Y3bgxVinxC9zR9eI@yekko> (raw)
In-Reply-To: <20221117184938.2270462-5-rjones@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1514 bytes --]

On Thu, Nov 17, 2022 at 06:49:35PM +0000, Richard W.M. Jones wrote:
> In the case where the client writes a packet and then closes the
> socket, because we receive EPOLLIN|EPOLLRDHUP together we have a
> choice of whether to close the socket immediately, or read the packet
> and then close the socket.  Choose the latter.
> 
> This should improve fuzzing coverage and arguably is a better choice
> even for regular use since dropping packets on close is bad.
> 
> See-also: https://archives.passt.top/passt-dev/20221117171805.3746f53a@elisabeth/
> Signed-off-by: Richard W.M. Jones <rjones@redhat.com>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  tap.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/tap.c b/tap.c
> index 9998127..d97af6a 100644
> --- a/tap.c
> +++ b/tap.c
> @@ -1106,13 +1106,13 @@ void tap_handler(struct ctx *c, int fd, uint32_t events,
>  		return;
>  	}
>  
> -	if (events & (EPOLLRDHUP | EPOLLHUP | EPOLLERR))
> -		goto reinit;
> -
>  	if ((c->mode == MODE_PASST && tap_handler_passt(c, now)) ||
>  	    (c->mode == MODE_PASTA && tap_handler_pasta(c, now)))
>  		goto reinit;
>  
> +	if (events & (EPOLLRDHUP | EPOLLHUP | EPOLLERR))
> +		goto reinit;
> +
>  	return;
>  reinit:
>  	if (c->one_off) {

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2022-11-18  4:59 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-17 18:49 [PATCH passt v2 0/7] Add fuzzing Richard W.M. Jones
2022-11-17 18:49 ` [PATCH passt v2 1/7] build: Force-create pasta symlink Richard W.M. Jones
2022-11-18  1:30   ` David Gibson
2022-11-18  7:56     ` Stefano Brivio
2022-11-17 18:49 ` [PATCH passt v2 2/7] build: Remove *~ files with make clean Richard W.M. Jones
2022-11-18  1:31   ` David Gibson
2022-11-17 18:49 ` [PATCH passt v2 3/7] passt, tap: Add --fd option Richard W.M. Jones
2022-11-17 18:49 ` [PATCH passt v2 4/7] passt, tap: Process data on the socket before HUP/ERR events Richard W.M. Jones
2022-11-18  1:32   ` David Gibson [this message]
2022-11-17 18:49 ` [PATCH passt v2 5/7] XXX build: Add extra syscalls needed by AFL instrumentation Richard W.M. Jones
2022-11-17 18:49 ` [PATCH passt v2 6/7] XXX passt: Kill seccomp and other isolation mechanisms Richard W.M. Jones
2022-11-17 18:49 ` [PATCH passt v2 7/7] Import fuzzing wrapper from libnbd Richard W.M. Jones
2022-11-17 19:06 ` [PATCH passt v2 0/7] Add fuzzing Richard W.M. Jones
2022-11-18 10:12 ` Richard W.M. Jones
2022-11-25  9:23 ` Stefano Brivio
2022-11-25 10:11   ` Richard W.M. Jones
2022-11-29 13:34     ` Stefano Brivio
2022-11-29 13:44       ` Richard W.M. Jones
2022-11-30  1:11       ` David Gibson

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=Y3bgxVinxC9zR9eI@yekko \
    --to=david@gibson.dropbear.id.au \
    --cc=passt-dev@passt.top \
    --cc=rjones@redhat.com \
    --cc=sbrivio@redhat.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

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 IMAP folder(s).