All of lore.kernel.org
 help / color / mirror / Atom feed
* ipv4: Constrain UFO fragment sizes to multiples of 8 bytes
@ 2016-06-06 20:24 Steven Caron
  2016-06-09  4:59 ` Cong Wang
  0 siblings, 1 reply; 3+ messages in thread
From: Steven Caron @ 2016-06-06 20:24 UTC (permalink / raw)
  To: linux-kernel; +Cc: Steven Caron

Back in 2011, Bill Sommerfeld submitted an update to prevent ip_append_data to create malformed packets:
 Commit: d9be4f7a6f5a8da3133b832eca41c3591420b1ca

Now we're finding that we need to apply the same logic to ip_append_page  to get nfs to work with udp when UFO is enabled:

diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
index 124bf0a..21ec54e 100644
--- a/net/ipv4/ip_output.c
+++ b/net/ipv4/ip_output.c
@@ -1239,7 +1239,7 @@ ssize_t   ip_append_page(struct sock *sk, struct flowi4 *fl4, struct page *page,
                if (skb->ip_summed != CHECKSUM_PARTIAL)
                        return -EOPNOTSUPP;

-               skb_shinfo(skb)->gso_size = mtu - fragheaderlen;
+               skb_shinfo(skb)->gso_size = maxfraglen - fragheaderlen;
                skb_shinfo(skb)->gso_type = SKB_GSO_UDP;
        }
        cork->length += size;

We're wondering if this is something that was missed by that initial update of if there is a reason for ip_append_page to behave differently.

We realize that there might not be a lot of people who care about running NFS over UDP, but the issue is still reproducible in the latest kernel.

I include some additional info in case anyone is interested in reproducing with their own setup.

Using two VMs connected with a bridge, one using e1000, the other virtio.
Test done using FInnix 111 (kernel 4.0) as the guest.

# On each VM export which allows NFSv3
mount -t tmpfs tmps /export
vi /etc/exports
/export *(rw,no_subtree_check,fsid=0,insecure) # insecure to allow NFSv3
/etc/init.d/rpcbind start
/etc/init.d/nfs-kernel-server start

# On each VM mount each other exported as UDP 
mkdir /mnt/import
mount 169.254.208.5:/export /mnt/import -o vers=3,udp,rsize=16394,wsize=16384,soft,nolock # soft to avoid permanent hang

# Using common MTU of 1500 on both VMs
ifconfig eth0 mtu 1500

# On the one with UFO=on (virtio):
dd if=/dev/zero count=1 bs=16384 of=/mnt/import/test
# Work as expected

# On the one with UFO=on (virtio)
dd if=/dev/zero count=1 bs=16384 of=/export/test
# On the one with UFO=off (e1000)
dd if=/mnt/import/test count=1 bs=16384 of=/dev/null
# Work as expected


# Using non-standard MTU of 1496 of both VMs
ifconfig eth0 mtu 1496

# On the one with UFO=on (virtio)
dd if=/dev/zero count=1 bs=16384 of=/mnt/import/test
# get Input/output error

# On the one with UFO=on (virtio)
dd if=/dev/zero count=1 bs=16384 of=/export/test
# On the one with UFO=off (e1000)
dd if=/mnt/import/test count=1 bs=1496 of=/dev/null
# get Input/output error

Regards,

Steven Caron 
Designer, GENWare 
500 Palladium Dr. Suite 2100| Ottawa ON, K2V 1C2  
office: +1.343.883.2345  |  steven.caron.genband.com

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: ipv4: Constrain UFO fragment sizes to multiples of 8 bytes
  2016-06-06 20:24 ipv4: Constrain UFO fragment sizes to multiples of 8 bytes Steven Caron
@ 2016-06-09  4:59 ` Cong Wang
  2016-06-09 22:39   ` Hannes Frederic Sowa
  0 siblings, 1 reply; 3+ messages in thread
From: Cong Wang @ 2016-06-09  4:59 UTC (permalink / raw)
  To: Steven Caron; +Cc: linux-kernel, Linux Kernel Network Developers

(Cc'ing netdev...)

On Mon, Jun 6, 2016 at 1:24 PM, Steven Caron <steven.caron@genband.com> wrote:
> Back in 2011, Bill Sommerfeld submitted an update to prevent ip_append_data to create malformed packets:
>  Commit: d9be4f7a6f5a8da3133b832eca41c3591420b1ca
>
> Now we're finding that we need to apply the same logic to ip_append_page  to get nfs to work with udp when UFO is enabled:
>
> diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
> index 124bf0a..21ec54e 100644
> --- a/net/ipv4/ip_output.c
> +++ b/net/ipv4/ip_output.c
> @@ -1239,7 +1239,7 @@ ssize_t   ip_append_page(struct sock *sk, struct flowi4 *fl4, struct page *page,
>                 if (skb->ip_summed != CHECKSUM_PARTIAL)
>                         return -EOPNOTSUPP;
>
> -               skb_shinfo(skb)->gso_size = mtu - fragheaderlen;
> +               skb_shinfo(skb)->gso_size = maxfraglen - fragheaderlen;
>                 skb_shinfo(skb)->gso_type = SKB_GSO_UDP;
>         }
>         cork->length += size;
>
> We're wondering if this is something that was missed by that initial update of if there is a reason for ip_append_page to behave differently.
>
> We realize that there might not be a lot of people who care about running NFS over UDP, but the issue is still reproducible in the latest kernel.
>
> I include some additional info in case anyone is interested in reproducing with their own setup.
>
> Using two VMs connected with a bridge, one using e1000, the other virtio.
> Test done using FInnix 111 (kernel 4.0) as the guest.
>
> # On each VM export which allows NFSv3
> mount -t tmpfs tmps /export
> vi /etc/exports
> /export *(rw,no_subtree_check,fsid=0,insecure) # insecure to allow NFSv3
> /etc/init.d/rpcbind start
> /etc/init.d/nfs-kernel-server start
>
> # On each VM mount each other exported as UDP
> mkdir /mnt/import
> mount 169.254.208.5:/export /mnt/import -o vers=3,udp,rsize=16394,wsize=16384,soft,nolock # soft to avoid permanent hang
>
> # Using common MTU of 1500 on both VMs
> ifconfig eth0 mtu 1500
>
> # On the one with UFO=on (virtio):
> dd if=/dev/zero count=1 bs=16384 of=/mnt/import/test
> # Work as expected
>
> # On the one with UFO=on (virtio)
> dd if=/dev/zero count=1 bs=16384 of=/export/test
> # On the one with UFO=off (e1000)
> dd if=/mnt/import/test count=1 bs=16384 of=/dev/null
> # Work as expected
>
>
> # Using non-standard MTU of 1496 of both VMs
> ifconfig eth0 mtu 1496
>
> # On the one with UFO=on (virtio)
> dd if=/dev/zero count=1 bs=16384 of=/mnt/import/test
> # get Input/output error
>
> # On the one with UFO=on (virtio)
> dd if=/dev/zero count=1 bs=16384 of=/export/test
> # On the one with UFO=off (e1000)
> dd if=/mnt/import/test count=1 bs=1496 of=/dev/null
> # get Input/output error
>
> Regards,
>
> Steven Caron
> Designer, GENWare
> 500 Palladium Dr. Suite 2100| Ottawa ON, K2V 1C2
> office: +1.343.883.2345  |  steven.caron.genband.com
>
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: ipv4: Constrain UFO fragment sizes to multiples of 8 bytes
  2016-06-09  4:59 ` Cong Wang
@ 2016-06-09 22:39   ` Hannes Frederic Sowa
  0 siblings, 0 replies; 3+ messages in thread
From: Hannes Frederic Sowa @ 2016-06-09 22:39 UTC (permalink / raw)
  To: Cong Wang, Steven Caron; +Cc: linux-kernel, Linux Kernel Network Developers

On 09.06.2016 06:59, Cong Wang wrote:
> (Cc'ing netdev...)
> 
> On Mon, Jun 6, 2016 at 1:24 PM, Steven Caron <steven.caron@genband.com> wrote:
>> Back in 2011, Bill Sommerfeld submitted an update to prevent ip_append_data to create malformed packets:
>>  Commit: d9be4f7a6f5a8da3133b832eca41c3591420b1ca
>>
>> Now we're finding that we need to apply the same logic to ip_append_page  to get nfs to work with udp when UFO is enabled:

Uhh, absolutely for the same reason as described in the referred commit.
 Can you send a patch?

Thanks,
Hannes

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-06-09 22:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-06 20:24 ipv4: Constrain UFO fragment sizes to multiples of 8 bytes Steven Caron
2016-06-09  4:59 ` Cong Wang
2016-06-09 22:39   ` Hannes Frederic Sowa

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.