freebsd-dev/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 Update kernel inclusions of capability.h to use capsicum.h instead; some 2014-03-16 10:55:57 +00:00
freebsd32_ioctl.c Overhaul CAM SG driver IOCTL interfaces. 2014-06-02 19:53:53 +00:00
freebsd32_ioctl.h Overhaul CAM SG driver IOCTL interfaces. 2014-06-02 19:53:53 +00:00
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 Move the PAIR32TO64() macro and the RETVAL_HI/RETVAL_LO defines to a 2013-08-18 13:34:11 +00:00
freebsd32_proto.h Regen. 2016-03-09 19:06:46 +00:00
freebsd32_signal.h Move the convert_sigevent32() utility function into freebsd32_misc.c 2013-07-21 19:33:48 +00:00
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 Avoid dynamic syscall overhead for statically compiled modules. 2014-10-26 19:42:44 +00:00
freebsd32.h Move the 32-bit compatible procfs types from freebsd32.h to <sys/procfs.h> 2015-04-08 16:30:45 +00:00
Makefile add DTrace systrace support for linux32 and freebsd32 on amd64 syscalls 2011-03-12 08:51:43 +00:00
syscalls.conf add DTrace systrace support for linux32 and freebsd32 on amd64 syscalls 2011-03-12 08:51:43 +00:00
syscalls.master Simplify AIO initialization now that it is standard. 2016-03-09 19:05:11 +00:00