summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
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.
2019-08-21/sys/lib/acid/kernel: fix procstk() for arm64, set kdir for arm/arm64 to ↵cinap_lenrek
bcm/bcm64
2019-08-21bcm: set XN bits for kernel device mappingscinap_lenrek
2019-08-19bcm64: do not use OTP_BOOTMODE_REG to determine OSC frequency (thanks ↵cinap_lenrek
richard miller) the register does not seem to be accessible on the Rpi 3b. so instead hardcode oscfreq in the Soc structure.
2019-08-19disk/format: implement long name supportcinap_lenrek
2019-08-18add missing device tree file for raspberry pi 4cinap_lenrek
2019-08-18add raspberry pi 4 kernel and bootloader to pi3.img targetcinap_lenrek
2019-08-18bcm64: add support for more than 1GB of ram (untested)cinap_lenrek
this adds a 4GB KMAP window into the kernel address space so we can access all physical ram on raspberry pi 4 for user pages. note that kernel memory above KZERO is still limited to 1GB because of DMA restrictions.
2019-08-18bcm64: add driver for emmc2 controllercinap_lenrek
2019-08-16bcm: fix typo in gpio.c on unused AFedge0 constantcinap_lenrek
2019-08-16bcm64: poll gisb arbiter for asynchronous bus errorscinap_lenrek
2019-08-16ethergenet: remove debuggingcinap_lenrek
the hangs where caused by missing NX bits on the mmio mappings, so the debug code is not needed anymore.
2019-08-16bcm64: set XN bits for kernel device mappingscinap_lenrek
2019-08-12cc: use 7 octal digits for 21 bit runescinap_lenrek
2019-08-02libauth: do not set errstr in auth_rpc() for ARdone result (thanks majiru)cinap_lenrek
2019-07-28bcm, bcm64: add vcore support for raspberry pi 3 GPIO expandercinap_lenrek
2019-07-27bcm, bcm64: add BCM2711 support for gpiopull(), fix gpiomeminit(), cleanupcinap_lenrek
according to the following linux change, BCM2711 uses a different method for changing pullup/down mode: https://github.com/raspberrypi/linux/commit/abcfd092860760087b87acbdda0963fe7906839c#diff-cf078559c38543ac72c5db99323e236d gpiomeminit() was broken, using virtual address for the gpio physseg instead of the physical one. cleanup the code, avoid repetition by declaring static u32int *regs variable. make local variable names consistent.
2019-07-27bcm64: fix wrong prescaler for generic timer on rpi4cinap_lenrek
the raspberry pi 4 uses 54 instead of 19.2 MHz crystal. detect which frequency is used by reading OTP bootmode register: https://www.raspberrypi.org/documentation/hardware/raspberrypi/otpbits.md Bit 1: sets the oscillator frequency to 19.2MHz
2019-07-25ethergenet: fix flow control negotiationcinap_lenrek
2019-07-25bcm, bcm64: clean dma destination buffer before issuing dma in case of non ↵cinap_lenrek
cache-line-size aligned buffer
2019-07-25bcm64: add config for raspberry pi 4cinap_lenrek
2019-07-25bcm64: work in progress genet ethernet driver for raspberry pi 4cinap_lenrek
2019-07-25bcm64: reorganize virtual memory map for rapberry pi4cinap_lenrek
2019-07-25bcm64: update io.h for pci express and raspberry pi 4cinap_lenrek
2019-07-25bcm64: add pci express driver for raspberry pi 4cinap_lenrek
2019-07-25bcm64: add gic interrupt controller driver for raspberry pi 4cinap_lenrek
2019-07-25bcm64: add gisb arbiter driver to catch bus timeoutscinap_lenrek
2019-07-25bcm, bcm64: make irq.$O optional and add intrdisable(), use intrenable()cinap_lenrek
the raspberry pi 4 has a new interrupt controller and pci support, so get rid of intrenable() macro and properly make intrenable function with tbdf argument.
2019-07-25bcm64: strip debug symbols to make sure .img file is multiple of 4 bytescinap_lenrek
the raspberry pi4 firmware refuses to enable the GIC interrup controller for arm64 when the .img file is not a multiple of 4 bytes. yes, this is insane and nowhere documented.
2019-07-25bcm, bcm64: add dmaflush() function and make virtio size and virtual address ↵cinap_lenrek
configurable in Soc.virtio and Soc.iosize