# Re: \[PATCH RFC v2 00/12\] socket sendmsg MSG\_ZEROCOPY

- List: linux-api
- 3 messages, 3 authors
- Page: https://ratatoskr.run/linux-api/2017/02/11046285/t

## Re: \[PATCH RFC v2 00/12\] socket sendmsg MSG\_ZEROCOPY

- From: Eric Dumazet \<hidden\>
- Date: 2017-02-28 22:40:43 
- Message: https://ratatoskr.run/linux-api/2017/02/11046285.md

```text
On Tue, 2017-02-28 at 14:25 -0800, Andy Lutomirski wrote:
> On Tue, Feb 28, 2017 at 1:47 PM, Eric Dumazet [ref] wrote:
> > On Tue, 2017-02-28 at 13:09 -0800, Andy Lutomirski wrote:
> >
> >> Does this mean that a user program that does a zerocopy send can cause
> >> a retransmitted segment to contain different data than the original
> >> segment?  If so, is that okay?
> >
> > Same remark applies to sendfile() already
> 
> True.
> 
> >, or other zero copy modes
> > (vmsplice() + splice() )
> 
> I hate vmsplice().  I thought I remembered it being essentially
> disabled at some point due to security problems.

Right, zero copy is hard ;)

vmsplice() is not disabled in current kernels, unless I missed
something.
```

## Re: \[PATCH RFC v2 00/12\] socket sendmsg MSG\_ZEROCOPY

- From: Andy Lutomirski \<luto@amacapital.net\>
- Date: 2017-02-28 23:18:19 
- Message: https://ratatoskr.run/linux-api/2017/02/11046280.md

```text
On Tue, Feb 28, 2017 at 2:40 PM, Eric Dumazet [ref] wrote:
> On Tue, 2017-02-28 at 14:25 -0800, Andy Lutomirski wrote:
>> On Tue, Feb 28, 2017 at 1:47 PM, Eric Dumazet [ref] wrote:
>> > On Tue, 2017-02-28 at 13:09 -0800, Andy Lutomirski wrote:
>> >
>> >> Does this mean that a user program that does a zerocopy send can cause
>> >> a retransmitted segment to contain different data than the original
>> >> segment?  If so, is that okay?
>> >
>> > Same remark applies to sendfile() already
>>
>> True.
>>
>> >, or other zero copy modes
>> > (vmsplice() + splice() )
>>
>> I hate vmsplice().  I thought I remembered it being essentially
>> disabled at some point due to security problems.
>
> Right, zero copy is hard ;)
>
> vmsplice() is not disabled in current kernels, unless I missed
> something.
>

I think you're right.  That being said, from the man page:

The user pages are a gift to the kernel.  The application  may  not
modify this memory ever, otherwise the page cache and on-disk data may
differ.

This is just not okay IMO.
```

## Re: \[PATCH RFC v2 00/12\] socket sendmsg MSG\_ZEROCOPY

- From: Eric Dumazet \<hidden\>
- Date: 2017-02-28 23:22:19 
- Message: https://ratatoskr.run/linux-api/2017/02/11046281.md

```text
On Tue, 2017-02-28 at 14:52 -0800, Andy Lutomirski wrote:

> The user pages are a gift to the kernel.  The application  may  not
> modify this memory ever, otherwise the page cache and on-disk data may
> differ.
> 
> This is just not okay IMO.

TCP works just fine in this case.

TX checksum will be computed by the NIC after/while data is copied.

If really the application changes the data, that will not cause any
problems, other than user side consistency.

This is why we require a copy (for all buffers that came from zero-copy)
if network stack hits a device that can not offload TX checksum.

Even pwrite() does not guarantee consistency if multiple threads are
using it on overlapping regions.
```
