]> git.lizzy.rs Git - plan9front.git/log
plan9front.git
6 years ago/lib/bullshit: +converged
cinap_lenrek [Fri, 29 Dec 2017 00:58:47 +0000 (01:58 +0100)]
/lib/bullshit: +converged

6 years agodevtls, devssl: avoid ~0UL comparsion (from drawterm)
cinap_lenrek [Thu, 28 Dec 2017 18:13:53 +0000 (19:13 +0100)]
devtls, devssl: avoid ~0UL comparsion (from drawterm)

6 years agodevmnt: use u32int for tagmask, simplify alloctag()
cinap_lenrek [Thu, 28 Dec 2017 17:25:15 +0000 (18:25 +0100)]
devmnt: use u32int for tagmask, simplify alloctag()

6 years agowifi: don't implicitely update lastseen timestamp on nodelookup()
cinap_lenrek [Thu, 28 Dec 2017 03:34:03 +0000 (04:34 +0100)]
wifi: don't implicitely update lastseen timestamp on nodelookup()

in case we continue to send traffic (like ping) with the ap gone,
the sending would keep updating bss->lastseen which prevents the
timeout to happen to switch bss.

6 years agoetheriwl, etherwpi: limit transmit queue buffer bloat to 48k (at 22Mbit ≅ 20ms)
cinap_lenrek [Thu, 28 Dec 2017 00:24:38 +0000 (01:24 +0100)]
etheriwl, etherwpi: limit transmit queue buffer bloat to 48k (at 22Mbit ≅ 20ms)

6 years agowifi: don't assume Wifi.rates[] is sorted, return net data rate for mbps (50% theoret...
cinap_lenrek [Thu, 28 Dec 2017 00:19:14 +0000 (01:19 +0100)]
wifi: don't assume Wifi.rates[] is sorted, return net data rate for mbps (50% theoretical)

6 years agoarch(3): document #P/realmodemem file
cinap_lenrek [Sat, 23 Dec 2017 03:45:22 +0000 (04:45 +0100)]
arch(3): document #P/realmodemem file

6 years agodevvga: removing #v/vgabios, use /dev/realmodemem instead
cinap_lenrek [Sat, 23 Dec 2017 03:26:50 +0000 (04:26 +0100)]
devvga: removing #v/vgabios, use /dev/realmodemem instead

6 years agokernel: convert textmode cga screen contents to kmesg only once
cinap_lenrek [Sat, 23 Dec 2017 02:56:12 +0000 (03:56 +0100)]
kernel: convert textmode cga screen contents to kmesg only once

screeninit() might be called again by devvga when switching
to textmode, so only convert the text framebuffer to kmesg
the first time.

6 years agoauth(8): auth/debug tests both dp9ik and p9sk1
cinap_lenrek [Sat, 23 Dec 2017 02:21:01 +0000 (03:21 +0100)]
auth(8): auth/debug tests both dp9ik and p9sk1

6 years agokernel: remove Ipifc.mbps, unused.
cinap_lenrek [Sat, 23 Dec 2017 01:58:47 +0000 (02:58 +0100)]
kernel: remove Ipifc.mbps, unused.

6 years ago/lib/bullshit: blockchain
cinap_lenrek [Fri, 22 Dec 2017 17:26:54 +0000 (18:26 +0100)]
/lib/bullshit: blockchain

6 years agoip/tinc: handle and set ethertype for ipv6
cinap_lenrek [Thu, 21 Dec 2017 03:11:02 +0000 (04:11 +0100)]
ip/tinc: handle and set ethertype for ipv6

6 years agoupas/fs: more bugs
cinap_lenrek [Tue, 19 Dec 2017 19:57:24 +0000 (20:57 +0100)]
upas/fs: more bugs

6 years agoupas/fs: fix precedence bugs, compare digest pointer to nil
cinap_lenrek [Tue, 19 Dec 2017 19:44:15 +0000 (20:44 +0100)]
upas/fs: fix precedence bugs, compare digest pointer to nil

6 years agoether8169: add Macv45 for RTL8111HN, rename Macv45 -> Macv42 (thanks qeed, sam-d)
cinap_lenrek [Mon, 18 Dec 2017 23:03:54 +0000 (00:03 +0100)]
ether8169: add Macv45 for RTL8111HN, rename Macv45 -> Macv42 (thanks qeed, sam-d)

6 years agonusb/ether: dont forward loopback packets on bridges, remove read nonblocking hack
cinap_lenrek [Mon, 18 Dec 2017 19:50:25 +0000 (20:50 +0100)]
nusb/ether: dont forward loopback packets on bridges, remove read nonblocking hack

6 years agodevether: dont forward loopback packets on bridges
cinap_lenrek [Mon, 18 Dec 2017 19:47:55 +0000 (20:47 +0100)]
devether: dont forward loopback packets on bridges

6 years agodevbridge: disable write blocking on ethernets
cinap_lenrek [Mon, 18 Dec 2017 19:44:53 +0000 (20:44 +0100)]
devbridge: disable write blocking on ethernets

6 years agobridge(3): clarify manpage, this is a layer2 bridge
cinap_lenrek [Sun, 17 Dec 2017 19:51:41 +0000 (20:51 +0100)]
bridge(3): clarify manpage, this is a layer2 bridge

yes, it peeks into IP packets to handle fragmentation when sending
onto tunnel ports and does mss clamping. but it can carry arbitrary
ethernet packets just fine (between ethernets).

6 years agopc, pc64: add devbridge to kernel configuration
cinap_lenrek [Sun, 17 Dec 2017 19:33:39 +0000 (20:33 +0100)]
pc, pc64: add devbridge to kernel configuration

6 years agodevbridge: fix mss clamping
cinap_lenrek [Sun, 17 Dec 2017 19:30:24 +0000 (20:30 +0100)]
devbridge: fix mss clamping

- use protocol constants from ip/ip.h and ip/ipv6.h
- support mss clamping for ipv6
- fix padding bug on 64 bit machines (can't use sizeof(Tcphdr))

6 years agoip/tinc: handle single byte noop and end-of-option-list tcp options in clampmss()
cinap_lenrek [Sun, 17 Dec 2017 19:20:17 +0000 (20:20 +0100)]
ip/tinc: handle single byte noop and end-of-option-list tcp options in clampmss()

6 years agowifi: use protocol constants from ip/ip.h and ip/ipv6.h for dmatproxy()
cinap_lenrek [Sun, 17 Dec 2017 16:17:26 +0000 (17:17 +0100)]
wifi: use protocol constants from ip/ip.h and ip/ipv6.h for dmatproxy()

6 years agowifi: matt damon wifi bridging support
cinap_lenrek [Sat, 16 Dec 2017 20:43:47 +0000 (21:43 +0100)]
wifi: matt damon wifi bridging support

6 years agoether: allow spoofing of source mac address for bridges; used by vmx
cinap_lenrek [Fri, 15 Dec 2017 21:22:29 +0000 (22:22 +0100)]
ether: allow spoofing of source mac address for bridges; used by vmx

to implement layer 2 bridges in userspace, we disable to auto filling
of the source mac address when bridge mode is enabled on the
connection.

6 years agovmx(1): fix virtio network bloomfilter
aiju [Wed, 13 Dec 2017 22:20:12 +0000 (22:20 +0000)]
vmx(1): fix virtio network bloomfilter

6 years ago/sys/man/*/*: fix perms (sorry)
stanley lieber [Tue, 12 Dec 2017 00:58:06 +0000 (19:58 -0500)]
/sys/man/*/*: fix perms (sorry)

6 years agofortunes: Subject: [oss-security] nvi denial of service
stanley lieber [Tue, 12 Dec 2017 00:36:54 +0000 (19:36 -0500)]
fortunes: Subject: [oss-security] nvi denial of service

6 years ago/sys/lib/rootstub
stanley lieber [Tue, 12 Dec 2017 00:34:15 +0000 (19:34 -0500)]
/sys/lib/rootstub

6 years agodevether: remove duplicated parseether() implementation (pull from libip)
cinap_lenrek [Sat, 9 Dec 2017 21:07:32 +0000 (22:07 +0100)]
devether: remove duplicated parseether() implementation (pull from libip)

6 years agolibflate: force non-empty huffman table in mkzprecode() for deflate
cinap_lenrek [Sat, 9 Dec 2017 17:20:29 +0000 (18:20 +0100)]
libflate: force non-empty huffman table in mkzprecode() for deflate

busybox gunzip fails on empty (offset) huffman tables,
so force one entry.

gzip states in a comment:

The pkzip format requires that at least one distance code exists,
and that at least one bit should be sent even if there is only one
possible code.

6 years agodisk/edisk: allow printing and readonly inspection of hybrid MBR/GPT disks (thanks...
cinap_lenrek [Tue, 5 Dec 2017 22:44:43 +0000 (23:44 +0100)]
disk/edisk: allow printing and readonly inspection of hybrid MBR/GPT disks (thanks aiju)

dumping hybrid MBR/GPT disks is fine, which can sometimes be found
on USB sticks. but prohibit editing.

however, always barf on disks with dos partitions and missing
protecive MBR partition entry.

6 years agorealemu: fix precedence bug in argconv() format routine (thanks dan cross)
cinap_lenrek [Mon, 4 Dec 2017 04:14:31 +0000 (05:14 +0100)]
realemu: fix precedence bug in argconv() format routine (thanks dan cross)

6 years agorealemu: fix pit bcd mode
cinap_lenrek [Mon, 4 Dec 2017 04:09:13 +0000 (05:09 +0100)]
realemu: fix pit bcd mode

6 years agoplan9.ini(8): 9boot(8) is not a DOS program, remove outdated BUGS section
cinap_lenrek [Sun, 3 Dec 2017 18:23:55 +0000 (19:23 +0100)]
plan9.ini(8): 9boot(8) is not a DOS program, remove outdated BUGS section

6 years agodevvga: properly handle physical screen size and panning
cinap_lenrek [Sun, 3 Dec 2017 17:54:25 +0000 (18:54 +0100)]
devvga: properly handle physical screen size and panning

- remove arbitrary limits on screen size, just check with badrect()
- post resize when physgscreenr is changed (actualsize ctl command)
- preserve physgscreenr across softscreen flag toggle
- honor panning flag on resize
- fix nil dereference in panning ctl command when scr->gscreen == nil
- use clipr when drawing vga plan 9 console (vgascreenwin())

6 years agoscreenlock: put position check back in grabmouse (thanks deuteron)
cinap_lenrek [Sun, 3 Dec 2017 15:34:35 +0000 (16:34 +0100)]
screenlock: put position check back in grabmouse (thanks deuteron)

the check was there because changing te position causes another
mouse event to get posted resulting in grabmouse spinning.

6 years agoscreenlock: have keyboard activity reset blank timeout
cinap_lenrek [Sun, 3 Dec 2017 05:41:41 +0000 (06:41 +0100)]
screenlock: have keyboard activity reset blank timeout

6 years agoscreenlock: avoid continuous blanking, draw fullscreen over border
cinap_lenrek [Sun, 3 Dec 2017 05:27:18 +0000 (06:27 +0100)]
screenlock: avoid continuous blanking, draw fullscreen over border

6 years agoscreenlock: some improvements
cinap_lenrek [Sun, 3 Dec 2017 04:47:35 +0000 (05:47 +0100)]
screenlock: some improvements

check for "needkey " error string from auth_userpasswd() in case no
key is pesent in factotum. this used to be a common trap with stand
alone machines that do not have an authentication server setup.

indicate authentication in progress by drawing a white border.

delete unneccesary cruft and simplify the code.

6 years agolibauth: replace proto=p9cr with new proto=dp9ik/p9sk1 role=login for auth_userpasswd()
cinap_lenrek [Sun, 3 Dec 2017 04:14:33 +0000 (05:14 +0100)]
libauth: replace proto=p9cr with new proto=dp9ik/p9sk1 role=login for auth_userpasswd()

6 years agoauth/factotum: add role=login protocol variant to dp9ik/p9sk1
cinap_lenrek [Sun, 3 Dec 2017 04:10:04 +0000 (05:10 +0100)]
auth/factotum: add role=login protocol variant to dp9ik/p9sk1

the role=login protocol is ment to replace proto=p9cr in
auth_userpasswd() from libauth to authenticate a user
given a username and a password. in contrast to p9cr, it
does not require an authentication server when user is the
hostowner and its key is present in factotum.

6 years agoauth/login: add missing quotefmtinstall(), quote dom attribute
cinap_lenrek [Sun, 3 Dec 2017 03:54:34 +0000 (04:54 +0100)]
auth/login: add missing quotefmtinstall(), quote dom attribute

6 years agoerrstr(2): add /sys/src/libc/9sys/rerrstr.c to SOURCE section
cinap_lenrek [Sun, 3 Dec 2017 01:22:48 +0000 (02:22 +0100)]
errstr(2): add /sys/src/libc/9sys/rerrstr.c to SOURCE section

6 years agoscreenlock: blank screen using /dev/mousectl (thanks sl)
cinap_lenrek [Fri, 1 Dec 2017 22:13:01 +0000 (23:13 +0100)]
screenlock: blank screen using /dev/mousectl (thanks sl)

6 years agolibsec: make includes consistent for sha2block*.c
cinap_lenrek [Thu, 30 Nov 2017 20:50:52 +0000 (21:50 +0100)]
libsec: make includes consistent for sha2block*.c

6 years agolibsec: unroll portable sha1block function
cinap_lenrek [Thu, 30 Nov 2017 20:30:03 +0000 (21:30 +0100)]
libsec: unroll portable sha1block function

just 6-10% slower than most assembly versions.
20% faster on zynq.

6 years agolibsec: unroll portable sha2block functions
cinap_lenrek [Thu, 30 Nov 2017 01:16:27 +0000 (02:16 +0100)]
libsec: unroll portable sha2block functions

- unroll the loops
- rotate the taps on each step, avoiding copies
- simplify boolean formulas for Ch() and Maj()

this yields arround 40% throughput increase on 32/64bit
archs for sha2_256 and sha2_512 on amd64.

6 years agogames/blit: update screen when display address changes (thanks aap)
aiju [Mon, 27 Nov 2017 20:34:48 +0000 (20:34 +0000)]
games/blit: update screen when display address changes (thanks aap)

6 years agovmx(1): fix openbsd 6.2 amd64 !entrystate bug
aiju [Mon, 27 Nov 2017 09:30:15 +0000 (09:30 +0000)]
vmx(1): fix openbsd 6.2 amd64 !entrystate bug

6 years agolibsec: optimize aesCBCencrypt()/aesCBCdecrypt()
cinap_lenrek [Mon, 27 Nov 2017 00:31:19 +0000 (01:31 +0100)]
libsec: optimize aesCBCencrypt()/aesCBCdecrypt()

- get rid of the temporary copies and memmoves()
- when the data pointer is aligned, do xor and copying inline

speedup for auth/aescbc encryption depends on arch:

- zynq 7% (arm)
- t23 13% (386)
- x230 20% (amd64, aes-ni)
- apu2 25% (amd64, aes-ni)

6 years agocga: capture cga console contents on boot, make sure cgapos is in range
cinap_lenrek [Sun, 26 Nov 2017 16:11:01 +0000 (17:11 +0100)]
cga: capture cga console contents on boot, make sure cgapos is in range

to capture bios and bootloader messages, convert the contents
on the screen to kmesg.

on machines without legacy cga, the cga registers read out as
0xFF, resuting in out of bounds cgapos. so set cgapos to 0 in
that case.

6 years agodevvga: re-render text from kmesg after resize
cinap_lenrek [Sun, 26 Nov 2017 03:49:30 +0000 (04:49 +0100)]
devvga: re-render text from kmesg after resize

6 years agospin: Update to most recent version. (thanks Ori_B)
cinap_lenrek [Wed, 22 Nov 2017 20:09:31 +0000 (21:09 +0100)]
spin: Update to most recent version. (thanks Ori_B)

from Ori_B:

There were a small number of changes needed from the tarball
on spinroot.org:

  - The mkfile needed to be updated
  - Memory.h needed to not be included
  - It needed to invoke /bin/cpp instead of gcc -E
  - It depended on `yychar`, which our yacc doesn't
    provide.

I'm still figuring out how to use spin, but it seems to do
the right thing when testing a few of the examples:

% cd $home/src/Spin/Examples/
% spin -a peterson.pml
% pcc pan.c -D_POSIX_SOURCE
% ./6.out

(Spin Version 6.4.7 -- 19 August 2017)
+ Partial Order Reduction

Full statespace search for:
never claim          - (none specified)
assertion violations +
acceptance   cycles  - (not selected)
invalid end states +

State-vector 32 byte, depth reached 24, errors: 0
40 states, stored
27 states, matched
67 transitions (= stored+matched)
0 atomic steps
hash conflicts:         0 (resolved)

Stats on memory usage (in Megabytes):
0.002 equivalent memory usage for states (stored*(State-vector + overhead))
0.292 actual memory usage for states
128.000 memory used for hash table (-w24)
0.534 memory used for DFS stack (-m10000)
128.730 total actual memory usage

unreached in proctype user
/tmp/Spin/Examples/peterson.pml:20, state 10, "-end-"
(1 of 10 states)

pan: elapsed time 1.25 seconds
pan: rate        32 states/second

6 years agolibsec: write optimized _chachablock() function for amd64 / sse2
cinap_lenrek [Sun, 19 Nov 2017 23:10:35 +0000 (00:10 +0100)]
libsec: write optimized _chachablock() function for amd64 / sse2

doing 4 quarterround's in parallel using 128-bit
vector registers. for second round shuffle the columns and
then shuffle back.

code is rather obvious. only trick here is for the first
quaterround PSHUFLW/PSHUFHW is used to swap the halfwords
for the <<<16 rotation.

6 years agolibmach: fix format for 8db sse shift ops
cinap_lenrek [Sun, 19 Nov 2017 20:11:41 +0000 (21:11 +0100)]
libmach: fix format for 8db sse shift ops

6 years ago6l: fix typo in optab table for APSLLQ (0x7e -> 0x73)
cinap_lenrek [Sun, 19 Nov 2017 20:10:36 +0000 (21:10 +0100)]
6l: fix typo in optab table for APSLLQ (0x7e -> 0x73)

6 years agokernel: make isaconfig() consistent, not inplace tokenizing the conf string
cinap_lenrek [Sun, 19 Nov 2017 16:17:04 +0000 (17:17 +0100)]
kernel: make isaconfig() consistent, not inplace tokenizing the conf string

6 years agoinst/mounthjfs: use /dev/swap instead of #c/swap to determine memory size (thanks...
cinap_lenrek [Sun, 19 Nov 2017 14:42:15 +0000 (15:42 +0100)]
inst/mounthjfs: use /dev/swap instead of #c/swap to determine memory size (thanks aap)

6 years ago6in4: add -m mtu option to specify outer MTU
cinap_lenrek [Sat, 18 Nov 2017 15:03:44 +0000 (16:03 +0100)]
6in4: add -m mtu option to specify outer MTU

instead of hardcoding the tunnel interface MTU to 1280,
we calculate the tunnel MTU from the outside MTU, which
can now be specified with the -m mtu option. The deault
outside MTU is 1500 - 8 (PPPoE).

6 years ago9pc64: handle special case in fpurestore() for procexec()/procsetup()
cinap_lenrek [Thu, 16 Nov 2017 22:15:08 +0000 (23:15 +0100)]
9pc64: handle special case in fpurestore() for procexec()/procsetup()

when a process does an exec, it calls procsetup() which
unconditionally sets the sets the TS flag and fpstate=FPinit
and fpurestore() should not revert the fpstate.

6 years agoaudio/flacdec: add eof handler avoiding endless spinning on broken files (thanks...
cinap_lenrek [Thu, 16 Nov 2017 13:15:00 +0000 (14:15 +0100)]
audio/flacdec: add eof handler avoiding endless spinning on broken files (thanks deuteron)

6 years agopc64: fix mistake fpurestore() mistake
cinap_lenrek [Mon, 13 Nov 2017 23:16:21 +0000 (00:16 +0100)]
pc64: fix mistake fpurestore() mistake

cannot just reenable the fpu in FPactive case as we might have
been procsaved() an rescheduled on another cpu. what was i thinking...
thanks qu7uux for reproducing the problem.

6 years agoigfx: allocate backing memory for framebuffer and hw cursor when not done by bios...
cinap_lenrek [Sun, 12 Nov 2017 23:48:46 +0000 (00:48 +0100)]
igfx: allocate backing memory for framebuffer and hw cursor when not done by bios (from qu7uux)

new approach to graphics memory management:

the kernel driver never really cared about the size of stolen memory
directly. that was only to figure out the maximum allocation
to place the hardware cursor image somewhere at the end of the
allocation done by bios.

qu7uux's gm965 bios however wont steal enougth memory for his
native resolution so we have todo it manually.

the userspace igfx driver will figure out how much the bios
allocated by looking at the gtt only. then extend the memory by
creating a "fixed" physical segment.

the kernel driver allocates the memory for the cursor image
from normal kernel memory, and just maps it into the gtt at the
end of the virtual kernel framebuffer aperture.

thanks to qu7uux for the patch.

6 years agolibsec: AES-NI support for amd64
cinap_lenrek [Sun, 12 Nov 2017 22:15:15 +0000 (23:15 +0100)]
libsec: AES-NI support for amd64

Add assembler versions for aes_encrypt/aes_decrypt and the key
setup using AES-NI instruction set. This makes aes_encrypt and
aes_decrypt into function pointers which get initialized by
the first call to setupAESstate().

Note that the expanded round key words are *NOT* stored in big
endian order as with the portable implementation. For that reason
the AESstate.ekey and AESstate.dkey fields have been changed to
void* forcing an error when someone is accessing the roundkey
words. One offender was aesXCBmac, which doesnt appear to be
used and the code looks horrible so it has been deleted.

The AES-NI implementation is for amd64 only as it requires the
kernel to save/restore the FPU state across syscalls and
pagefaults.

6 years agopc64: allow using the FPU in syscall and pagefault handlers
cinap_lenrek [Sun, 12 Nov 2017 21:55:54 +0000 (22:55 +0100)]
pc64: allow using the FPU in syscall and pagefault handlers

The aim is to take advantage of SSE instructions such as AES-NI
in the kernel by lazily saving and restoring FPU state across
system calls and pagefaults. (everything can can do I/O)

This is accomplished by the functions fpusave() and fpurestore().

fpusave() remembers the current state and disables the FPU if it
was active by setting the TS flag. In case the FPU gets used,
the current state gets saved and a new PFPU.fpslot is allocated
by mathemu().

fpurestore() restores the previous FPU state, reenabling the FPU
if fpusave() disabled it.

In the most common case, when userspace is not using the FPU,
then fpusave()/fpurestore() just toggle the FPpush bit in
up->fpstate.

When the FPU was active, but we do not use the FPU, then nothing
needs to be saved or restored. We just switched the TS flag on
and off agaian.

Note, this is done for the amd64 kernel only.

6 years agopc64: set ts flag before schedinit()
cinap_lenrek [Tue, 7 Nov 2017 23:34:08 +0000 (00:34 +0100)]
pc64: set ts flag before schedinit()

6 years agomerge
cinap_lenrek [Sat, 4 Nov 2017 19:11:20 +0000 (20:11 +0100)]
merge

6 years agokernel: introduce per process FPU struct (PFPU) for more flexible machine specific...
cinap_lenrek [Sat, 4 Nov 2017 19:08:22 +0000 (20:08 +0100)]
kernel: introduce per process FPU struct (PFPU) for more flexible machine specific fpu handling

introducing the PFPU structue which allows the machine specific
code some flexibility on how to handle the FPU process state.

for example, in the pc and pc64 kernel, the FPsave structure is
arround 512 bytes. with avx512, it could grow up to 2K. instead
of embedding that into the Proc strucutre, it is more effective
to allocate it on first use of the fpu, as most processes do not
use simd or floating point in the first place. also, the FPsave
structure has special 16 byte alignment constraint, which further
favours dynamic allocation.

this gets rid of the memmoves in pc/pc64 kernels for the aligment.

there is also devproc, which is now checking if the fpsave area
is actually valid before reading it, avoiding debuggers to see
garbage data.

the Notsave structure is gone now, as it was not used on any
machine.

6 years ago/lib/rsc: It only works when we're in the process of preparing a release.
stanley lieber [Thu, 2 Nov 2017 23:55:04 +0000 (19:55 -0400)]
/lib/rsc: It only works when we're in the process of preparing a release.

6 years agotinc(8): mash -> mesh
cinap_lenrek [Thu, 2 Nov 2017 08:05:03 +0000 (09:05 +0100)]
tinc(8): mash -> mesh

6 years agotinc(8): more spelling spam
cinap_lenrek [Wed, 1 Nov 2017 17:40:17 +0000 (18:40 +0100)]
tinc(8): more spelling spam

6 years agotinc(8): spelling, thanks jpm
cinap_lenrek [Wed, 1 Nov 2017 17:34:58 +0000 (18:34 +0100)]
tinc(8): spelling, thanks jpm

6 years agotinc(8): outout -> output
cinap_lenrek [Tue, 31 Oct 2017 21:58:55 +0000 (22:58 +0100)]
tinc(8): outout -> output

6 years agotinc: implement experimental mash peer to peer VPN from http://www.tinc-vpn.org/
cinap_lenrek [Tue, 31 Oct 2017 21:44:25 +0000 (22:44 +0100)]
tinc: implement experimental mash peer to peer VPN from http://www.tinc-vpn.org/

6 years agoaes(2): document aes_xts_encrypt() and aes_xts_decrypt() functions
cinap_lenrek [Mon, 30 Oct 2017 02:04:05 +0000 (03:04 +0100)]
aes(2): document aes_xts_encrypt() and aes_xts_decrypt() functions

6 years agokernel: pc/pc, fix comment line
cinap_lenrek [Mon, 30 Oct 2017 01:08:05 +0000 (02:08 +0100)]
kernel: pc/pc, fix comment line

6 years agoswap(3): document permissions and encryption behaviour, reference to memory(8)
cinap_lenrek [Mon, 30 Oct 2017 00:55:58 +0000 (01:55 +0100)]
swap(3): document permissions and encryption behaviour, reference to memory(8)

6 years agodevcons: remove obsolete comment
cinap_lenrek [Mon, 30 Oct 2017 00:24:18 +0000 (01:24 +0100)]
devcons: remove obsolete comment

6 years agokernel: track more header dependencies in port/portmkfile
cinap_lenrek [Mon, 30 Oct 2017 00:23:48 +0000 (01:23 +0100)]
kernel: track more header dependencies in port/portmkfile

6 years agodevswap: fix mistake
cinap_lenrek [Sun, 29 Oct 2017 22:24:42 +0000 (23:24 +0100)]
devswap: fix mistake

6 years agokernel: introduce devswap #¶ to serve /dev/swap and handle swapfile encryption
cinap_lenrek [Sun, 29 Oct 2017 22:09:54 +0000 (23:09 +0100)]
kernel: introduce devswap #¶ to serve /dev/swap and handle swapfile encryption

6 years agodevfs: rewrite cryptio()
cinap_lenrek [Sun, 29 Oct 2017 21:01:58 +0000 (22:01 +0100)]
devfs: rewrite cryptio()

adjust to new aes_xts routines.

allow optional offset in the 4th argument where the encrypted
sectors start instead of hardcoding the 64K header area for
cryptsetup.

avoid allocating temporary buffer for cryptio() reads, we can
just decrypt in place there.

use sdmalloc() to allocate the temporary buffer for cryptio()
writes so that devsd wont need to allocate and copy in case
it didnt like our alignment.

do not duplicate the error reporting code, just use io()
that is what it is for.

allow 2*256 bit keys in addition to 2*128 bit keys.

6 years agolibsec: rewrite aex_xts_encrypt()/aes_xts_decrypt()
cinap_lenrek [Sun, 29 Oct 2017 20:49:24 +0000 (21:49 +0100)]
libsec: rewrite aex_xts_encrypt()/aes_xts_decrypt()

the previous implementation was not portable at all, assuming
little endian in gf_mulx() and that one can cast unaligned
pointers to ulong in xor128(). also the error code is likely
to be ignored, so better abort() when the length is not a
multiple of the AES block size.

we also pass in full AESstate structures now instead of
the expanded key longs, so that we do not need to hardcode
the number of rounds. this allows each indiviaul keys to
be bigger than 128 bit.

6 years agocwfs: use /dev/swap instead of #c/swap to determine memory size
cinap_lenrek [Sun, 29 Oct 2017 20:41:35 +0000 (21:41 +0100)]
cwfs: use /dev/swap instead of #c/swap to determine memory size

6 years agolibc: improve alignment of QLp structure on amd64, cosmetics
cinap_lenrek [Sat, 28 Oct 2017 16:53:27 +0000 (18:53 +0200)]
libc: improve alignment of QLp structure on amd64, cosmetics

the QLp structure used to occupy 24 bytes on amd64.
with some rearranging the fields we can get it to 16 bytes,
saving 8K in the data section for the 1024 preallocated
structs in the ql arena.

the rest of the changes are of cosmetic nature:

- getqlp() zeros the next pointer, so there is no need to set
  it when queueing the entry.

- always explicitely compare pointers to nil.

- delete unused code from ape's qlock.c

6 years agolibc: wunlock() part 2
cinap_lenrek [Thu, 26 Oct 2017 00:42:26 +0000 (02:42 +0200)]
libc: wunlock() part 2

the initial issue was that wunlock() would wakeup readers while
holding the spinlock causing deadlock in libthread programs where
rendezvous() would do a thread switch within the same process
which then can acquire the RWLock again.

the first fix tried to prevent holding the spinlock, waking up
one reader at a time with releasing an re-acquiering the spinlock.
this violates the invariant that readers can only wakup writers
in runlock() when multiple readers where queued at the time of
wunlock(). at the first wakeup, q->head != nil so runlock() would
find a reader queued on runlock() when it expected a writer.

this (hopefully last) fix unlinks *all* the reader QLp's atomically
and in order while holding the spinlock and then traverses the
dequeued chain of QLp structures again to call rendezvous() so
the invariant described above holds.

6 years agoupas/smtpd: don't call syslog() from the note handler, this can deadlock
cinap_lenrek [Mon, 23 Oct 2017 04:08:18 +0000 (06:08 +0200)]
upas/smtpd: don't call syslog() from the note handler, this can deadlock

when the alarm hits while the process is currently in syslog(), holding
the sl lock, then calling syslog again will deadlock:

/proc/1729193/text:386 plan 9 executable
/sys/lib/acid/port
/sys/lib/acid/386
acid: lstk()
sleep()+0x7 /sys/src/libc/9syscall/sleep.s:5
lock(lk=0x394d8)+0xb7 /sys/src/libc/port/lock.c:25
i=0x3e8
syslog(logname=0x41c64,cons=0x0,fmt=0x41c6a)+0x2d /sys/src/libc/9sys/syslog.c:60
err=0x79732f27
d=0x0
ctim=0x0
buf=0x0
p=0x0
arg=0x0
n=0x0
catchalarm(msg=0xdfffc854)+0x7a /sys/src/cmd/upas/smtp/smtpd.c:71
notifier+0x30 /sys/src/libc/port/atnotify.c:15

6 years agolibc: cleanup atexit and put exits() in its own compilation unit
cinap_lenrek [Fri, 20 Oct 2017 18:58:38 +0000 (20:58 +0200)]
libc: cleanup atexit and put exits() in its own compilation unit

this avoids having to pull in atexit() and its dependencies
(lock(), unlock()) into every program. (as exits() is called
by _main() from main9.s).

6 years agovt: block when sending input to host (fixes truncated paste)
cinap_lenrek [Fri, 20 Oct 2017 18:31:30 +0000 (20:31 +0200)]
vt: block when sending input to host (fixes truncated paste)

6 years agolibsec: make sectorNumber argument for aes_xts routines uvlong
cinap_lenrek [Tue, 17 Oct 2017 19:36:45 +0000 (21:36 +0200)]
libsec: make sectorNumber argument for aes_xts routines uvlong

6 years agolibsec: add AES CFB and AES OFB stream ciphers
cinap_lenrek [Tue, 17 Oct 2017 19:34:01 +0000 (21:34 +0200)]
libsec: add AES CFB and AES OFB stream ciphers

6 years agoaux/wpa: prevent PTK re-installation attack by replaying AP retransmits
cinap_lenrek [Tue, 17 Oct 2017 18:15:48 +0000 (20:15 +0200)]
aux/wpa: prevent PTK re-installation attack by replaying AP retransmits

this implements the mitigation suggested in section "6.5 Countermeasures" of
"Key Reinstallation Attacks: Forcing Nonce Resuse in WPA2" [1].

[1] https://papers.mathyvanhoef.com/ccs2017.pdf

6 years agoape/libsec: fix the build, bring ape libsec.h in sync with plan9 version
cinap_lenrek [Mon, 16 Oct 2017 02:06:17 +0000 (04:06 +0200)]
ape/libsec: fix the build, bring ape libsec.h in sync with plan9 version

6 years agossh: remove extern declarations for pkcs1padbuf() and asn1encodedigest() (now in...
cinap_lenrek [Fri, 6 Oct 2017 19:00:08 +0000 (21:00 +0200)]
ssh: remove extern declarations for pkcs1padbuf() and asn1encodedigest() (now in libsec.h)

6 years agorsa: add auth/rsa2asn1, check write error in auth/rsa2x509 and auth/rsa2pub, document...
cinap_lenrek [Fri, 6 Oct 2017 18:55:57 +0000 (20:55 +0200)]
rsa: add auth/rsa2asn1, check write error in auth/rsa2x509 and auth/rsa2pub, document in rsa(8)

6 years agolibsec: export asn1encodedigest(), asn1encodeRSApub(), asn1toRSApub(), pkcs1padbuf...
cinap_lenrek [Fri, 6 Oct 2017 18:52:18 +0000 (20:52 +0200)]
libsec: export asn1encodedigest(), asn1encodeRSApub(), asn1toRSApub(), pkcs1padbuf() and pkcs1unpadbuf()

6 years agolibsec: allow \r\n terminated lines in decodePEM()
cinap_lenrek [Thu, 5 Oct 2017 18:33:46 +0000 (20:33 +0200)]
libsec: allow \r\n terminated lines in decodePEM()

6 years agocheck for fs= in netaudit
aiju [Wed, 4 Oct 2017 15:56:53 +0000 (15:56 +0000)]
check for fs= in netaudit