From: Arjun Roy
> Sent: 03 December 2020 23:25
...
> > > You also have to allow for old (working) applications being recompiled
> > > with the new headers.
> > > So you cannot rely on the fields being zero even if you are passed
> > > the size of the structure.
> > >
> >
> > I think this should already be taken care of in the current code; the
> > full-sized struct with new fields is being zero-initialized, then
> > we're getting the user-provided optlen, then copying from userspace
> > only that much data. So the newer fields would be zero in that case,
> > so this should handle the case of new kernels but old applications.
> > Does this address the concern, or am I misunderstanding?
> >
> 
> Actually, on closer read, perhaps the following is what you have in
> mind for the old application?
> 
> struct zerocopy_args args;
> args.address = ...;
> args.length = ...;
> args.recv_skip_hint = ...;
> args.inq = ...;
> args.err = ...;
> getsockopt(fd, IPPROTO_TCP, TCP_ZEROCOPY_RECEIVE, &args, sizeof(args));
> // sizeof(args) is now bigger when recompiled with new headers, but we
> did not explicitly set the new fields to 0, therefore issues

That's the one...

        David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, 
UK
Registration No: 1397386 (Wales)

Reply via email to