summaryrefslogtreecommitdiff
path: root/sys/src/libc
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2016-09-07 21:14:23 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2016-09-07 21:14:23 +0200
commitbfd8098b8de4c9dfbd5def087b92b09dfc97b41c (patch)
tree9e2dc356636c6e624e8678c02fc6fdae624ad9e1 /sys/src/libc
parent76daf9f863868356f9c59eadc93ed4d2454dc72d (diff)
devcap: timeout capabilities after a minute, fix memory leak, paranoia
the manpage states that capabilities time out after a minute, so we add ticks field into the Caphash struct and record the time when the capability was inserted. freeing old capabilities is handled in trimcaps(), which makes room for one extra cap and frees timed out ones. we also limit the capuse write size to less than 1024 bytes to prevent denial of service as we have to copy the user buffer. (memory exhaustion). we have to check the from user *before* attempting to remove the capability! the wrong user shouldnt be able to change any state. this fixes the memory leak of the caphash. do the hash comparsion with tsmemcmp(), avoiding timing side channels. allocate the capabilities in secret memory pool to prevent debugger access.
Diffstat (limited to 'sys/src/libc')
0 files changed, 0 insertions, 0 deletions