Commit graph

10871 commits

Author SHA1 Message Date
cinap_lenrek
0ab0a036ed gefs: fix use after free in putconn() 2024-08-30 18:54:43 +00:00
cinap_lenrek
15341e1116 gefs: fix Fid refcounting bugs
The AuthRpc was attached to the Fid, but this doesnt
work as it does not handle dupfid() properly.

Instead attach the AuthRpc to the directory entry,
which is refcounted.

The dupfid() function retuns the new Fid* struct with
an extra reference. If we don't use it, we have to
putfid() it.

Use ainc()/adec() consistently and dont mix it with
agetl().
2024-08-30 18:46:50 +00:00
cinap_lenrek
d8cf26110d gefs: properly close and free connections
Before, we would just leak all the "Conn"
structures.

fshangup() could cause problems as it just
forcefully closes the file descriptors,
not considering someone else going to
write them afterwards.

Instead, we add a "hangup" flag to Conn,
which readers and writers check before
attempting i/o.

And we only close the file-descriptors
when the last reader/writer drops the
connection. (Make it ref-counted).

For faster teardown, also preserve the
"ctl" file descriptor from listen()
amd use it to kill the connection quickly
when fshangup() is called.
2024-08-28 18:34:14 +00:00
cinap_lenrek
b061a21bfa kbdfs: consult also escaped scancode table when decoding runes (thanks aap)
When at the task of decomposing a rune into its
"button" and "rune", also consider the keyboard
map table with the escaped scancodes.

This fixes Shift + left/right combinations in
drawterm.
2024-08-28 18:30:28 +00:00
cinap_lenrek
09d69e04b9 libc: cleanup hangup() function (avoid duplicated literal string) 2024-08-25 19:49:09 +00:00
cinap_lenrek
f384231c60 gefs: only allow 'none' attach when previously authenticated
For each connection, remember if authentication
protocol ran successfully and only then, allow
attach as 'none' user.

This prevents anonymous remote mounts of none.

The 'none' user also shouldnt attach to the dump
file system.
2024-08-25 14:47:17 +00:00
cinap_lenrek
9645ae07eb hjfs: implement "none" attaches properly
The Tauth for "none" should always fail,
but Tattach should only succeed when
the channel ran a successfull authentication
before.

Also, prevent "none" from attaching "dump".
2024-08-24 23:47:19 +00:00
cinap_lenrek
a97ee572b9 lib9p: add "authok" flag to Srv struct
We want to implement "none" attaches for hjfs,
but only if the 9p-"channel" ran a successfull
authentication before, to prevent anonymous
remote mounts as "none".

Add a flag to the Srv struct for this.
2024-08-24 23:45:51 +00:00
Jacob Moody
07aa9bfeef lib9p: verify uname against returned AuthInfo from factotum (thanks humm)
Before this it was possible to Tauth and Tattach with one
user name and then authenticate with factotum using a different
user name. To fix this we now ensure that the uname matches the returned
cuid from AuthInfo.

This security bug is still pending a cute mascot and theme song.
2024-08-24 16:58:31 +00:00
rodri
b05c74e7cb geometry(2): correct typo (thanks ndeuteron!) 2024-08-23 10:14:50 +00:00
Ori Bernstein
3d497649e7 gefs: use correct snap name with autosnaps
*shame*
2024-08-20 04:27:40 +00:00
rodri
7059938e94 libgeometry: add lineXsphere function 2024-08-19 21:30:14 +00:00
Ori Bernstein
a584d29458 tmdate(2): fix formatting for sub-second specifiers 2024-08-10 10:04:22 +00:00
qwx
6dc60ec3a9 qcowfs: add 9p debug flag 2024-08-05 22:23:51 +00:00
Ori Bernstein
f0ef1a4be0 git/fs: don't allow walking blobs 2024-08-05 07:12:37 +00:00
Sigrid Solveig Haflínudóttir
4c6701041e vt: skip over vertical line marks (Contour terminal) 2024-08-05 01:35:19 +00:00
sl
649a33ea10 /lib/rsc: Please always feel free to continue to reach out whenever you need anything. 2024-08-04 23:04:31 +00:00
sl
ea4db12631 /lib/theo: This thread is too long. Please just stop. 2024-08-04 23:02:47 +00:00
sl
91916b6896 /sys/games/lib/fortunes: redaction day 2024-08-02 03:06:08 +00:00
aap
d6d02abde5 libframe: always draw tick with current TEXT color. 2024-08-01 14:51:00 +00:00
Jacob Moody
9c0f4aa0e5 9p(2): typos
The changes from british to american spelling here follows
what spell(1) thinks, and seems to be more common based on
other manual pages.
2024-08-01 14:33:32 +00:00
qwx
f00a88b509 /sys/lib/dist/ndb/common: add hjgit port, remove unused 2024-08-01 14:31:59 +00:00
sl
030feef162 /lib/1oct1993: add troff files. 2024-08-01 00:15:51 +00:00
sl
dc959fbc94 /lib/1oct1993: replace text file with directory of troff source files. 2024-08-01 00:07:45 +00:00
Ori Bernstein
462464ff4a ape/patch: also kill ape/patch 2024-07-30 17:36:02 +00:00
Ori Bernstein
76fe6e9693 ape/diff: one more ancient, unmaintained, buggy gnu utility gone 2024-07-30 17:13:21 +00:00
Ori Bernstein
2a47e4f086 hgfs: use merge3 2024-07-30 17:12:03 +00:00
Ori Bernstein
2dc68de342 git: use native merge3 program instead of ape/diff3 2024-07-30 01:55:29 +00:00
Ori Bernstein
0136b08a10 merge3: fix exit conditions -- l, r are never nil 2024-07-30 00:42:51 +00:00
Ori Bernstein
c409b9127d gefs: correct in-memory directory length for DMAPPEND files (thanks cinap)
when appending to a directory, the copy of the offset in the dent was
set to the offset that the write was supposed to happen at -- however,
for DMAPPEND files the offset is always at the end of the file. Until
the file was closed, stat would show the wrong directory info.
2024-07-29 00:37:33 +00:00
Jacob Moody
821e6690d3 2l(1): add 7l and 9l 2024-07-28 20:41:59 +00:00
Jacob Moody
f9212297bd 2c(1): add 9c 2024-07-28 20:17:16 +00:00
cinap_lenrek
67b0aeb219 ipmux: implement hangup ctl
Implement a hangup ctl command that flushes the
queues, but keeps the filter around.

This can be usefull for low-overhead traffic blocking,
as only the file-descriptor needs to be kept around
and the queues can be flushed.

No user-space process is needed to consume packets
and no buffers are wasted.

example:

aux/dial -e -o hangup 'ipmux!ver=4;src=8.8.8.8' rc -c 'echo 0 > /srv/blocked'

rm /srv/blocked
2024-07-28 19:40:54 +00:00
Ori Bernstein
460b007c35 gefs: we need an agetv for the qgen on 32 bit systems 2024-07-28 16:26:33 +00:00
cinap_lenrek
75ac2674de devip: do not raise error from ipoput*()
It seems some protocols are unprepared to
deal with ipoput*() raising an error
(thrown from ifc->m->bwrite()).

so catch it and return -1 (no route) instead.
2024-07-28 00:32:14 +00:00
cinap_lenrek
520d698c3e devip: same for loopbackmedium... 2024-07-27 22:22:55 +00:00
cinap_lenrek
c91d99c5de devip: dont shoot the messenger (dont unbind the interface when ipipu4/ipiput6 errors)
The medium should only self-unbind when we get a read error
from the device, not when ipiput4/8() throw an error,
which can happen for the nullmedium.
2024-07-27 22:03:48 +00:00
Ori Bernstein
439a525113 git: rewrite entcmp to be single pass, less stupid
move to single pass strcmp variant that knows about trailing '/' rule.
2024-07-27 15:36:23 +00:00
Jacob Moody
605bed312a devip: fix masks in ipmux filters
We were accidentally searching the key for '&', instead of the value.
Inferno received this exact fix at some point, but it never made it back to Plan 9.
2024-07-26 22:03:34 +00:00
Ori Bernstein
5ae675bebd libmp: sidestep git bug for now
the installed version of git has a bug; removing
this file will trigger some spurious removals of
test files, so hold off deleting it until people
have time to install a fixed git
2024-07-26 03:01:56 +00:00
Ori Bernstein
5eb5831b05 git/query: use git entry sorting when computing dir diff
directories need to sort as though they end with a '/',
when running through them for comparison, otherwise we
flag files as added and removed spuriously, leading to
them incorrectly getting deleted when merging commits.
2024-07-26 02:44:21 +00:00
Ori Bernstein
c220d0acc6 libmp: remove stale test file
we moved it to test/, so no need for the
old one.
2024-07-25 00:10:51 +00:00
cinap_lenrek
42940399b8 kernel: use flag and integer to handle affinity
Instead of Proc { Mach *mp; Mach *wired; },
track affinity by an integer representing
the mach number instead.

This simplifies the code as it avoids needing
to compare with MACHP(m->machno).

Wiering a process to a processor is now done
by just assigning affinity and then set a flag
that it should not change.

Call procpriority() when we want to change
priority of a process instead of managing
the fields directly.
2024-07-24 19:55:42 +00:00
Ori Bernstein
487c2dc215 git: provide symref extension 2024-07-23 23:42:59 +00:00
cinap_lenrek
703bcae2ed kernel: only reset processor affinity p->mp when p->wired == nil 2024-07-23 22:29:13 +00:00
cinap_lenrek
cbbce6b301 ip/ipconfig: fix logic bug (thanks cgnarne)
We must not skip conf.preflt == 0 (only conf.validlt == 0)
so that we can change the kernels preflt timeout.
2024-07-23 21:35:51 +00:00
cinap_lenrek
2076c934d0 kernel: make schedinit() _Noreturn void 2024-07-23 21:23:26 +00:00
cinap_lenrek
8a6c61c8ef kernel: remove global balancetime variable -> make function static 2024-07-23 21:03:08 +00:00
cinap_lenrek
4a7c44fee4 kernel: improve nlocks print in sleep() 2024-07-23 21:00:04 +00:00
cinap_lenrek
f1e7d6da67 kernel: sched() should not imply spllo()
The idea is:

When we call sched() with interrupts disabled,
it must not return with them re-enabled.

The code becomes easier to reason about if
we make sched() preserve interrupt status,
which lets us call sched() from an interrupt
handler (with interrupts disabled) without
risking preemption by another interrupt once
sched() returns which can pump-up the stack.

This allows removing Proc.preempted flag as
it is now impossible for interrupts to
preempt each other in preempted().

Extra cleanups:

make interrupted() _Noreturn void
and remove unused Proc.yield flag.
2024-07-23 19:50:36 +00:00