plan9fox/sys
cinap_lenrek e9fddbaad8 kernel: fix segattach() rounding of va+len (thanks kenji arisawa)
from segattach(2):

          Va and len specify the position of the segment in the
          process's address space.  Va is rounded down to the nearest
          page boundary and va+len is rounded up.  The system does not
          permit segments to overlap.  If va is zero, the system will
          choose a suitable address.

just rounding up len isnt enougth. we have to round up va+len
instead of just len so that the span [va, va+len) is covered
even if va is not page aligned.

kenjis example:

	print("%p\n",ap);	// 206cb0
	ap = segattach(0, "shared", ap, 1024);
	print("%p\n",ap);	// 206000

term% cat /proc/612768/segment
Stack     defff000 dffff000    1
Text   R      1000     6000    1
Data          6000     7000    1
Bss           7000     7000    1
Shared      206000   207000    1
term%

note that 0x206cb0 + 0x400 > 0x20700.
2014-09-14 16:04:22 +02:00
..
doc /sys/doc: permissions for cleanps, mkdirlist, mkfilelist 2012-10-20 19:09:54 +02:00
games/lib fortunes: $75K Prosthetic Arm Is Bricked When Paired iPod Is Stolen 2014-08-27 01:13:11 -04:00
include libsec: add diffie-hellman functions 2014-09-14 02:29:18 +02:00
lib /sys/lib/dist/ndb/common: add auth=fs.stanleylieber.com authdom=inri 2014-08-28 20:46:56 -04:00
man kernel: make noswap flag exclude processes from killbig() if not eve, reset noswap flag on exec 2014-08-17 00:50:20 +02:00
src kernel: fix segattach() rounding of va+len (thanks kenji arisawa) 2014-09-14 16:04:22 +02:00