Commit graph

8999 commits

Author SHA1 Message Date
cinap_lenrek de62d32422 /lib/ndb/local: add dnschallenge ndb file for acmed(8) by default 2021-10-25 22:40:36 +00:00
cinap_lenrek c9a20db1f1 acmed(8): fix typo 2021-10-25 21:48:05 +00:00
cinap_lenrek 79c6a0f342 acmed: tokenize domains from subject also with spaces (fixed multidom cert) 2021-10-25 18:15:53 +00:00
cinap_lenrek 87eb9bc2b7 acmed: add external command flag -e, improvements, bugs
- allow for external command to be run to install a challenge using -e flag
- remove the challengedom argument, it is given by the subject in the csr
- fix some filedescriptor leaks in error paths
2021-10-25 16:59:29 +00:00
cinap_lenrek 4efd8575eb ndb(6): add caa 2021-10-25 02:00:22 +00:00
cinap_lenrek 20cff04fd2 ndb/dns: implement caa record type in ndb
this allows the caa records to be specified
in ndb as:

caa=<value> tag=<tag> flags=<flags>

where tag defaults to "issue" and flags to 0
when omited.
2021-10-24 22:15:26 +00:00
Ori Bernstein c2661f86fc git/serve: one more silencing of non-interactive prints 2021-10-24 14:37:36 +00:00
Ori Bernstein a7f6b58d0d git/serve: don't show progress when not interactive
this prevents console spam
2021-10-24 01:36:46 +00:00
cinap_lenrek 5b5f69513a kernel: make growfd(), findfreefd() and newfd2() static 2021-10-23 15:54:30 +00:00
cinap_lenrek 1180631421 devswap: improve setswapchan()
- check for unusable file types like directories and append-only files.
- we should eigther error without any side effects or succeed.
2021-10-23 15:12:27 +00:00
cinap_lenrek db971a6189 kernel: fix stat bugs
In a few places, we where using a fixed buffer of sizeof(Dir)+100
size for stat. This is not correct and fails if the name returned
in stat is long.

This results in being unable to seek to the end of file with a
long filename.

The kernel should do the same thing as dirfstat() from libc;
handling the conversion and buffer allocation and returning a
freeable Dir* pointer.

For this, a new dirchanstat() function was added.

The fstat syscall was not rewriting the name to the last path
element; fix it.

In addition, gracefully handle the mountfix case, reallocating
the buffer to accomidate the required stat length plus
size of the new name so dirsetname() does not fail.
2021-10-23 13:40:06 +00:00
cinap_lenrek e54b6c6cbd libsec: fix wrong assert condition (introduced in 775a4bea43) 2021-10-22 13:37:27 +00:00
Ori Bernstein 5e2bf722c3 acmed(8): missed a spot 2021-10-21 02:11:03 +00:00
Ori Bernstein 72a0886639 acmed(8): fix typos, formatting, and missed name change. 2021-10-21 02:01:43 +00:00
cinap_lenrek ee31c78080 libsec: fix operator precedence bugs (thanks kemal) 2021-10-17 23:35:37 +00:00
cinap_lenrek e0d2453f56 libsec: fix bugs in tls extension handling (thanks kemal)
this patch fixes bugs in tls extension handling:

1. if conn->serverName is an empty string, tlsClientExtensions
will generate a SNI with an empty hostname, which is forbidden
according to RFC 6066:

opaque HostName<1..2^16-1>;

check if conn->serverName has at least one char.

2. checkClientExtensions fail with clients that doesn't have
extensions, because it doesn't check if ext is nil. fix that
up.

3. rewrite checkClientExtensions. some parts of the code does
not check the length properly, and it could be simplified
heavily.
2021-10-17 23:19:33 +00:00
cinap_lenrek 741e943341 acmed(8): add bugs section 2021-10-17 20:19:09 +00:00
cinap_lenrek 2731ae50d3 libaml: resolve refs in ObjectType instruction
The standard states in section 19.5.93:

.... Notice that if this operation is performed
on an obeject reference such as one produced by
the Alias, Index, or RefOf statements, the obect
type of the base object is returned.
2021-10-17 19:52:28 +00:00
cinap_lenrek 31bb950b70 libaml: implement ObjectType instruction (thanks sigrid) 2021-10-17 19:29:09 +00:00
cinap_lenrek d0909089b2 libaml: implement ToString instruction 2021-10-17 18:45:05 +00:00
cinap_lenrek 72d08816ab devtls: implement "hangup" ctl message
This makes devtls connection directories compatible to
hangup function (see dial(2)).
2021-10-16 15:07:39 +00:00
cinap_lenrek bb2357de0c fork(2): document new error behaviour when out of resources 2021-10-16 13:14:53 +00:00
cinap_lenrek 20429fb04f kernel: call freebroken() for kproc() when out of processes 2021-10-16 13:14:14 +00:00
cinap_lenrek a557c515c8 kernel: dont block allocating kstack for new processes
Have newproc() fail returning nil if we can't allocate
the kernel stack instead of locking up in smalloc().
2021-10-16 13:12:59 +00:00
Ori Bernstein 4c7745b202 acmed: import acme (RFC8555) client 2021-10-15 00:32:32 +00:00
cinap_lenrek 5a807265a8 libthread: fix debug prints, simplify
Do the debuglevel check before calling the print
function for _threaddebug, by making it a macro.
Do not waste cycles passing arguments.

Generalize the _threaddebug function into _threadprint()
and add a varargcheck pragma. This function can
also be used from _threadassert().

Fix missing arguments in one case, fix trailing
newlines in _threaddebug().

Make _threadgetproc()/_threadsetproc() a macro,
just dereferencing Proc**_threadprocp.

Simplify the mainjump, just call _threadsetproc()
directly without that mainp dance. Remove the
_schedinit() argument, it uses _threadgetproc() now.
Get rid of Mainarg struct, just have a global variable
for argc.
2021-10-13 17:08:26 +00:00
cinap_lenrek 3fe3e370e3 usbxhci: xhcirecover proc does not need to check status every 10ms
The timing loop is here for the case if the
controller doesnt produce an interrupt when
becoming broken. In normal case, we should
just get worken up from the interrupt.

In any case, 100 times a second polling is
not neccessary here, increase to 1 second.
2021-10-13 16:57:38 +00:00
cinap_lenrek 03d870e028 kernel: return error from sysrfork instead of waiting and retrying
The old strategy of wait and retry doesnt seem to
work very well as it keeps all the forking parents
stuck waiting in the kernel worsening the situation.

The idea with this change is to have rfork() return
error quickly; and without whining; as most callers
would just react with a sysfatal() which might be
better for surviving this.
2021-10-12 11:30:42 +00:00
cinap_lenrek b3c3c3e63d cc: do not expand function-like macros for non-function invocations
It is a bit of a annoyance that kenc will try to expand
function like macros on any symbol with the same name
and then complain when it doesnt see the '(' in the
invocation.

test case below:

void
foo(int)
{
}

struct Bar
{
	int	baz;	/* <- should not conflict */
};

void
main(void)
{
	baz(123);
}
2021-10-12 03:06:20 +00:00
cinap_lenrek 1656782f79 libthread: remove unused _workerdata() prototype from threadimpl.h 2021-10-12 01:09:40 +00:00
cinap_lenrek b474f546f0 libthread: remove more garbage: _threadnotefd, _threadpasserpid. 2021-10-12 00:52:56 +00:00
cinap_lenrek 928b38c7b9 libthread: remove unused skip() function 2021-10-12 00:51:02 +00:00
cinap_lenrek 07608c768f libthread: deal with _schedfork() and _schedexec() returning -1
The current behaviour of the kernel to deadlock itself
instead of returning an error on fork.

This might change in the future, so prepare libthread
to handle this case.

For _schedfork(), we'r going to just retry forking
on every switch, while for _schedexec(), the exec
will fail and send ~0 down the pid channel.
2021-10-12 00:49:12 +00:00
Igor Böhm 24bd67f990 acme: remove superfluous print arguments (patch from plan9port) 2021-10-05 09:40:30 +00:00
Igor Böhm a73f41bf4e sam: fix spurious overwrite message (patch from plan9port)
Fixes:

% sam -d
 -.
w /tmp/foo
/tmp/foo: (new file) #0
w /tmp/foo
?warning: write might change good version of `/tmp/foo'
2021-10-05 09:27:45 +00:00
Igor Böhm 659496081e tweak: add missing return to fix double close(…) on file descriptor…
… and avoid printing conflicting messages.
2021-10-06 13:37:39 +00:00
james palmer a13c5c3dda realemu: fix typo in usage message. 2021-10-11 18:26:14 +00:00
cinap_lenrek b51d7ca3ba devip: improve tcp error handling for ipoput
The ipoput4() and ipoput6() functions can raise an error(),
which means before calling sndrst() or limbo() (from tcpiput()),
we have to get rid of our blist by calling freeblist(bp).

Makse sure to set the Block pointer to nil after freeing in
ipiput() to avoid accidents.

Fix wrong panic string in sndsynack, and make any sending
functions like sndrst(), sndsynack() and tcpsendka()
return the value of ipoput*(), so we can distinguish
"no route" error.

Add a Enoroute[] string constant.

Both htontcp4() and htontcp6() can never return nil,
as they will allocate new or resize the existing block.
Remove the misleading error handling code that assumes
that it can fail.

Unlock proto on error in limborexmit() which can
be raised from sndsynack() -> ipoput*() -> error().

Make sndsynack() pass a Routehint pointer to ipoput*()
as it already did the route lookup, so we dont have todo
it twice.
2021-10-11 15:55:46 +00:00
cinap_lenrek ad1ab7089d devip: add comment to ip.h explaining Routehint struct 2021-10-11 12:16:21 +00:00
cinap_lenrek 5484260b42 kernel: move waserror() macro to port/portfns.h 2021-10-11 11:52:37 +00:00
qwx 3e98132fc6 addpt(2): fix inconsistency in description 2021-10-10 17:13:57 +00:00
cinap_lenrek 365e63b36a devip: properly rlock() the routelock for v4lookup() and v6lookup()
i'm not confident about mutating the route tree
pointers and have concurrent readers walking the
pointer chains.

given that most route lookups are bypassed now
for non-routing case and we are not building a
high performance router here, lets play it safe.
2021-10-10 14:27:08 +00:00
cinap_lenrek e687d25478 devip: use top bit (type) | subnet-id for V6H() route hash macro
theres no structure in the lower 32 bits of an ipv6 address.

use the top bit to distinguish special stuff like multicast
and link-local addresses, and use the 16-bit subnet-id bits
for the rest.
2021-10-10 14:22:14 +00:00
cinap_lenrek 1a6324970d devip: cache arp entry in Routehint
Instead of having to do an arp hash table lookup for each
outgoing ip packet, forward the Routehint pointer to the
medium's bwrite() function and let it cache the arp entry
pointer.

This avoids route and arp hash table lookups for tcp, il
and connection oriented udp.

It also allows us to avoid multiple route and arp table
lookups for the retransmits once an arp/neighbour solicitation
response arrives.
2021-10-09 18:26:16 +00:00
risto.salminen@gmx.com d280f411f6 upas/fs: add missing newline to a debug print
Noticed while doing some debugging.
2021-10-09 10:53:39 +00:00
james palmer a8ad3fb3d0 acme: don't let tag button draw over tag border. 2021-10-06 09:19:58 +00:00
Igor Böhm 0c0ffafb5b sam(1): fix description of ctrl+g 2021-10-05 20:17:33 +00:00
cinap_lenrek 6ebb8b9e35 devip: use better hashipa() macro, use RWlock for arp cache 2021-10-03 15:58:58 +00:00
cinap_lenrek 55c3138c64 kernel: ensure that all accesses to Mhead.mount is done with Mhead.lock acquired
The Mhead structures have two sources of references to them:

- from Pgrp.mnthash hash-table
- from a channels Chan.umh pointer as returned by namec() for a union directory

Unless one holds the Mhead.lock RWLock, the Mhead.mount chain
can be mutated by eigther cmount(), cunmount() or closepgrp().

Readers, skipping acquiering the lock where:

mountfix(): responsible for rewriting directory entries for
union directory reads; was walking the Mhead.mount chain to
detect if the passed channel itself appears in the mount list.

cmount(): had a check and copy when "new" chan was a union itself
and if the MCREATE flag is set and would copy the mount table.
All this needs to be done with Mhead read-locked while copying
the mount entries.

devproc(): in the handler for reading /proc/n/ns file.

namec(): while checking if the Chan->umh should be initialized.

In addition to this, cmount() is changed to do the mountfree()
of the original mount chain when MREPL is done after releasing
the locks.

Also, some cosmetic changes...
2021-10-03 15:56:51 +00:00
Igor Böhm b638114186 vncv: enable connecting to Darwin hosts
Tested on MacOS Catalina and Big Sur releases.

Update man page to highlight weak encryption of vnc, recommending to
tunnel via ssh (thanks unobe).
2021-09-25 20:40:47 +00:00