Commit graph

7578 commits

Author SHA1 Message Date
cinap_lenrek 17136370d8 hgfs: fix loadrevinfo() for empty log bug
loadrevinfo() would fail on a empty log portion due
to a bug in the previous commit.

the loop is supposed to skip all bytes until we encounter
a empty line. the loop starts at the beginning of a line
so when we encounter a \n, we have to terminate, otherwise
read bytes until we see \n (end of a line) and then read
another and test the condition again.
2020-03-01 23:23:01 +01:00
cinap_lenrek 2f976d8b56 libsec: move AES XTS function prototypes to AES definition section in the header file 2020-03-01 16:02:56 +01:00
cinap_lenrek 64640083de libsec: remove hash pickle functions, document ripemd160, cleanup sechash(2) manpage 2020-03-01 15:07:44 +01:00
cinap_lenrek 69e28c6513 kernel: simplify exec()
progarg[0] can be assigned to elem directly as it is a
copy in kernel memory, so the char proelem[64] buffer
is not neccesary.

do the close-on-exit outside of the segment lock. there
is no reason to keep the segment table locked.
2020-02-29 21:06:45 +01:00
cinap_lenrek 17a92f3995 devproc: make sure writewatchpt() doesnt overflow the watchpoint array
the user buffer could be changed while we parse it resulting
in a different number of watchpoints than initially calculated.
so add a check to the parse loop so we wont overflow the
watchpoint array.
2020-02-28 16:48:42 +01:00
cinap_lenrek adb36de077 kernel: make sure we wont run into the tos when copying exec() arguments
in case the calling process changes its arguments under us, it could
happen that the final argument string lengths become bigger than
initially calculated. this is fine as we still make sure we wont
overflow the stack segment, but we could overrun into the tos
structure at the end of the stack. so change the limit to the
base of the tos, not the end of the stack segment.
2020-02-28 16:45:20 +01:00
cinap_lenrek ff3e0eeb22 devproc: cleanup procwrite size checks
writes to /proc/n/notepg and /proc/n/note should be able to write
at ERRMAX-1 bytes, not ERRMAX-2.

simplify write to /proc/n/args by just copying to local buf first
and then doing a kstrdup(). the value of Proc.nargs does not matter
when Proc.setargs is 1.
2020-02-28 16:41:09 +01:00
Ori Bernstein 3df95385bc fix special case for null pointer constants in cond expressions
Section 6.5.15 of the C99 spec requires that if
	one argument of a ?: expression is a null pointer
	constant, and the other has a pointer type T*, then
	the type of the expression is T*.

	We were attempting to follow this rule, however,
	we only handled literal expressions when checking
	for null pointers.

	This change looks through casts, so 'nil' and 'NULL',
	and their expansion '(void*)0' are all detected as
	null pointer constants.
2020-02-27 15:09:10 -05:00
Ori Bernstein 0f9666ae16 walk arguments to g
This allows us to 'g' the files
	within a directory, as in:

		g _MAX /sys/include/ape

	Before this change, we'd attempt to
	grep the directory structure, which
	is not ideal. After, we grep the
	files within the directory.
2020-02-26 21:45:00 -08:00
Ori Bernstein 1ccd0cd04d include section 9 in manpage plumb rules.
We added section 9 to the manual. However,
	the plumb rule only recognized sections 1
	through 8. Fix it to include section 9.
2020-02-26 20:52:20 -08:00
BurnZeZ 7bd7776935 ape/cc: stop spamming arguments that are only needed once 2020-02-23 20:33:27 +00:00
cinap_lenrek ab5c4799d9 devcons: fix permissions for reboot and sysstat
#c/reboot is a write only file
#c/sysstat should not be writable by everyone (write resets counters)
2020-02-23 20:42:00 +01:00
cinap_lenrek 9fcce48b38 kernel: avoid selecting the boot process in killbig() 2020-02-23 18:58:06 +01:00
cinap_lenrek 4a80d9d029 kernel: fix multiple devproc bugs and pid reuse issues
devproc assumes that when we hold the Proc.debug qlock,
the process will be prevented from exiting. but there is
another race where the process has already exited and
the Proc* slot gets reused. to solve this, on process
creation we also have to acquire the debug qlock while
initializing the fields of the process. this also means
newproc() should only initialize fields *not* protected
by the debug qlock.

always acquire the Proc.debug qlock when changing strings
in the proc structure to avoid doublefree on concurrent
update. for changing the user string, we add a procsetuser()
function that does this for auth.c and devcap.

remove pgrpnote() from pgrp.c and replace by static
postnotepg() in devproc.

avoid the assumption that the Proc* entries returned by
proctab() are continuous.

fixed devproc permission issues:
	- make sure only eve can access /proc/trace
	- none should only be allowed to read its own /proc/n/text
	- move Proc.kp checks into procopen()

pid reuse was not handled correctly, as we where only
checking if a pid had a living process, but there still
could be processes expecting a particular parentpid or
noteid.

this is now addressed with reference counted Pid
structures which are organized in a hash table.
read access to the hash table does not require locks
which will be usefull for dtracy later.
2020-02-23 18:00:21 +01:00
cinap_lenrek f7c6023066 devswap: dont assume Proc* structures returned from proctab() are continuous 2020-02-23 14:08:33 +01:00
cinap_lenrek b7089d66ad sdiahci, sdodin: avoid calling kproc() while holding ilock() 2020-02-23 14:05:01 +01:00
Sigrid 68f15d6594 /sys/lib/kbmap: update 0xf860 to Kshift value, fix fake shifts on esc1 2020-02-23 00:57:05 +01:00
cinap_lenrek 219741ac01 sed: allow whitespace after ! negation (thanks k0ga) 2020-02-19 19:26:43 +01:00
spew 234aafb38d acme(1): fix scrolling when swiping text at the top or bottom of a frame 2020-02-13 16:09:25 -05:00
Ori Bernstein 98374d6eea remove C99_SPRINTF_EXTENSION define.
It's been 20 years since c99 came out. By now, if code
hasn't been fixed, it's not going to be. Requiring this
define just confuses porters.
2020-02-10 19:26:39 -08:00
Roberto E. Vargas Caballero 5f7a6b7ea3 bcm: change ARGB32 to XRGB32 for framebuffer to avoid slow drawing 2020-02-09 21:39:17 +01:00
Ori Bernstein 8b59286ef1 upas/fs plumb modify messages for self-changed flags
Currently upas/fs plumbs modify messages only if the flag
	changes are made by another imap connection.  If the flag
	changes are made within the running upas/fs no modify message
	is plumbed.

	This changes upas/fs to set the modify flag if we made the
	change ourself. It also moves the flag setting before the
	imap read, so that we don't clobber flag changes coming
	from the imap server with our own flags.

	(Thanks Tobias Heinicke)
2020-02-05 14:11:15 -08:00
rgl 7004384568 image(6): fix typo 2020-02-04 21:32:33 +01:00
cinap_lenrek 77a7e3f8fc kernel: cleanup makefile for $CONF.$O target 2020-02-02 20:46:58 +01:00
cinap_lenrek 04c4a9ca8b merge 2020-02-02 20:33:40 +01:00
cinap_lenrek be8cbcc852 listen(1): implement one-shot mode flag for listen1 (thanks kivik) 2020-02-02 20:31:48 +01:00
Ori Bernstein 8ce18a6338 fix double free in acme.
in acmerrorproc():
		sendp(s);
		free(s);

	in waitthread():
		recv(&err)
		free(err)

	We only want waitthread to free.
2020-01-31 09:25:39 -08:00
rgl efd4eb8933 document common emulator keys 2020-01-29 19:27:07 +01:00
BurnZeZ 2c0ccff286 walk: add D and T fmt characters (fileserver device/type) 2020-01-28 01:27:41 +00:00
BurnZeZ 0f1b442bc0 walk(1): formatting/corrections 2020-01-28 00:53:58 +00:00
BurnZeZ 7facfb5548 walk: remove superfluous newline 2020-01-28 00:44:44 +00:00
cinap_lenrek 023d957e6b kernel: restore old behaviour that kprocs have ther noteid == pid 2020-01-27 02:17:14 +01:00
cinap_lenrek 46a733c328 kernel: fix mistake from previous commit (noteid not being inherited by default) 2020-01-27 01:51:35 +01:00
cinap_lenrek 8d51e7fa1a kernel: implement portable userinit() and simplify process creation
replace machine specific userinit() by a portable
implemntation that uses kproc() to create the first
process. the initcode text is mapped using kmap(),
so there is no need for machine specific tmpmap()
functions.

initcode stack preparation should be done in init0()
where the stack is mapped and can be accessed directly.

replacing the machine specific userinit() allows some
big simplifications as sysrfork() and kproc() are now
the only callers of newproc() and we can avoid initializing
fields that we know are being initialized by these
callers.

rename autogenerated init.h and reboot.h headers.
the initcode[] and rebootcode[] blobs are now in *.i
files and hex generation was moved to portmkfile. the
machine specific mkfile only needs to specify how to
build rebootcode.out and initcode.out.
2020-01-26 19:01:36 +01:00
cinap_lenrek 60bb408acc ppc: remove old duplicate of devtls.c 2020-01-25 18:37:28 +01:00
aiju 6f80913ac7 add v8e 2020-01-22 13:09:09 +00:00
Alex Musolino 1ecdf09aee page(1): fix troff manual example 2020-01-20 14:59:04 +10:30
cinap_lenrek 09eac381e5 merge 2020-01-19 19:21:10 +01:00
Roberto E. Vargas Caballero 47bae09b33 Apply http://www.9paste.net/qrstuv/patch/acme-movetodelmesg/ 2020-01-19 19:18:12 +01:00
cinap_lenrek 16f11e4cd6 merge 2020-01-19 18:45:04 +01:00
cinap_lenrek a898d31f76 acme: fix off by one in colclose(), make dellist() code consistent 2020-01-19 18:43:51 +01:00
Roberto E. Vargas Caballero b099753597 acme: Restore call to movetodel() in colclose 2020-01-19 18:36:50 +01:00
aiju 639500b748 cycv: support for registers 2020-01-13 23:22:35 +00:00
aiju 561346d07f cyclone v kernel: fpga support, fix CONFADDR 2020-01-12 03:40:42 +00:00
cinap_lenrek 7cf8369411 vnc/devdraw: fix topnwindows() panic when images are not windows (thanks aiju)
see changeset 319be6cfe7ef
2020-01-12 00:19:39 +01:00
cinap_lenrek 16784a2e45 devdraw: fix topnwindows() panic when images are not windows (thanks aiju)
Crashes drawterm and native:

#include <u.h>
#include <libc.h>
#include <draw.h>

void
main(int argc, char **argv)
{
 	initdraw(nil, nil, nil);

 	Image *a[] = {screen, display->black};

 	topnwindows(a, nelem(a));
 	flushimage(display, 1);
}
2020-01-12 00:07:27 +01:00
cinap_lenrek 5254e41f6b pc64: adapt vgaradeon driver to 64-bit (thanks Robert Ransom)
Not yet tested.
2020-01-11 23:31:54 +01:00
cinap_lenrek 361b65e4df kernel: remove relics of CPU 'load balancing' policy in scheduler (thanks Robert Ransom)
This code was deleted from Plan 9 before the 9front repo began.
Proc.movetime was used by it, but has never been referenced in 9front.
2020-01-11 21:26:42 +01:00
cinap_lenrek dfda1cc878 bootrc: fix comment typo (thanks Robert Ransom) 2020-01-11 21:25:05 +01:00
cinap_lenrek 0b12020f10 ip/cifsd: implement SMB_SET_FILE_UNIX_BASIC for wstat 2020-01-11 14:50:52 +01:00