freebsd-skq/sys/compat/freebsd32
Gleb Smirnoff 9c64cfe56c The sendfile(2) allows to send extra data from userspace before the file
data (headers).  Historically the size of the headers was not checked
against the socket buffer space.  Application could easily overcommit the
socket buffer space.

With the new sendfile (r293439) the problem remained, but a KASSERT was
inserted that checked that amount of data written to the socket matches
its space.  In case when size of headers is bigger that socket space,
KASSERT fires.  Without INVARIANTS the new sendfile won't panic, but
would report incorrect amount of bytes sent.

o With this change, the headers copyin is moved down into the cycle, after
  the sbspace() check.  The uio size is trimmed by socket space there,
  which fixes the overcommit problem and its consequences.
o The compatibility handling for FreeBSD 4 sendfile headers API is pushed
  up the stack to syscall wrappers.  This required a copy and paste of the
  code, but in turn this allowed to remove extra stack carried parameter
  from fo_sendfile_t, and embrace entire compat code into #ifdef.  If in
  future we got more fo_sendfile_t function, the copy and paste level would
  even reduce.

Reviewed by:	emax, gallatin, Maxim Dounin <mdounin mdounin.ru>
Tested by:	Vitalij Satanivskij <satan ukr.net>
Sponsored by:	Netflix
2016-03-29 19:57:11 +00:00
..
freebsd32_capability.c
freebsd32_ioctl.c
freebsd32_ioctl.h
freebsd32_ipc.h
freebsd32_misc.c The sendfile(2) allows to send extra data from userspace before the file 2016-03-29 19:57:11 +00:00
freebsd32_misc.h
freebsd32_proto.h Regen. 2016-03-09 19:06:46 +00:00
freebsd32_signal.h
freebsd32_syscall.h Regen. 2016-03-12 22:55:07 +00:00
freebsd32_syscalls.c Regen. 2016-03-09 19:06:46 +00:00
freebsd32_sysent.c Regen. 2016-03-09 19:06:46 +00:00
freebsd32_systrace_args.c Regen. 2016-03-09 19:06:46 +00:00
freebsd32_util.h
freebsd32.h
Makefile
syscalls.conf
syscalls.master