]> Zhao Yanbai Git Server - minix.git/commit
Server/driver protocols: no longer allow third-party copies.
authorDavid van Moolenbroek <david@minix3.org>
Mon, 11 Apr 2011 17:35:05 +0000 (17:35 +0000)
committerDavid van Moolenbroek <david@minix3.org>
Mon, 11 Apr 2011 17:35:05 +0000 (17:35 +0000)
commitc51cd5fe915e68ab6d7ecb149508921b2fb6a3f5
treef339dec1bd2198c5455d9c1b1c19ad972580256c
parent4e86b0d53fbaf05925d0ea939939d865e512df04
Server/driver protocols: no longer allow third-party copies.

Before safecopies, the IO_ENDPT and DL_ENDPT message fields were needed
to know which actual process to copy data from/to, as that process may
not always be the caller. Now that we have full safecopy support, these
fields have become useless for that purpose: the owner of the grant is
*always* the caller. Allowing the caller to supply another endpoint is
in fact dangerous, because the callee may then end up using a grant
from a third party. One could call this a variant of the confused
deputy problem.

From now on, safecopy calls should always use the caller's endpoint as
grant owner. This fully obsoletes the DL_ENDPT field in the
inet/ethernet protocol. IO_ENDPT has other uses besides identifying the
grant owner though. This patch renames IO_ENDPT to USER_ENDPT, not only
because that is a more fitting name (it should never be used for I/O
after all), but also in order to intentionally break any old system
source code outside the base system. If this patch breaks your code,
fixing it is fairly simple:

- DL_ENDPT should be replaced with m_source;
- IO_ENDPT should be replaced with m_source when used for safecopies;
- IO_ENDPT should be replaced with USER_ENDPT for any other use, e.g.
  when setting REP_ENDPT, matching requests in CANCEL calls, getting
  DEV_SELECT flags, and retrieving of the real user process's endpoint
  in DEV_OPEN.

The changes in this patch are binary backward compatible.
52 files changed:
common/include/minix/audio_fw.h
common/include/minix/com.h
drivers/ahci/ahci.c
drivers/at_wini/at_wini.c
drivers/atl2/atl2.c
drivers/bios_wini/bios_wini.c
drivers/dec21140A/dec21140A.c
drivers/dec21140A/dec21140A.h
drivers/dp8390/dp8390.c
drivers/dp8390/dp8390.h
drivers/dpeth/dp.c
drivers/dpeth/dp.h
drivers/e1000/e1000.c
drivers/filter/driver.c
drivers/filter/main.c
drivers/fxp/fxp.c
drivers/lance/lance.c
drivers/lance/lance.h
drivers/log/liveupdate.c
drivers/log/log.c
drivers/log/log.h
drivers/memory/memory.c
drivers/orinoco/orinoco.c
drivers/printer/printer.c
drivers/rtl8139/rtl8139.c
drivers/rtl8169/rtl8169.c
drivers/tty/console.c
drivers/tty/keyboard.c
drivers/tty/pty.c
drivers/tty/rs232.c
drivers/tty/tty.c
drivers/tty/tty.h
kernel/arch/i386/do_iopenable.c
lib/libaudiodriver/audio_fw.c
lib/libdriver/driver.c
lib/libsys/sys_eniop.c
servers/ext2/device.c
servers/inet/mnx_eth.c
servers/inet/sr.c
servers/iso9660fs/device.c
servers/lwip/driver.c
servers/lwip/raw_ip.c
servers/lwip/socket.c
servers/lwip/tcp.c
servers/lwip/udp.c
servers/mfs/device.c
servers/pfs/dev_uds.c
servers/pfs/uds.c
servers/vfs/device.c
servers/vfs/filedes.c
servers/vfs/path.c
servers/vfs/pipe.c