Commit graph

10034 commits

Author SHA1 Message Date
cinap_lenrek
14c36f2b16 kernel: remove unused cruft: delaylink, normalprint 2024-11-16 03:37:45 +00:00
cinap_lenrek
705638e189 pc, pc64: refactor pcibios code so we dont pollute the amd64 kernel
We can move the pcibios code to its own module
and just provide a stub pcibiosinit() function
for pc64 so we do not have to pull in that code
and the data structures.

also lets us clean up mkdevlist hacks.
2024-11-15 23:20:28 +00:00
Jacob Moody
6b8c36d51f devip: correctly return when allocating an ipmedium slot
Previous patch attempted to panic when we ran out of slots,
however the loop needed changes to return early to avoid
the failure case.
2024-11-15 01:06:54 +00:00
cinap_lenrek
3f7a323e31 devip: panic if we exceed the number of media entries (thanks k0ga) 2024-11-13 19:31:12 +00:00
Ori Bernstein
b4e8108d6c git/save: sort argv lexicographically
our code assumed that the inputs were sorted, and
that scanning forward by prefix would group the dirs
by prefix. Sort so that assumption is true.
2024-11-10 01:31:25 +00:00
cinap_lenrek
e4373dd103 ip/pppoe: properly zero-pad ethernet frames, optimize framing, limit mtu
we should properly zero-pad the ethernet frames we send out
instead of sending random garbage.

for ppp -> ethernet, the ethernet header is fixed, so we
can generate it once before the read()/write() loop.

Use a 1514 byte buffer for all ethernet frames as the
maximum, and limit the mtu to 1514-14-8 -> 1492.
2024-11-07 21:24:27 +00:00
Ori Bernstein
aeb857e367 acme/Mail: provide runnable command to view html 2024-11-07 20:51:09 +00:00
Jacob Moody
15ceba4fc9 git: fix off by one in strncmp 2024-11-07 00:40:57 +00:00
Jacob Moody
7276be7b2d /sys/lib/dist/ndb/common: add git and gits 2024-11-07 00:40:35 +00:00
cinap_lenrek
9ae4b3d9fc nusb/usbd: issue SetConfiguration(0) request to USB3 hub on attach 2024-11-03 12:18:46 +00:00
cinap_lenrek
bada582e18 nusb/lib: do not retry port status requests
We want the hub to detect a failed hub as soon as possible,
to not delay device detaches.
2024-11-03 12:13:22 +00:00
cinap_lenrek
ebf3e9067d devusb: destruct usb tree from the leaves, split epclose() into epstop()/epclose()
For xhci, we want to keep the hubs around until all its
attached devices have been released, so have the Udev
take a reference to its parent hubs ep0.

This also means that we can now use just a pointer
to the tthub instead of duplicating the properties
needed for xhci and ythe code becomes trivial.

Do a non-recursive implementation of putep() to
conserve stack space.

For device detaches, we want to immediately cancel
all I/O so that the driver can release the device
as soon as possible.

For this, we add epstop callback in the Hci struct.
2024-11-03 12:11:45 +00:00
Ori Bernstein
acf707cbbc samterm: make right arrow move to the right of dot (thanks llamaa) 2024-10-29 14:15:18 +00:00
qwx
493bac79b6 pstree: reimplement in awk, optionally restrict to a given process 2024-10-30 23:43:47 +00:00
Jacob Moody
5969b872bb ip/tftpd: accept an address to announce to as an argument. 2024-10-30 21:46:39 +00:00
Jacob Moody
1454ec6425 aux/listen: remove namespace from procsetname.
This is typically nil, so a bit of an eyesore in pstree.
Not as important as the other entries for differentiating either.
2024-10-30 21:45:26 +00:00
cinap_lenrek
61f028fdac ip/traceroute: sprint() -> snprint() 2024-10-29 01:03:04 +00:00
cinap_lenrek
ce825aabe0 telnetd: fix getremote() 2024-10-29 00:58:33 +00:00
cinap_lenrek
1e7d5833ab ip/*: sprint() -> snprint() in a bunch of old copy-pasted network announce routines. 2024-10-29 00:42:07 +00:00
cinap_lenrek
c7fd84937c ip/ipconfig: don't use sprint() when we have variable strings. 2024-10-29 00:17:34 +00:00
cinap_lenrek
eb76dc48cd ip/ipconfig: ndbvalfmt() strings when formatting ndb entries. 2024-10-28 22:51:42 +00:00
cinap_lenrek
d248f8e847 ip/ppp: rc-quote ipnet value, to prevent accidents. 2024-10-28 22:50:49 +00:00
cinap_lenrek
6894c4e13a ppp: pass -i flag to ip/ipconfig (-i for ipv4, -I for ipv6) to populate ipnet= entries 2024-10-28 19:08:23 +00:00
cinap_lenrek
5f59652ae1 ip/ipconfig: implement dhcpv6 prefix delegation, dynamic client
Implement prefix delegation by requesting a
prefix and populate ipnet=val entry (val
passed from -i option).

Before, DHCPv6 was just implemented for stateless
one-shot operation, just exiting once we got out
IA address.

Moodies mediacom-enterprise-enterprise-ISP...
... they actually do enterprise-grade dyanmic dhcpv6
so here we are, implementing renewals...
2024-10-28 19:06:47 +00:00
cinap_lenrek
3e4e1b0211 ip(3): ra6 routerlt is in seconds, not ms. 2024-10-27 22:57:39 +00:00
cinap_lenrek
790a516884 ip/ipconfig: handle dhcpv6 IA options, pass gateway from RA
The IA options where not parsed properly, assuming option 5
is the first option.

For managed networks, we might not get any prefix info
options, but dhcpv6 needs a gateway, so use source address
of the RA.
2024-10-27 09:09:15 +00:00
cinap_lenrek
a916137c97 devip: allow (NAT) hole punching for ICMP and UDP
When establishing an translation for ICMP or UDP,
allow the reply to be matched from ANY source ip/port.
2024-10-26 17:05:35 +00:00
cinap_lenrek
7ee606d027 devip: Fix bugus RouteHint* pointer to be passed to ipoput4()
The Routehint is embedded into the Translation struct
at an offset, so setting the Translation *q pointer to
nil results in a non-nil Routehint* pointer passed to
ipoput4() generating a crash.
2024-10-26 17:04:40 +00:00
cinap_lenrek
ac0af7f9bf devfloppy: fix unreachable code warning after cmderror() 2024-10-23 22:54:59 +00:00
cinap_lenrek
41d0149194 devusb: fix TT properties, checking, and bugs
When a low/full speed device is connected to a USB2.0 hub,
the USB2.0 hub needs to be send special split transaction
protocol messages to communicate with the device below.

This also applies if the fullspeed/lowspeed device is not
directly connected to the USB2.0 hub, but has a fullspeed
hub in between like:

rootport -> usb2.0 hub -> usb1.1 hub -> fs/ls device

In this case, the tranaction translator is actually
the first hub, nut the direct parent of the device.

This was all totally wrong in the hci drivers drivers.

Also, with the new interface, usbd passes number of
ports, and TT properties in the "hub" ctl message,
so the port-count, TT Think-Time and Multi-TT properties
can be properly applied by the xhci driver.

Another bug was that the xhci route string was not
correct if a hub has more than 15 ports. A USB2.0
hub can have more than 15 ports and the standard sais
that in this case a value of 15 should be used in
its bit routestring nibble.

Also, check the hub depth. We should not exceed more
than 5 hubs.

For xhci, it turns out the hub parameters where
actually never properly applied, as the spec sais
only the first "create endpoint" command applies
the hub parameters. The "evaluate context" command
does not work.

Some pikeshedding in devusb:

- fix the freaking locking.
- remove redundant parameters (isroot -> depth < 0, ishub -> nports > 0)
- add TT properties to usb device struct

With these changes, the wired "middle port" issues
on mnt-reform xhci are gone.
2024-10-23 21:54:48 +00:00
cinap_lenrek
97a5e60d0e nusb/*: improve usbd to handle transaction translater properties correctly
In an upcoming commit, the interface for how to create hubs
and how to update endpoint parameters is going to change.

Device/endpoint properties should not be modified while
the data file is open (device is being used).

This also applies to control endpoint when changing
packet size.

The motivation here is to clean up the xhci driver
and not do these stupid hacks like parsing control
messages. It is easier to just have the hci drivers
apply everything at open time and being guaranteed
that properties do not change under them.

For this we need to make sure to only do these devctl's
while the data file is not open.

For hubs, the command changes and some parameters.

Primarily the number of ports (required for xhci) which
will let devusb do some error checking and the
USB2.0 -> USB1.1 transaction translator properties.

In usb/lib, the "isroot" property is redundant and is
replaced by depth < 0.

For usb3.0 hub descriptor, the led indicator fields are
different from usb2.0 descriptors.

Rest is pikeshedding.
2024-10-23 21:42:37 +00:00
cinap_lenrek
a610f2eac2 nusb/disk: kill 9p procs before sysfatal(), devctl() before opendevdata()
This is an error probably when converting from libthread
to classid plan9 procs. umsrequest() used to just sysfatal()
once the error counter reached some value. But this leaves
9p procs (created by srvrelease()) around keeping the
device hanging around.

Instead, reply first, then attempt some recovery.
If that fails, kill our notegroup.

Also, for upcoming devusb changes, make sure we do
devctl() while the endpoint is not in use.
2024-10-23 21:30:49 +00:00
cinap_lenrek
235681677d kernel: make cmderror() _Noreturn 2024-10-23 21:26:39 +00:00
cinap_lenrek
9a22996da2 forgot pc/wavelan.h 2024-10-20 12:23:40 +00:00
cinap_lenrek
40724b9988 devether: Fix memory leaks in ifstat reads
Instead of having the driver allocate the temporary
READSTR buffer (and messing up the error handling),
allocate it in devether (netif) and pass the driver
start and end pointers to it.

Also, systematically check that the ifstat()
function checks the zero-length read (meaning
it is supposed to just update statistics counters
for a stats file read).
2024-10-20 12:22:36 +00:00
cinap_lenrek
c1c4d40def devuart: Fix memory leak when reading status file
Drivers where allocating a READSTR size buffer,
then readstr() it. But readstr() can raise an
error on pagefault, resulting in the buffer to
be leaked.

Instead, we change the interface and allocate
the buffer in devuart read handler, passing
the driver start and end pointers into it.

Also, provide a default implementation (when
status == nil), avoiding some duplication.
2024-10-20 12:12:42 +00:00
cinap_lenrek
fcdfb151e2 kernel: Limit parsecmd() to a maximum of READSTR bytes
A user can create a large demand paged segment
and then do write to a ctl file with a very large buffer
driving the kernel into an out-of-memory condition.

For all practcal purposes, limit the input buffer size
to something reasonable. READSTR is 8000 bytes, which
would be enougth for even the largest ctl messages.
2024-10-20 12:07:08 +00:00
Ori Bernstein
5beba2cf33 upasfs(4): make the name match the executable path
this allows us to look up the manpage by the command
that would be used to invoke it, once the indexes get
rebuilt.
2024-10-18 23:24:36 +00:00
Ori Bernstein
c73d5a559f spin: make generated code match installed headers 2024-10-18 15:33:26 +00:00
Sigrid Solveig Haflínudóttir
3f33d868fe audio/zuke: icy: use http 1.1, specify host, follow redirects 2024-10-17 14:29:41 +00:00
rodri
708ff097a6 libgeometry: add ptincylinder and ptincone 2024-10-14 12:04:35 +00:00
rodri
b6b5e569e9 geometry(2): fix little typo 2024-10-14 11:22:53 +00:00
rodri
65ea63e521 libgeometry: add quaternion sandwich product functions
also took the chance to remove the semicolons from
the function signatures in the manpage synopsis, as
is custom in the other manuals.
2024-10-14 11:14:50 +00:00
Ori Bernstein
84170d89b7 patch: show expected line number for hunk when rejecting it 2024-10-12 14:50:42 +00:00
cinap_lenrek
5285caa05d devusb: prevent double-detach and other invalid state changes
We have to ensure that we do the putep() loop
only once for detach, so serialize the state
transition using ep0 qlock().

Furthermore, once the state is Ddetach, we
must ensure never to set it to something else
(such as Dreset or Denabled).
2024-10-09 21:43:07 +00:00
cinap_lenrek
4df9d68adb devusb: better usbid allocation, fix locking, remove dump ctl
usbid's where globally allocated with a generation counter,
but it would not free usbid's when freed out of order
resulting in overflow.

instead, we use a different scheme, where we allocate the
next higher id until we run out and then allocate the next
lowest id.

properly maintain epmax as well when putep() when out of
order.

make newdev() and newdevep() return the new Ep* with a
reference taken, preventing someone from freeing the ep
under us.

fix the locking, so once we release the epslock, all endpoints
have the ep->dev set properly and remove impossible checks.

remove the annoying "dump" ctl that spams the console.
2024-10-09 20:14:34 +00:00
cinap_lenrek
561926fcbc ether8169: add pci id for RTL8111/8168/8411 (thanks Sylvie) 2024-10-09 19:18:29 +00:00
cinap_lenrek
addf2d55bf test/zones.rc: Fix instability, read current time once.
The test just called date twice assuming they all
execute in the same second. This causes false positives
with the following errors (usually just 1 second
difference):

term% while(){./zones.rc}
/adm/timezone/US_Arizona Sun, 06 Oct 2024 09:09:12 -0700 1728230953 1728230952 are not equal
/adm/timezone/Uruguay Sun, 06 Oct 2024 14:09:17 -0200 1728230958 1728230957 are not equal
/adm/timezone/Japan Mon, 07 Oct 2024 01:09:19 +0900 1728230960 1728230959 are not equal
/adm/timezone/Iran Sun, 06 Oct 2024 19:39:25 +0330 1728230966 1728230965 are not equal
/adm/timezone/Australia_West Mon, 07 Oct 2024 00:09:27 +0800 1728230968 1728230967 are not equal
/adm/timezone/US_Eastern Sun, 06 Oct 2024 12:09:29 -0400 1728230970 1728230969 are not equal
/adm/timezone/GMT Sun, 06 Oct 2024 16:09:31 +0000 1728230972 1728230971 are not equal
/adm/timezone/local Sun, 06 Oct 2024 18:09:34 +0200 1728230975 1728230974 are not equal
/adm/timezone/Mexico_BajaSur Sun, 06 Oct 2024 09:09:36 -0700 1728230977 1728230976 are not equal

The fix is to get the current time once, with date -n
and then pass that to date to format the time and
then concert back and compare.
2024-10-06 16:14:29 +00:00
cinap_lenrek
96bf1d3ebd kernel: remove unused lockstats and make lock() return type void
remove the global statistics counters from taslock.c
as they'r not particularily usefull nor precise
and just cause unneccessary cache traffic.

if we want them back, we should place them into
the Mach structure.

also change the lock() function prototype to return void.
2024-10-06 16:02:13 +00:00
cinap_lenrek
40177b86bf auth/as: dont pollute parents environment or namespace (thanks jrmu, sl) 2024-10-06 02:03:54 +00:00
Jacob Moody
6ebfbaa826 isalpharune(2): invalid Runes are just > Runemax 2024-10-05 00:43:38 +00:00
Jacob Moody
698ecf25e5 libc/runeistype: out of range is only > Runemax, Rune is a uint 2024-10-05 00:36:48 +00:00
Ori Bernstein
394e9c2235 libc/runeistype: accept out of range runes
out of range runes should just return 0 for whether
they're within any of the classes.
2024-10-05 00:06:50 +00:00
cinap_lenrek
4d484968bf kernel: avoid recursive lockloop() prints from screenputs() (thanks noam)
We cannot use lock() from screenputs() because lock calls
lockloop(), which would try to print() which on very slow
output (such as qemu) can cause kernel stack overflow.

It got triggered by noam with his rube-goldberg qemu setup:

lock 0xffffffff8058bbe0 loop key 0xdeaddead pc 0xffffffff80111114 held by pc 0xffffffff80111114 proc 339
 panic: kenter: -40 stack bytes left, up 0xffffffff80bdfd00 ureg 0xffffffff80bddcd8 at pc 0xffffffff80231597
 dumpstack
 ktrace /kernel/path 0xffffffff80117679 0xffffffff80bddae0 <<EOF

We might want move this locking logic outside of screenputs()
in the future. It is very similar to what iprint() does.
2024-10-03 20:25:58 +00:00
Ori Bernstein
d8973bdc75 git/export: don't try to diff dirs 2024-10-03 15:36:43 +00:00
Ori Bernstein
8e301036fa merge3: remove unnecessary variables 2024-10-02 21:45:17 +00:00
Ori Bernstein
1cf37db07a merge3: fix funny merge cases and crashes 2024-10-02 21:43:20 +00:00
Ori Bernstein
9fa2b25133 merge3: clamp aligned lines to be within the file. 2024-10-01 18:13:55 +00:00
Noam Preil
0c4e4cb9e9 git/diff: fix -c flag 2024-10-01 12:08:29 +00:00
Noam Preil
91b19a1983 aux/cddb: fix artist line splitting 2024-09-29 15:08:34 +00:00
Noam Preil
be48d656d3 mkmany: check more carefully for test folder 2024-09-17 07:45:01 +00:00
Noam Preil
8624a54632 aux/cddb: support very long artist+album name combos 2024-09-24 06:47:26 +00:00
Noam Preil
dcff4acbb6 git/commit: preserve merge-parents on failed commit 2024-09-22 20:24:16 +00:00
Jacob Moody
f3f659b54b look: fix case sensitivity when using base > 10
Old attempt at this did not make any sense.
Also fix the reference to look in ascii(1) to be more correct.
2024-09-29 18:35:30 +00:00
cinap_lenrek
dc318a6471 git/test: add noam.rc testcase 2024-09-29 17:29:48 +00:00
cinap_lenrek
798352644e git/save: and try again... 2024-09-29 17:28:48 +00:00
cinap_lenrek
0e7690a4f8 git/save: pffff. revert last change... 2024-09-29 16:47:47 +00:00
cinap_lenrek
de7d3753a5 git/save: fix the "noam" bug
git/save gets a list of paths (added or removed)
passed to it, and we have to ALWAYS stat the
file in the working directory to determine the
effective file-type.

There was a bug in the "skip children paths"
loop that would compare the next path element
instead of the full path prefix including
the next element.

reproducer:

	git/init
	touch a
	git/add a
	git/commit -m 'add a' a
	rm a
	mkdir a
	touch a/b
	git/add a/b
	git/commit -m 'switch to folder' a a/b
2024-09-29 16:30:39 +00:00
cinap_lenrek
1c682a98fe ip/ipconfig: make ra limiter less agressive (thanks cgnarne)
For handling route invalidations, we have to allow
short bursts of traffic. Therefore we keep track
of the number of ra's received in the ra interal
and only start dropping packets when reaching 100
packets.
2024-09-29 11:41:50 +00:00
cinap_lenrek
d0f4f620cf walk: qid.vers should be ignored (thanks BurnZeZ)
No idea who committed this in 2022 as its "glenda@9front.local",
but as qid.vers is incremented for each write and we definitely
should not use it as the cache tag.

Also, the initial code was stolen from du.c as the comment says,
and that one does the right thing.
2024-09-23 18:31:46 +00:00
Ori Bernstein
4374194306 git/branch: make it more robust
don't move to new branches or update the index until after
all changes are applied successfully, and the merge attempt
has been made.
2024-09-22 17:06:14 +00:00
cinap_lenrek
772f3099ef git/test: run tests with a temporary install bound to /bin/git
We want to run test before we do the installation
into the system.

So do a temporary install into test/$cputype.git/
direcotry and bind it on /bin/git, that way,
all the scripts run the local source version.
2024-09-16 22:55:40 +00:00
Ori Bernstein
e2fa84d6cd git/serve: we don't do thin packs -- advertise it. 2024-09-16 22:51:25 +00:00
Ori Bernstein
0636bfc774 git/query: process full contents of queue, even with skips
When skipping objects, we need to process the full queue,
because some of the objects in the queue may have already
been painted with keep. This can cost a small amount of time,
but should not need to advance the frontier by more than
one object, so the additional time should be proportional
to the spread of the graph.
2024-09-16 22:48:02 +00:00
Ori Bernstein
d9edee8b1a merge3: correctly handle 1-based closed intervals
the previous bug wasn't a missing clamp, but a
mishandling of the 1-based closed intervals that
we were genrating internally, and some asserts
that assumed open intervals.
2024-09-15 02:22:27 +00:00
cinap_lenrek
1a53aacc60 git/test: improve ftype test (also test dir -> file transition)
The ftype.rc test now tests both: file->dir and dir->file changes.
2024-09-14 19:21:17 +00:00
Ori Bernstein
d03b67430f merge3: fix assert in merge of identical deletions 2024-09-14 15:57:24 +00:00
Ori Bernstein
f63dcb4b9b git/branch: handle dirents changing between file and dir correctly (thanks cinap) 2024-09-13 16:28:32 +00:00
rodri
9482f887f9 jpg/tga: decode TGA32 images into RGBA32 ones 2024-09-12 19:09:40 +00:00
cinap_lenrek
ce97bb4998 merge 2024-09-09 16:54:41 +00:00
aap
79eb47ef8e acme, abaco: render scrollbar like rio 2024-09-09 13:03:15 +00:00
Ori Bernstein
36e5075ded gefs: protect fids with rwlock 2024-09-07 19:00:06 +00:00
qwx
084c9d6eba g: add .in, fix earlier fuckup (thanks mkf)
2d63bdbb44 was pushed modified
compared to the patch actually submitted by mkf, in error.
2024-09-04 19:57:16 +00:00
cinap_lenrek
87cbf8e792 sshnet(4): fix title (thanks arne) 2024-08-31 18:50:25 +00:00
Jacob Moody
9d2f21b2cf ndb/dns: refuse recursive requests harder when given -R (thanks be0ba)
Before we would refuse to recurse, but would still give
a response with hints back. Some nefarious clients will interpret the
lack of a Refused response code as us being an open resolver.
2024-08-31 02:23:05 +00:00
cinap_lenrek
761452154a gefs: clunk dent and mnt when dropping rclose message
When clunking a Fid while the file-system is read
only, dont just free the Amsg, but also drop the
references to dent and mnt.

Make clunkfid() nil fid->rclose, so no reuse
after free is possible.

Make clunkfid() always set the return pointer,
avoid missing prior initialization.
2024-08-30 19:54:26 +00:00
cinap_lenrek
d31382ca17 gefs: fix fidtab locking order in clunkfid()
Do not abuse fidtab lock for serializing
clunking.

The clunk should serialize on Fid.Lock
instead, so add a canlock check here.

The lock order is strictly:

Fid.Lock > Conn.fidtab[x].Lock
2024-08-30 19:16:13 +00:00
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
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
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
cinap_lenrek
fc859af624 etherimx: fix missing barrier for doorbell (thanks sigrid)
the symptom is that ping is apparently skipping
transmits which recover with the next send,
resulting in exactly send-period spikes in
the ping rtt.

It appears that the core seems to reorder writes
to uncached memory, which can result in the doorbell
being written before the descriptor status bits
are written.

put a coherence() barrier before writing doorbell
fixes it.

thanks sigrid for reporting the issue!
2024-07-21 17:35:18 +00:00
cinap_lenrek
3598b7cf36 kernel: hack processor affinity to allow load sharing
On a multiprocessor, the scheduler can run into
a very unfair distribution of processes to cpus
when there are more long-running processes than cpus.

Say we have a 4 cpu machine and we run 4 long-running
proesses, each cpu will pick up a single process
and each process will get 100% of its fair share.

Everything is good so far.

If we start more long-running processes, all these
processes are going to be picked up by the cpu core
that runs most sporanic / bursty work loads as it
is calling sched() more often.

This results in all the extra long-running prcoesses
to cluster around the same core resulting in very
unfair sharing of load.

The problem is that once a process runs on a cpu,
it stays on that cpu as processor affinity
is never reset.

Process migration only happens when a cpu cannot
find any process to run, given the affinity
constrains, but this can never happen when
the system is under full load and each cpu
always has a low-priority long running
process to run.

How do we fix this?

The idea of this hack is to reset processor
affinity in ready() when its priority changes or,
when it appears to be a long-running process.

That way, we give every cpu a chance to pick
it up and share the load.

This is not a ideal solution of course. Long term,
we should probably have separate runqueues per cpu
and do the balancing explicitely.
2024-07-21 13:44:18 +00:00
cinap_lenrek
11cd33bcec kernel: make fixedpri work.
Fix and document the "fixedpri" control.
2024-07-21 13:00:48 +00:00
cinap_lenrek
706b44c15d kernel: fix wrong updatecpu() context regression
In the sched() function, the call to reprioritize()
must be done before we set up, as reprioritize()
calls updatecpu(), which determines if the process
was running or not based on p == up. So move
the call to runproc() itself.
2024-07-21 12:44:23 +00:00
Ori Bernstein
b0d33c09ff gefs: more/stricter asserts and checks 2024-07-19 20:37:11 +00:00
Ori Bernstein
108f94b25a gefs: set super dir in Qadm correctly
gefs: ream uplink for root dir in adm correctly
2024-07-19 20:13:46 +00:00
Ori Bernstein
6a049aafed history: add support for gefs dumps 2024-07-18 16:49:31 +00:00
Ori Bernstein
1ca26f9924 gefs: work around 8c bug
8c doesn't like assigning struct literals with vlongs
into array indexes, so work around it for now.
2024-07-18 16:25:46 +00:00
Ori Bernstein
0956f48633 git/commit: filter to changed files for git/save
while rehashing the same files over and over will work
just fine, it can be slow with a large number of large
files; this makes 'git/comit .' perform much better in
repos with a large number of large binary blobs.
2024-07-18 13:13:42 +00:00
Ori Bernstein
338e78a024 gefs: dump dirs are dirs too
even if they're down in the dumps
2024-07-17 21:48:15 +00:00
Ori Bernstein
48edf79c69 gefs: modifying a directory should update qid.vers 2024-07-17 15:07:11 +00:00
Ori Bernstein
201fe8de4b gefs: change log compression heuristic
compress when the log doubles in size, rather than
using a fixed size heuristic; this means that we
don't start compressing frequently as the log gets
big and the file system gets fragmented.
2024-07-08 03:29:40 +00:00
Ori Bernstein
a19d90dc8c gefs: fix allocation log compression
We could overwrite the log tail when compressing the
allocation log; this would be bad. Stop doing that.
2024-07-08 03:23:40 +00:00
rodri
1442891a3e samterm: avoid division-by-zero when $tabstop is zero or empty
this happens in libframe:

	/sys/src/libframe/frutil.c:80: 	x -= (x-f->r.min.x)%f->maxtab;

but there's no way to control when the user changes the
maxtab value, so it's samterm's responsibility to
sanitize it.
2024-07-16 11:29:49 +00:00
Ori Bernstein
51c899ca01 bio(2): fix formatting 2024-07-14 19:49:00 +00:00
Ori Bernstein
ee51c91f6f gefs: copy mode down on create, don't truncate walks with no DMEXEC
we were copying the owner and group of the parent dir into the fid
on create, but we forgot the mode; fix that, so that we don't check
perms against the wrong dir.
2024-07-13 15:55:37 +00:00
mkf
23e7a57172 rx: add ssh 2024-07-04 20:26:20 +00:00