]> git.lizzy.rs Git - plan9front.git/log
plan9front.git
4 years agomerge
cinap_lenrek [Wed, 20 Nov 2019 23:40:15 +0000 (00:40 +0100)]
merge

4 years agovac(1): assimilate manpage additions from plan9port and complete usage lines (thanks...
cinap_lenrek [Wed, 20 Nov 2019 23:39:07 +0000 (00:39 +0100)]
vac(1): assimilate manpage additions from plan9port and complete usage lines (thanks joe9)

the usage lines in vac where out of sync with the implementation
and the manpages.

document the -a and -x options, from:

https://github.com/9fans/plan9port/blob/master/man/man1/vac.1

4 years agomail(1): fix typo
Alex Musolino [Wed, 20 Nov 2019 07:16:29 +0000 (17:46 +1030)]
mail(1): fix typo

4 years agotimezones: change DST timezone string for South Australia
Alex Musolino [Wed, 20 Nov 2019 01:19:16 +0000 (11:49 +1030)]
timezones: change DST timezone string for South Australia

Use "CDT" for DST as distinct from "CST" for non-DST.

4 years agomerge
Ori Bernstein [Tue, 19 Nov 2019 20:31:42 +0000 (12:31 -0800)]
merge

4 years agoadd start of section 9 manpages (thanks rgl)
Ori Bernstein [Tue, 19 Nov 2019 20:30:40 +0000 (12:30 -0800)]
add start of section 9 manpages (thanks rgl)

this change adds some of the kernel manpages from 9legacy,
fixed and updated to match the changes in 9front.

4 years agorio: fix cons read breakage from previous commit
cinap_lenrek [Tue, 19 Nov 2019 08:03:45 +0000 (09:03 +0100)]
rio: fix cons read breakage from previous commit

4 years agorio(4): update description of wctl file format
Alex Musolino [Tue, 19 Nov 2019 02:13:53 +0000 (12:43 +1030)]
rio(4): update description of wctl file format

State strings are now padded to 12-characters.  Remove ambiguous
reference to "12-character style", instead referring the reader to
image(6).

4 years agorio: pad window status strings in wctl files
Alex Musolino [Tue, 19 Nov 2019 02:10:53 +0000 (12:40 +1030)]
rio: pad window status strings in wctl files

This makes it possible to read the entire initial contents of the wctl
files without blocking.

4 years agorio: fix bug causing short reads of wctl files
Alex Musolino [Tue, 19 Nov 2019 02:08:13 +0000 (12:38 +1030)]
rio: fix bug causing short reads of wctl files

Previously, reads of wctl files would return one byte less than
requested as the returned string must be null terminated.  Now we pass
the actual size of the allocated buffer to the handler, which is large
enough to accommodate a trailing partial rune and terminating null
byte.

4 years agodocument 'T' flag misbehavior (thanks rgl)
Ori Bernstein [Mon, 18 Nov 2019 09:06:02 +0000 (01:06 -0800)]
document 'T' flag misbehavior (thanks rgl)

4 years agoSpecifiy the restrictions on 9boot file names more clearly.
Ori Bernstein [Mon, 18 Nov 2019 00:17:15 +0000 (16:17 -0800)]
Specifiy the restrictions on 9boot file names more clearly.

4 years agoDocument 9bootfat limitation.
Ori Bernstein [Mon, 18 Nov 2019 00:08:48 +0000 (16:08 -0800)]
Document 9bootfat limitation.

4 years agosdiahci: implement reset timeout for ahciencreset(), make blink() never block, fix...
cinap_lenrek [Sun, 17 Nov 2019 20:19:55 +0000 (21:19 +0100)]
sdiahci: implement reset timeout for ahciencreset(), make blink() never block, fix map[] access in ledkproc()

Ori_B reports that his controller gets stuck in the ahciencreset()
wait loop. so we implement a 1000 ms timeout. we replace delay()
with esleep() as we are always called from the ledkproc().

blink() could enter infinite delay loop as well, so instead of
waiting for the message to get transmitted we exit making it
non-blocking (we will get called again anyway).

the access to the controller map[] was wrong in ledkproc(). the
index is the controller number, not the drive number!

4 years agobootrc: for wireless netbooting, set the WPA/WPA2 preshard key with wpapsk=password...
cinap_lenrek [Sun, 17 Nov 2019 18:04:38 +0000 (19:04 +0100)]
bootrc: for wireless netbooting, set the WPA/WPA2 preshard key with wpapsk=password boot parameter

this allows automatic netbooting without password prompt
for the wirelss network.

4 years agoParse global pax header in the right place.
Ori Bernstein [Fri, 15 Nov 2019 21:26:25 +0000 (13:26 -0800)]
Parse global pax header in the right place.

4 years agoAdd pax extended header support to tar.
Ori Bernstein [Thu, 14 Nov 2019 21:52:41 +0000 (13:52 -0800)]
Add pax extended header support to tar.

Support for 'path=', 'uname=', 'gname=', 'size=', and 'atime=' pax
headers is useful.  Others are ignored, possibly with a warning.

We were running into missing support with the 'go' extraction.

At the same time, this cleans up the way that we handle paths,
getting rid of static buffers with hidden space at the front.

4 years agothread(2): fix manpage typos (thanks rgl)
Ori Bernstein [Tue, 12 Nov 2019 21:01:38 +0000 (13:01 -0800)]
thread(2): fix manpage typos (thanks rgl)

4 years agodraw(2): fix manpage typo (thanks rgl)
Ori Bernstein [Mon, 11 Nov 2019 21:35:47 +0000 (13:35 -0800)]
draw(2): fix manpage typo (thanks rgl)

4 years agodevip: use the routing table for local source ip address selection
cinap_lenrek [Sun, 10 Nov 2019 18:50:46 +0000 (19:50 +0100)]
devip: use the routing table for local source ip address selection

when making outgoing connections, the source ip was selected
by just iterating from the first to the last interface and
trying each local address until a route was found. the result
was kind of hard to predict as it depends on the interface
order.

this change replaces the algorithm with the route lookup algorithm
that we already have which takes more specific desination and
source prefixes into account. so the order of interfaces does
not matter anymore.

4 years agoFix directory heuristic for long file names.
Ori Bernstein [Tue, 5 Nov 2019 18:48:51 +0000 (10:48 -0800)]
Fix directory heuristic for long file names.

Tar specifies that a filename ending with '/' is a directory. We were
incorrectly looking at the short name. This meant that when we have long
filenames with a '/' at the 100th character, we would decide it was a
directory.

This change uses the long name when deciding the size for extraction,
and trusts the header size when just skipping forward in the stream.

4 years agogames/turtle: do exit instead of crash in redraw() when there where no lines drawn
cinap_lenrek [Sun, 3 Nov 2019 14:20:57 +0000 (15:20 +0100)]
games/turtle: do exit instead of crash in redraw() when there where no lines drawn

4 years agoadd games/linden and turtle to mkfile
aiju [Sun, 3 Nov 2019 13:54:26 +0000 (13:54 +0000)]
add games/linden and turtle to mkfile

4 years agoadd games/linden and games/turtle
aiju [Sun, 3 Nov 2019 13:49:23 +0000 (13:49 +0000)]
add games/linden and games/turtle

4 years agotar: fix memory corruption in extract1 (thanks petter)
cinap_lenrek [Sat, 2 Nov 2019 13:17:34 +0000 (14:17 +0100)]
tar: fix memory corruption in extract1 (thanks petter)

extract1() expects two extra bytes to be avilabe before
fname buffer so it can prepend ./ before the name. this
used to be the case with name(), but was violated when
long name support was added and getname() was used in
place of name() which did not reserve the 2 extra bytes.

this change reserves two extra bytes in the getname()'s
static buffer and also removes the extra copy as name()
already makes a copy.

4 years agoupasfs(4): fix manpage typo (thanks rgl)
cinap_lenrek [Sat, 2 Nov 2019 11:52:39 +0000 (12:52 +0100)]
upasfs(4): fix manpage typo (thanks rgl)

4 years agofile: add (very) basic support for detecting mpeg4 formats
Alex Musolino [Fri, 1 Nov 2019 01:35:11 +0000 (12:05 +1030)]
file: add (very) basic support for detecting mpeg4 formats

4 years agoupas/fs: fix handling of numeric timezone offsets in strtotm
Alex Musolino [Wed, 30 Oct 2019 23:11:03 +0000 (09:41 +1030)]
upas/fs: fix handling of numeric timezone offsets in strtotm

Since numeric timezone offsets are relative to GMT, initialise zone to
GMT so tm2sec(2) does not assume local time.

Note that if strtotm encounters a timezone *string* and consequently
overwrites zone then we will end up in the same mess since tm2sec(2)
only deals with GMT or local time.

4 years agoCheck if 'm' is null when updating messages.
Ori Bernstein [Mon, 28 Oct 2019 21:12:44 +0000 (14:12 -0700)]
Check if 'm' is null when updating messages.

4 years agobcm: fix software cursor avoidance for loadimage() case (thanks bitmapper)
cinap_lenrek [Sun, 27 Oct 2019 22:51:11 +0000 (23:51 +0100)]
bcm: fix software cursor avoidance for loadimage() case (thanks bitmapper)

4 years agoip/dhcpd: prevent client from increasing max reply size beyond the reply buffer capacity
cinap_lenrek [Tue, 22 Oct 2019 04:53:50 +0000 (06:53 +0200)]
ip/dhcpd: prevent client from increasing max reply size beyond the reply buffer capacity

4 years agoMake ctrl+g focus text windows and cycle zeroxed copies (thanks kvik)
Ori Bernstein [Mon, 21 Oct 2019 22:29:07 +0000 (15:29 -0700)]
Make ctrl+g focus text windows and cycle zeroxed copies (thanks kvik)

4 years ago/sys/lib/plumb/basic: open nedmail windows with -noscroll
Alex Musolino [Mon, 21 Oct 2019 21:48:20 +0000 (08:18 +1030)]
/sys/lib/plumb/basic: open nedmail windows with -noscroll

This preserves the desired behaviour of *not* scrolling to the bottom
of plumbed messages even when rio(1) is invoked with the -s flag.

4 years agondb/dns: handle empty $DNSSERVER
cinap_lenrek [Sun, 13 Oct 2019 07:02:04 +0000 (09:02 +0200)]
ndb/dns: handle empty $DNSSERVER

when $DNSSERVER is empty, query ndb for local dns servers
instead of not using any at all.

4 years agobackup: Set execution bits in backup scripts
Roberto E. Vargas Caballero [Sun, 13 Oct 2019 08:20:10 +0000 (10:20 +0200)]
backup: Set execution bits in backup scripts

4 years agoether82563: fix multicast for i210
cinap_lenrek [Fri, 11 Oct 2019 19:38:12 +0000 (21:38 +0200)]
ether82563: fix multicast for i210

MTA has 128 entries, according to section 8.10.15 in the datasheet.
this fixes ipv6 in apu2 which has 3x i210 (8086/157b).

4 years agoFetch IMAP flags from server. This makes us sync read/answered/... flags with unix.
Ori Bernstein [Thu, 10 Oct 2019 18:52:22 +0000 (11:52 -0700)]
Fetch IMAP flags from server. This makes us sync read/answered/... flags with unix.

4 years agoawk: make empty FS unicodely-correct.
Ori Bernstein [Thu, 10 Oct 2019 00:36:02 +0000 (17:36 -0700)]
awk: make empty FS unicodely-correct.

4 years agosdiahci: force Hudson SATA Controller to AHCI mode
cinap_lenrek [Tue, 8 Oct 2019 11:53:57 +0000 (13:53 +0200)]
sdiahci: force Hudson SATA Controller to AHCI mode

4 years agosshfs: fix dir2attrib() memory leak in wstat error case (thanks BurnZeZ)
cinap_lenrek [Mon, 7 Oct 2019 10:51:21 +0000 (12:51 +0200)]
sshfs: fix dir2attrib() memory leak in wstat error case (thanks BurnZeZ)

4 years agosshfs: fix race condition between sendproc() and recvproc()
cinap_lenrek [Mon, 7 Oct 2019 09:52:14 +0000 (11:52 +0200)]
sshfs: fix race condition between sendproc() and recvproc()

there was a race between the sendproc putting the request on
the sreqrd[] id and the recvproc handling the response, and
potentially freeing the request before the sendproc() was
finished with the request (or the fid).

so we defer allocating a request id and putting it on the
sreqrd[] stage after we have completely generated the
request in vpack(). this prevents the handling of the request
before it is even sent.

this also means that the SReq should not be touched after
calling sendpkt(), submitreq(), submitsreq().

secondly, putsfid() needs to acquire the RWLock to make sure
sendproc() is finished with the request. the scenario is that
recvproc() can call respond() on the request before sendproc()
has unlocked the SFid.

4 years agocwfs: fix listen filedescriptor leaks
cinap_lenrek [Fri, 4 Oct 2019 16:54:01 +0000 (18:54 +0200)]
cwfs: fix listen filedescriptor leaks

4 years agolib9p: fix listensrv() filedescriptor leaks
cinap_lenrek [Fri, 4 Oct 2019 16:52:53 +0000 (18:52 +0200)]
lib9p: fix listensrv() filedescriptor leaks

4 years agosshfs: use threadexits() instead of exits()
cinap_lenrek [Fri, 4 Oct 2019 16:51:44 +0000 (18:51 +0200)]
sshfs: use threadexits() instead of exits()

4 years agoupas/fs: speedup mtree and henter()
cinap_lenrek [Thu, 3 Oct 2019 13:49:53 +0000 (15:49 +0200)]
upas/fs: speedup mtree and henter()

move digest pointer into Mtree structrue and embed it into Idx struct
(which is embedded in Message) to avoid one level of indirection
during mtreecmp().

get rid of mtreeisdup(). instead we have mtreeadd() return the old
message in case of a collision. this avoids double lookup.

increase the hash table size for henter() and make it a prime.

4 years agopc: move low-level allocation details out of mmu.c into memory.c rampage() function
cinap_lenrek [Tue, 1 Oct 2019 23:01:34 +0000 (01:01 +0200)]
pc: move low-level allocation details out of mmu.c into memory.c rampage() function

4 years agovgai81x: use vmap() for uncached access to cursor data instead of manipulating kernel...
cinap_lenrek [Tue, 1 Oct 2019 22:58:46 +0000 (00:58 +0200)]
vgai81x: use vmap() for uncached access to cursor data instead of manipulating kernel page table

on 386, the kernel memory region is mapped using huge 4MB pages
(when supported by the cpu). so the uncached pte manipulation
does not work to map the cursor data with uncached attribute.

instead, we allocate a memory page using newpage() and map
it globally using vmap(), which maps it uncached.

4 years agomerge
cinap_lenrek [Sun, 22 Sep 2019 18:37:33 +0000 (20:37 +0200)]
merge

4 years agoape/cc: add spim
cinap_lenrek [Sun, 22 Sep 2019 18:35:16 +0000 (20:35 +0200)]
ape/cc: add spim

4 years agomerge
cinap_lenrek [Sun, 22 Sep 2019 18:30:08 +0000 (20:30 +0200)]
merge

4 years ago2c(1): document 7c (arm64)
cinap_lenrek [Sun, 22 Sep 2019 17:09:25 +0000 (19:09 +0200)]
2c(1): document 7c (arm64)

4 years agoape/cc: Add arm64 and remove alpha
Roberto E. Vargas Caballero [Sun, 22 Sep 2019 17:07:57 +0000 (19:07 +0200)]
ape/cc: Add arm64 and remove alpha

4 years agousbxhci: fix endpoint stall recovery, handle Ep.clrhalt flag
cinap_lenrek [Sun, 22 Sep 2019 16:51:41 +0000 (18:51 +0200)]
usbxhci: fix endpoint stall recovery, handle Ep.clrhalt flag

after issuing CR_RESETEP command, we have to invalidate
the endpoints output context buffer so that the halted/error
status reflects the new state. not doing so resulted in
the halted state to be stuck and we continued issuing
endpoint reset commands when we where already recovered.

handle the devusb Ep.clrhalt flag from devusb that userspace
uses to force a endpoint reset on the next transaction.

4 years agocmd/ip/*: chown the network connection after authentication
cinap_lenrek [Sat, 21 Sep 2019 21:36:44 +0000 (23:36 +0200)]
cmd/ip/*: chown the network connection after authentication

for servers that handle incoming network connections and authentication,
change the owner of the network connection file to the authenticated user
after successfull authentication.

note that we set the permissions as well to 0660 because old devip used
to unconditionally set the bits.

4 years agodevip: fix permission checking
cinap_lenrek [Sat, 21 Sep 2019 21:28:37 +0000 (23:28 +0200)]
devip: fix permission checking

permission checking had the "other" and "owner" bits swapped plus incoming
connections where always owned by "network" instead of the owner of
the listening connection. also, ipwstat() was not effective as the uid
strings where not parsed.

this fixes the permission checks for data/ctl/err file and makes incoming
connections inherit the owner from the listening connection.

we also allow ipwstat() to change ownership to the commonuser() or anyone
if we are eve.

we might have to add additional restrictions for none at a later point...

4 years agobootrc: unmount devip *before* starting factotum
cinap_lenrek [Sat, 21 Sep 2019 16:48:14 +0000 (18:48 +0200)]
bootrc: unmount devip *before* starting factotum

we want devip to get reattached after hostowner has been written. factotum
already handles this with a private authdial() routine that mounts devip
when it is not present. so we detach devmnt before starting factotum,
and attach once factotum finishes.

4 years agobootrc: remount devip after /dev/hostowner has been written by factotum
cinap_lenrek [Sat, 21 Sep 2019 16:11:52 +0000 (18:11 +0200)]
bootrc: remount devip after /dev/hostowner has been written by factotum

devip remembers the attach uname so after we set hostowner we
remount devip so future connections have the right owner.

4 years agodevproc: fix fishy locking in proctext(), check proc validity, static functions
cinap_lenrek [Sat, 21 Sep 2019 14:36:40 +0000 (16:36 +0200)]
devproc: fix fishy locking in proctext(), check proc validity, static functions

the locking in proctext() is wrong. we have to acquire Proc.seglock
when reading segments from Proc.seg[] as segments do not
have a private freelist and can therefore be reused for other
data structures.

once we have Proc.seglock acquired, check that the process pid
is still valid so we wont accidentally read some other processes
segments. (for both proctext() and procctlmemio()). this also
should give better error message to distinguish the case when
the process did segdetach() the segment in question before we
could acquire Proc.seglock.

declare private functions as static.

4 years agodevproc: move proctab() call after Qnotepg special case in procwrite()
cinap_lenrek [Thu, 19 Sep 2019 00:24:23 +0000 (02:24 +0200)]
devproc: move proctab() call after Qnotepg special case in procwrite()

4 years agokernel: simplify pgrpnote(); moving the note string copying to procwrite()
cinap_lenrek [Thu, 19 Sep 2019 00:07:46 +0000 (02:07 +0200)]
kernel: simplify pgrpnote(); moving the note string copying to procwrite()

keeps handling of devproc's note and notepg files similar and in the
same place and reduces stack usage.

4 years agoape: don't hardcode list of ape library directories in /sys/src/ape/lib/mkfile
cinap_lenrek [Mon, 16 Sep 2019 14:21:40 +0000 (16:21 +0200)]
ape: don't hardcode list of ape library directories in /sys/src/ape/lib/mkfile

this change allows one to drop library directories (like
freetype) into /sys/src/ape/lib/ and have them built without
having to change the mkfile.

4 years agobcm64: add addarchfile() prototype to fns.h (for qeed)
cinap_lenrek [Sun, 15 Sep 2019 02:53:45 +0000 (04:53 +0200)]
bcm64: add addarchfile() prototype to fns.h (for qeed)

4 years agobcm64: enter page tables in mmutop *AFTER* switching asid in mmuswitch()
cinap_lenrek [Sat, 14 Sep 2019 12:02:34 +0000 (14:02 +0200)]
bcm64: enter page tables in mmutop *AFTER* switching asid in mmuswitch()

there was a small window between modifying mmutop and switching the
asid where the core could bring in the new entries under the old asid
into the tlb due to speculation / prefetching.

this change moves the entering of the page tables into mmutop after
setttbr() to prevent this scenario.

due to us switching to the resereved asid 0 on procsave()->putasid(),
the only asid that could have potentially been poisoned would be asid 0
which does not have any user mappings. so this did not show any noticable
effect.

4 years agoacid/kernel: for stacktraces, try to use context from error stack when process is...
cinap_lenrek [Thu, 12 Sep 2019 13:28:04 +0000 (15:28 +0200)]
acid/kernel: for stacktraces, try to use context from error stack when process is not sleeping

when a process state has not been saved (Proc.mach != nil)
then the contents of Proc.sched should be considered invalid.

to approximate a stacktrace in this case, we use the error
stack and get a stacktrace from the last waserror() call.

4 years agoip/cifsd: dont return garbage in upper 32 bit of unix extension stat fields
cinap_lenrek [Wed, 11 Sep 2019 13:41:14 +0000 (15:41 +0200)]
ip/cifsd: dont return garbage in upper 32 bit of unix extension stat fields

4 years agoip/cifsd: add basic support for UNIX extensions
cinap_lenrek [Tue, 10 Sep 2019 19:19:34 +0000 (21:19 +0200)]
ip/cifsd: add basic support for UNIX extensions

4 years agoip/cifsd: exit to close connection when we get malformed smb header (fixes linux...
cinap_lenrek [Tue, 10 Sep 2019 19:17:23 +0000 (21:17 +0200)]
ip/cifsd: exit to close connection when we get malformed smb header (fixes linux mount hang)

4 years agousbehci: silence "param declared but not used" compiler warning in itdinit()/sitdinit()
cinap_lenrek [Mon, 9 Sep 2019 14:58:45 +0000 (16:58 +0200)]
usbehci: silence "param declared but not used" compiler warning in itdinit()/sitdinit()

4 years agosdide: silence compiler warning in atadebug()
cinap_lenrek [Mon, 9 Sep 2019 14:56:01 +0000 (16:56 +0200)]
sdide: silence compiler warning in atadebug()

4 years agoape: Add mkstemp to /sys/src/ape/lib/ap/gen/mkfile
Roberto E. Vargas Caballero [Mon, 9 Sep 2019 16:27:57 +0000 (17:27 +0100)]
ape: Add mkstemp to /sys/src/ape/lib/ap/gen/mkfile

4 years agoAdd toascii() to ape
Roberto E. Vargas Caballero [Mon, 9 Sep 2019 15:00:06 +0000 (16:00 +0100)]
Add toascii() to ape

4 years agoAdd mkstemp to stdlib.h
Roberto E. Vargas Caballero [Mon, 9 Sep 2019 14:58:39 +0000 (15:58 +0100)]
Add mkstemp to stdlib.h
q

4 years agomerge
cinap_lenrek [Sun, 8 Sep 2019 17:04:55 +0000 (19:04 +0200)]
merge

4 years agokernel: clear FPillegal in pexit() and before pprint()
cinap_lenrek [Sun, 8 Sep 2019 17:02:01 +0000 (19:02 +0200)]
kernel: clear FPillegal in pexit() and before pprint()

pexit() and pprint() can get called outside of a syscall
(from procctl()) with a process that is in active note
handling and require floating point in the kernel on amd64
for aesni (devtls).

4 years agodevproc: restore psstate info string in procstopwait()
cinap_lenrek [Sun, 8 Sep 2019 16:53:12 +0000 (18:53 +0200)]
devproc: restore psstate info string in procstopwait()

4 years agoAllow address expressions in ?c after int casts.
Ori Bernstein [Sun, 8 Sep 2019 01:25:04 +0000 (18:25 -0700)]
Allow address expressions in ?c after int casts.

This fixes ocaml on non-x86 architectures, where we have code
that looks like:

#define Fl_head ((uintptr_t)(&sentinel.first_field))

Without this change, we get an error about a non-constant
initializer. This change takes the checks for pointers and
makes them apply to all expressions. It also makes the checks
stricter, preventing the following from compiling to junk:

int x;
int y = 42;
int *p = &x + y

4 years agomerge
Ori Bernstein [Sat, 7 Sep 2019 19:46:44 +0000 (12:46 -0700)]
merge

4 years agoLibflac: Tell it that we have stdint.h so it finds SIZE_MAX
Ori Bernstein [Sat, 7 Sep 2019 19:37:33 +0000 (12:37 -0700)]
Libflac: Tell it that we have stdint.h so it finds SIZE_MAX

4 years agoInclude integer limits from generic stdint.h in system-specific stdint.h
Ori Bernstein [Sat, 7 Sep 2019 01:01:52 +0000 (18:01 -0700)]
Include integer limits from generic stdint.h in system-specific stdint.h

4 years agomerge
cinap_lenrek [Sat, 7 Sep 2019 00:13:35 +0000 (02:13 +0200)]
merge

4 years agocc: fix void cast crash
cinap_lenrek [Sat, 7 Sep 2019 00:11:18 +0000 (02:11 +0200)]
cc: fix void cast crash

the following code reproduces the crash:

void
foo(void)
{
}

void
main(int argc, char **argv)
{
(void)(1 ? (void)0 : foo());
}

the problem is that side() gives a false positive on the OCOND
with later constant folding eleminating the acutal side effect
and OCAST ending up with two nested OCATS with the nested one
being zapped (type == T).

4 years agoAdd missing UINTsz_MIN defines to ape stdint.h
Ori Bernstein [Fri, 6 Sep 2019 23:33:11 +0000 (16:33 -0700)]
Add missing UINTsz_MIN defines to ape stdint.h

4 years agomerge
Ori Bernstein [Fri, 6 Sep 2019 18:57:08 +0000 (11:57 -0700)]
merge

4 years agosys/src/libventi: define VtEntryNoArchive constant
David du Colombier [Fri, 6 Sep 2019 18:55:35 +0000 (11:55 -0700)]
sys/src/libventi: define VtEntryNoArchive constant

4 years agosys/src/libventi: implement vtsha1 and vtsha1check functions
David du Colombier [Fri, 6 Sep 2019 18:55:18 +0000 (11:55 -0700)]
sys/src/libventi: implement vtsha1 and vtsha1check functions

4 years agosys/src/libventi: implement vtreconn and vtredial functions
David du Colombier [Fri, 6 Sep 2019 18:54:44 +0000 (11:54 -0700)]
sys/src/libventi: implement vtreconn and vtredial functions

4 years agoip/ipconfig: don't leave behind null address when dhcp gets interrupted
cinap_lenrek [Fri, 6 Sep 2019 16:48:35 +0000 (18:48 +0200)]
ip/ipconfig: don't leave behind null address when dhcp gets interrupted

cleanup the null address (::) when the command gets interrupted.

4 years agoAdd RFC2822 (email style) formatted dates to to date(1).
Ori Bernstein [Fri, 6 Sep 2019 15:25:21 +0000 (08:25 -0700)]
Add RFC2822 (email style) formatted dates to to date(1).

4 years agokernel: get rid of tmperrbuf and use syserrstr swapping instead in namec()
cinap_lenrek [Wed, 4 Sep 2019 00:44:39 +0000 (02:44 +0200)]
kernel: get rid of tmperrbuf and use syserrstr swapping instead in namec()

4 years agorune(2): complete source references
cinap_lenrek [Wed, 4 Sep 2019 00:41:22 +0000 (02:41 +0200)]
rune(2): complete source references

4 years agokernel: make exec clear errstr, stop side-channels and truncate on utf8 boundary
cinap_lenrek [Wed, 4 Sep 2019 00:40:41 +0000 (02:40 +0200)]
kernel: make exec clear errstr, stop side-channels and truncate on utf8 boundary

make exec() clear the per process error string
to avoid spurious errors and confusion.

the errstr() syscall used to always swap the
maximum buffer size with memmove(), which is
problematic as this gives access to the garbage
beyond the NUL byte. worse, newproc(), werrstr()
and rerrstr() only clear the first byte of the
input buffer. so random stack rubble could be
leaked across processes.

we change the errstr() syscall to not copy
beyond the NUL byte.

the manpage also documents that errstr() should
truncate on a utf8 boundary so we use utfecpy()
to ensure proper NUL termination.

4 years agobcm64: enable devgpio in kernel configuration (thanks qeed)
cinap_lenrek [Mon, 2 Sep 2019 17:38:44 +0000 (19:38 +0200)]
bcm64: enable devgpio in kernel configuration (thanks qeed)

4 years agondb/dnsquery, ndb/csquery: write ">" prompt to stderr (thanks kvik)
cinap_lenrek [Fri, 30 Aug 2019 18:17:19 +0000 (20:17 +0200)]
ndb/dnsquery, ndb/csquery: write ">" prompt to stderr (thanks kvik)

kvik writes:

dnsquery(8) prints the interactive prompt on stdout together with
query results, making scripted usage unnecessarily difficult.

A straightforward solution is prompting on stderr instead: as
practiced by rc(1), among many others -- promptly taking care of
the issue:

; echo 9front.org mx | ndb/dnsquery >[2]/dev/null

4 years agorsa(2): document asn1encodeRSApriv() and asn1encodeRSApub() functions
cinap_lenrek [Fri, 30 Aug 2019 05:35:54 +0000 (07:35 +0200)]
rsa(2): document asn1encodeRSApriv() and asn1encodeRSApub() functions

4 years agoauth/rsa2asn1: implement private key export with -a flag (thanks kvik)
cinap_lenrek [Fri, 30 Aug 2019 05:34:35 +0000 (07:34 +0200)]
auth/rsa2asn1: implement private key export with -a flag (thanks kvik)

kvik writes:

I needed to convert the RSA private key that was laying around in
secstore into a format understood by UNIX® tools like SSH.

With asn12rsa(8) we can go from the ASN.1/DER to Plan 9 format, but not
back - so I wrote the libsec function asn1encodeRSApriv(2) and used it in
rsa2asn1(8) by adding the -a flag which causes the full private key to be
encoded and output.

4 years agopc64: map kernel text readonly and everything else no-execute
cinap_lenrek [Thu, 29 Aug 2019 05:35:22 +0000 (07:35 +0200)]
pc64: map kernel text readonly and everything else no-execute

the idea is to catch bugs and make kernel exploitation
harder by mapping the kernel text section readonly
and everything else no-execute.

l.s maps the KZERO address space using 2MB pages so
to get the 4K granularity for the text section we use
the new ptesplit() function to split that mapping up.

we need to set EFER no-execute enable bit early
in apbootstrap so secondary application processors
will understand the NX bit in our shared kernel page
tables. also APBOOTSTRAP needs to be kept executable.

rebootjump() needs to mark REBOOTADDR page executable.

4 years ago8l, 6l: fix "unknown relation: TEXT" xfol() bug (thanks mischief)
cinap_lenrek [Wed, 28 Aug 2019 19:01:16 +0000 (21:01 +0200)]
8l, 6l: fix "unknown relation: TEXT" xfol() bug (thanks mischief)

mischief reports:

this assembler input assembles with 6a but makes 6l crash.

 // 6a l.s
 // 6l l.6
 // _intrr: unknown relation: TEXT in _intrr
 // 6l 511: suicide: sys: trap: fault write addr=0x18 pc=0x20789c

 TEXT noteret(SB), 1, $-4
         CLI
         JMP _intrestore // works when commented

 TEXT _intrr(SB), 1, $-4
 _intrestore:
         RET

 TEXT _main(SB), 1, $-4
         RET

4 years agokernel: prohibit changing cache attributes (SG_CACHED|SG_DEVICE) in segattach(),...
cinap_lenrek [Tue, 27 Aug 2019 04:16:20 +0000 (06:16 +0200)]
kernel: prohibit changing cache attributes (SG_CACHED|SG_DEVICE) in segattach(), set SG_RONLY in data2txt()

the user should not be able to change the cache
attributes for a segment in segattach() as this
can cause the same memory to be mapped with
conflicting attributes in the cache.

SG_TEXT should always be mapped with SG_RONLY
attribute. so fix data2txt() to follow the rules.

4 years agokernel: make user stack segment non-executable
cinap_lenrek [Tue, 27 Aug 2019 02:04:46 +0000 (04:04 +0200)]
kernel: make user stack segment non-executable

4 years agopc64: implement NX bit discovery, map kernel mappings no-execute
cinap_lenrek [Tue, 27 Aug 2019 01:55:12 +0000 (03:55 +0200)]
pc64: implement NX bit discovery, map kernel mappings no-execute