summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2019-09-15bcm64: add addarchfile() prototype to fns.h (for qeed)cinap_lenrek
2019-09-14bcm64: enter page tables in mmutop *AFTER* switching asid in mmuswitch()cinap_lenrek
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.
2019-09-12acid/kernel: for stacktraces, try to use context from error stack when ↵cinap_lenrek
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.
2019-09-11ip/cifsd: dont return garbage in upper 32 bit of unix extension stat fieldscinap_lenrek
2019-09-10ip/cifsd: add basic support for UNIX extensionscinap_lenrek
2019-09-10ip/cifsd: exit to close connection when we get malformed smb header (fixes ↵cinap_lenrek
linux mount hang)
2019-09-09usbehci: silence "param declared but not used" compiler warning in ↵cinap_lenrek
itdinit()/sitdinit()
2019-09-09sdide: silence compiler warning in atadebug()cinap_lenrek
2019-09-09ape: Add mkstemp to /sys/src/ape/lib/ap/gen/mkfileRoberto E. Vargas Caballero
2019-09-09Add toascii() to apeRoberto E. Vargas Caballero
2019-09-09Add mkstemp to stdlib.hRoberto E. Vargas Caballero
q
2019-09-08mergecinap_lenrek
2019-09-08kernel: clear FPillegal in pexit() and before pprint()cinap_lenrek
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).
2019-09-08devproc: restore psstate info string in procstopwait()cinap_lenrek
2019-09-07Allow address expressions in ?c after int casts.Ori Bernstein
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
2019-09-07mergeOri Bernstein
2019-09-07Libflac: Tell it that we have stdint.h so it finds SIZE_MAXOri Bernstein
2019-09-06Include integer limits from generic stdint.h in system-specific stdint.hOri Bernstein
2019-09-07mergecinap_lenrek
2019-09-07cc: fix void cast crashcinap_lenrek
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).
2019-09-06Add missing UINTsz_MIN defines to ape stdint.hOri Bernstein
2019-09-06mergeOri Bernstein
2019-09-06sys/src/libventi: define VtEntryNoArchive constantDavid du Colombier
2019-09-06sys/src/libventi: implement vtsha1 and vtsha1check functionsDavid du Colombier
2019-09-06sys/src/libventi: implement vtreconn and vtredial functionsDavid du Colombier
2019-09-06ip/ipconfig: don't leave behind null address when dhcp gets interruptedcinap_lenrek
cleanup the null address (::) when the command gets interrupted.
2019-09-06Add RFC2822 (email style) formatted dates to to date(1).Ori Bernstein
2019-09-04kernel: get rid of tmperrbuf and use syserrstr swapping instead in namec()cinap_lenrek
2019-09-04rune(2): complete source referencescinap_lenrek
2019-09-04kernel: make exec clear errstr, stop side-channels and truncate on utf8 boundarycinap_lenrek
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.
2019-09-02bcm64: enable devgpio in kernel configuration (thanks qeed)cinap_lenrek
2019-08-30ndb/dnsquery, ndb/csquery: write ">" prompt to stderr (thanks kvik)cinap_lenrek
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
2019-08-30rsa(2): document asn1encodeRSApriv() and asn1encodeRSApub() functionscinap_lenrek
2019-08-30auth/rsa2asn1: implement private key export with -a flag (thanks kvik)cinap_lenrek
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.
2019-08-29pc64: map kernel text readonly and everything else no-executecinap_lenrek
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.
2019-08-288l, 6l: fix "unknown relation: TEXT" xfol() bug (thanks mischief)cinap_lenrek
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
2019-08-27kernel: prohibit changing cache attributes (SG_CACHED|SG_DEVICE) in ↵cinap_lenrek
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.
2019-08-27kernel: make user stack segment non-executablecinap_lenrek
2019-08-27pc64: implement NX bit discovery, map kernel mappings no-executecinap_lenrek
2019-08-27kernel: catch execution read fault on SG_NOEXEC segment (for mips)cinap_lenrek
2019-08-27kernel: catch execution read fault on SG_NOEXEC segmentcinap_lenrek
fault() now has an additional pc argument that is used to detect fault on a non-executable segment. that is, we check on read fault if the segment has the SG_NOEXEC attribute and the program counter is within faulting page.
2019-08-26kernel: expose no execute bit to portable mmu code as SG_NOEXEC / PTENOEXEC, ↵cinap_lenrek
add PTECACHED bits a portable SG_NOEXEC segment attribute was added to allow non-executable (physical) segments. which will set the PTENOEXEC bits for putmmu(). in the future, this can be used to make non-executable stack / bss segments. the SG_DEVICE attribute was added to distinguish between mmio regions and uncached memory. only matterns on arm64. on arm, theres the issue that PTEUNCACHED would have no bits set when using the hardware bit definitions. this is the reason bcm, kw, teg2 and omap kernels use arteficial PTE constants. on zynq, the XN bit was used as a hack to give PTEUNCACHED a non-zero value and when the bit is clear then cache attributes where added to the pte. to fix this, PTECACHED constant was added. the portable mmu code in fault.c will now explicitely set PTECACHED bits for cached memory and PTEUNCACHED for uncached memory. that way the hardware bit definitions can be used everywhere.
2019-08-26vncv: fix snarf buffer realloc memory corruptionqwx
fix never updating p when snarf is reallocated, resulting in memory corruption.
2019-08-25emmc: 50MHz highspeed support (from richard miller)cinap_lenrek
2019-08-25bcm64: replace emmc2 driver with richard millers sdhc drivercinap_lenrek
the new driver supports 50MHz highspeed bus mode and uses ADMA instead of SDMA.
2019-08-24/sys/lib/dist/mkfile: adjust 2GB for pi3 and zynq imgcinap_lenrek
2019-08-24/sys/lib/dist/mkfile: storage vendors idea of 2GB is deflatingcinap_lenrek
2019-08-23bcm64: deal with discontinuous memory regions, avoid virtual memory ↵cinap_lenrek
aliasing, implement vmap() proper on the 2GB and 4GB raspberry pi 4 variants, there are two memory regions for ram: [0x00000000..0x3e600000) [0x40000000..0xfc000000) the framebuffer is somewhere at the end of the first GB of memory. to handle these, we append the region base and limit of the second region to *maxmem= like: *maxmem=0x3e600000 0x40000000 0xfc000000 the mmu code has been changed to have non-existing ram unmapped and mmukmap() now uses small 64K pages instead of 512GB pages to avoid aliasing (framebuffer). the VIRTPCI mapping has been removed as we now have a proper vmap() implementation which assigns vritual addresses automatically.
2019-08-22bcm: invalidate cache on Fbinfo after firmware completioncinap_lenrek
2019-08-22bcm: flush out early boot messages on uart and screen initializationcinap_lenrek
make early boot messages available by writing out kmesg.buf after uart and screen initialization.