Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1533933
| From | Andrey Konovalov <andreyknvl@google.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] tun: Use netif_receive_skb instead of netif_rx |
| Date | 2016-12-01 10:50 +0100 |
| Message-ID | <sJwa5-26V-7@gated-at.bofh.it> (permalink) |
| References | <sISw3-1KH-55@gated-at.bofh.it> <sITs6-2o0-27@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Tue, Nov 29, 2016 at 5:20 PM, Michael S. Tsirkin <mst@redhat.com> wrote: > On Tue, Nov 29, 2016 at 04:25:36PM +0100, Andrey Konovalov wrote: >> This patch changes tun.c to call netif_receive_skb instead of netif_rx >> when a packet is received. The difference between the two is that netif_rx >> queues the packet into the backlog, and netif_receive_skb proccesses the >> packet in the current context. >> >> This patch is required for syzkaller [1] to collect coverage from packet >> receive paths, when a packet being received through tun (syzkaller collects >> coverage per process in the process context). >> >> A similar patch was introduced back in 2010 [2, 3], but the author found >> out that the patch doesn't help with the task he had in mind (for cgroups >> to shape network traffic based on the original process) and decided not to >> go further with it. The main concern back then was about possible stack >> exhaustion with 4K stacks, but CONFIG_4KSTACKS was removed and stacks are >> 8K now. >> >> [1] https://github.com/google/syzkaller >> >> [2] https://www.spinics.net/lists/netdev/thrd440.html#130570 >> >> [3] https://www.spinics.net/lists/netdev/msg130570.html >> >> Signed-off-by: Andrey Konovalov <andreyknvl@google.com> > > This was on my list of things to investigate ever since > 8k stack default went in. Thanks for looking into this! > > I note that there are still seem to exit 3 architectures that do have > CONFIG_4KSTACKS. Hi Michael, Missed that, mailed v2. Thanks! > > How about a wrapper that does netif_rx_ni with CONFIG_4KSTACKS. > > >> --- >> drivers/net/tun.c | 4 +++- >> 1 file changed, 3 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/net/tun.c b/drivers/net/tun.c >> index 8093e39..4b56e91 100644 >> --- a/drivers/net/tun.c >> +++ b/drivers/net/tun.c >> @@ -1304,7 +1304,9 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, >> skb_probe_transport_header(skb, 0); >> >> rxhash = skb_get_hash(skb); >> - netif_rx_ni(skb); >> + local_bh_disable(); >> + netif_receive_skb(skb); >> + local_bh_enable(); >> >> stats = get_cpu_ptr(tun->pcpu_stats); >> u64_stats_update_begin(&stats->syncp); >> -- >> 2.8.0.rc3.226.g39d4020 > > -- > You received this message because you are subscribed to the Google Groups "syzkaller" group. > To unsubscribe from this group and stop receiving emails from it, send an email to syzkaller+unsubscribe@googlegroups.com. > For more options, visit https://groups.google.com/d/optout.
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH] tun: Use netif_receive_skb instead of netif_rx Andrey Konovalov <andreyknvl@google.com> - 2016-11-29 16:30 +0100
Re: [PATCH] tun: Use netif_receive_skb instead of netif_rx Eric Dumazet <eric.dumazet@gmail.com> - 2016-11-29 16:40 +0100
Re: [PATCH] tun: Use netif_receive_skb instead of netif_rx "Michael S. Tsirkin" <mst@redhat.com> - 2016-11-29 17:30 +0100
Re: [PATCH] tun: Use netif_receive_skb instead of netif_rx Andrey Konovalov <andreyknvl@google.com> - 2016-12-01 10:50 +0100
csiph-web