summaryrefslogtreecommitdiffstats
path: root/sys/arch/powerpc (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Refactor the MAP_STACK feature, and introduce another similar variation:deraadt2019-06-011-19/+4
| | | | | | | | | Lookup the address that a syscall instruction is executed from, and kill the process if that page is writeable. This brings an aspect of W^X behaviour to W|X mappings (in JITs not yet adapted to W^X). The goal is to remove simple attack methods and force use of ret2libc or other more complicated means. ok kettenis stefan visa
* Use the debugger mutex for `ddb_mp_mutex'. This should prevent a racevisa2019-03-232-19/+17
| | | | | | | | | | that could leave `ddb_mp_mutex' locked if one CPU incremented `db_active' while another CPU was in the critical section. When the race hit, the debugger was unable to resume execution or switch between CPUs. Race analyzed by patrick@ OK mpi@ patrick@
* Add intr_{disable,restore}() for powerpc.visa2019-03-231-1/+13
| | | | OK mpi@ patrick@
* In pmap_page_protect(), zap the PTE before unlinking. At that point thekettenis2019-01-021-1/+8
| | | | | | | | | PTED_VA_MANAGED_M flag is still set so proper MOD/REF accounting will happen. Fixes memory corruption that would invariably happen when a machine started swapping. Giant cluestick from George Koehler. ok visa@, mpi@
* Include srp.h where struct cpu_info uses srp to avoid erroring out whenjsg2018-12-051-1/+2
| | | | | | | including cpu.h machine/intr.h etc without first including param.h when MULTIPROCESSOR is defined. ok visa@
* More "explicitely" -> "explicitly" in various comments.krw2018-10-221-2/+2
| | | | ok guenther@ tb@ deraadt@
* Unify and bump some of the NMBCLUSTERS defines. Some archs had it set toclaudio2018-09-141-2/+2
| | | | | | | | | 4MB which is far too low especially when the platform is able to run MP. New limits are, amd64 = 256M; arm64, mips64, sparc64 = 64M; alpha, arm, hppa, i386, powerpc = 32M; m88k, sh = 8M Still rather conservative numbers but much better than before. At least some hangs of arm64 build boxes was caused by this. OK kettenis@, visa@
* Remove unused spllock().visa2018-08-201-2/+1
| | | | OK deraadt@ mpi@
* Implement MAP_STACK option for mmap(). Synchronous faults (pagefault andderaadt2018-04-121-1/+19
| | | | | | | | | | | | | | syscall) confirm the stack register points at MAP_STACK memory, otherwise SIGSEGV is delivered. sigaltstack() and pthread_attr_setstack() are modified to create a MAP_STACK sub-region which satisfies alignment requirements. Observe that MAP_STACK can only be set/cleared by mmap(), which zeroes the contents of the region -- there is no mprotect() equivalent operation, so there is no MAP_STACK-adding gadget. This opportunistic software-emulation of a stack protection bit makes stack-pivot operations during ROPchain fragile (kind of like removing a tool from the toolbox). original discussion with tedu, uvm work by stefan, testing by mortimer ok kettenis
* Do not panic from ddb(4) when a lock requirement isn't fulfilled.mpi2018-03-201-4/+1
| | | | | | | | | | | Extend the logic already present for panic() to any DDB-related operation such that if ddb(4) is entered because of a fault or other trap it is still possible to call 'boot reboot'. While here stop printing splassert() messages as well, to not fill the buffer. ok visa@, deraadt@
* #define _MAX_PAGE_SHIFT in MD _types.h as the maximum pagesize an archderaadt2018-03-051-1/+2
| | | | | | | | | | needs (looking at you sgi, but others required this before). This is for the circumstances we need pagesize known at compile time, not getpagesize() runtime. Use it for malloc storage sizes, for shm, and to set pthread stack default sizes. The stack sizes were a mess, and pushing them towards page-aligned is healthy move (which will also be needed by the coming stack register checker) ok guenther kettenis, discussion with stefan
* Remove mutex implementations that now live in MI code.mpi2018-01-251-151/+0
|
* Move common mutex implementations to a MI place.mpi2018-01-252-86/+3
| | | | | | Archs not yet converted can to the jump by defining __USE_MI_MUTEX. ok visa@
* Include <sys/mutex.h> rather than <machine/mutex.h>mpi2018-01-221-2/+2
| | | | Required by upcoming MI mutex change.
* Define and use IPL_MPFLOOR in our common mutex implementation.mpi2018-01-132-3/+4
| | | | ok kettenis@, visa@
* Unify <machine/mutex.h> a bit further.mpi2018-01-121-7/+8
| | | | | | `mtx_owner' becomes the first field of 'struct mutex' on i386/amd64/arm64. ok visa@
* Add size for free.visa2018-01-111-2/+5
| | | | OK mpi@
* Delete unnecessary <sys/file.h> includesguenther2017-12-301-2/+1
| | | | ok millert@ krw@
* Sync C mutex implementations.mpi2017-12-201-4/+3
| | | | ok kettenis@
* Change __mp_lock_held() to work with an arbitrary CPU info structure andmpi2017-12-042-5/+5
| | | | | | | extend ddb(4) "ps /o" output to print which CPU is currently holding the KERNEL_LOCK(). Tested by dhill@, ok visa@
* add support for printing function arguments when displaying a tracejasper2017-10-181-4/+20
| | | | | | from DDB. this uses CTF to get the correct number of arguments. ok mpi@
* Sync alpha/mips64/powerpc mutex implementations.mpi2017-09-111-6/+8
| | | | | | No functionnal change. ok visa@
* Move mutex, condvar, and thread-specific data routes, pthread_once, andguenther2017-09-051-5/+1
| | | | | | | | pthread_exit from libpthread to libc, along with low-level bits to support them. Major bump to both libc and libpthread. Requested by libressl team. Ports testing by naddy@ ok kettenis@
* Remove leftovers of a past softintr mechanism.visa2017-07-252-8/+2
| | | | OK mpi@, kettenis@
* kill RCSID macros; discussed with millertderaadt2017-06-291-5/+1
|
* Unbreak profiling assembly functions in userland by defining thempi2017-06-231-2/+2
| | | | | | correct prologue if compiled with -DPROF. ok deraadt@
* Kill db_sym_t.mpi2017-05-301-2/+2
| | | | ok deraadt@, kettenis@, jasper@
* Kill SPINLOCK_SPIN_HOOK, use CPU_BUSY_CYCLE() instead.mpi2017-05-293-10/+8
| | | | ok visa@, kettenis@
* Implement copyin32(9).kettenis2017-05-161-1/+25
| | | | ok mpi@, visa@
* Make atomic.h ready to be included in userland.mpi2017-05-121-3/+4
| | | | | | - keep setbits/clearbits inside _KERNEL ok dlg@, kettenis@
* Rename Debugger() into db_enter().mpi2017-04-303-10/+10
| | | | | | | Using a name with the 'db_' prefix makes it invisible from the dynamic profiler. ok deraadt@, kettenis@, visa@
* Hook up mutex(9) to witness(4).visa2017-04-202-11/+23
|
* Provide mips64 with kernel-facing TCB_{GET,SET} macros that store itguenther2017-04-131-3/+1
| | | | | | | in struct mdproc. With that, all archs have those and the __HAVE_MD_TCB macro can be unifdef'ed as always defined. ok kettenis@ visa@ jsing@
* Split up fork1():guenther2017-02-121-3/+7
| | | | | | | | | | | | | | | | | - FORK_THREAD handling is a totally separate function, thread_fork(), that is only used by sys___tfork() and which loses the flags, func, arg, and newprocp parameters and gains tcb parameter to guarantee the new thread's TCB is set before the creating thread returns - fork1() loses its stack and tidptr parameters Common bits factor out: - struct proc allocation and initialization moves to thread_new() - maxthread handling moves to fork_check_maxthread() - setting the new thread running moves to fork_thread_start() The MD cpu_fork() function swaps its unused stacksize parameter for a tcb parameter. luna88k testing by aoyama@, alpha testing by dlg@ ok mpi@
* In exec_elf.c: expand ELFNAME(), ELFNAME2(), and ELFNAMEEND() exceptguenther2017-02-081-4/+2
| | | | | | | | | | | | | | | | | | | | | | leaving out the size, so that ELFNAME2(exec,makecmds) becomes exec_elf_makecmds instead of exec_elf{32,64}_makecmds and then delete the ELFNAME2() and ELFNAMEEND() macros. Move the prototypes for functions local to exec_elf.c to there from exec_elf.h. Simplify the SMALL_KERNEL conditionals around the ELF coredump code. Change exec_conf.c to use the size-generic names and macros Remove exec_elf{32,64}.c and just build exec_elf.c; delete the _KERN_DO_ELF and _KERN_DO_ELF64 #defines. ok jca@, encouragement from deraadt@ and tom@
* Rename pfind(9) into tfind(9) to reflect that it deals with threads.mpi2017-01-241-2/+2
| | | | | | While here document prfind(9. with and ok guenther@
* fix an uninitialised variable on altivec assist trapjsg2016-12-201-1/+2
| | | | ok krw@ kettenis@
* Change pmap_proc_iflush() to take a process instead of a procguenther2016-10-191-5/+5
| | | | | | powerpc: rename second argument of pmap_proc_iflush() to match other archs ok kettenis@
* all pools have their ipl set via pool_setipl, so fold it into pool_init.dlg2016-09-151-9/+6
| | | | | | | | | | | | | | | | | | | | | | the ioff argument to pool_init() is unused and has been for many years, so this replaces it with an ipl argument. because the ipl will be set on init we no longer need pool_setipl. most of these changes have been done with coccinelle using the spatch below. cocci sucks at formatting code though, so i fixed that by hand. the manpage and subr_pool.c bits i did myself. ok tedu@ jmatthew@ @ipl@ expression pp; expression ipl; expression s, a, o, f, m, p; @@ -pool_init(pp, s, a, o, f, m, p); -pool_setipl(pp, ipl); +pool_init(pp, s, a, ipl, f, m, p);
* take it one step further and bring the message inline with arm/sparc64jasper2016-09-101-2/+2
| | | | pointed out by guenther@
* don't hardcode the filename in an error message; use the function name insteadjasper2016-09-091-2/+2
| | | | ok jsg@ (who spotted the powerpc straggler too) millert@
* Telling gcc the TCB pointer is in %r2 via the 'register asm' extensionguenther2016-09-041-35/+2
| | | | tests out on powerpc and generates slightly better code
* Increase the number of mbufs on most architectures. This is basedbluhm2016-09-031-2/+2
| | | | | | | on a guess how much memory a typical machine has. If the value is too high, users may run out of kernel memory. Then we will have to adjust this again. OK claudio@ deraadt@
* consistently set ipls on pmap pools.dlg2016-06-071-2/+6
| | | | | | this is a step toward making ipls unconditionaly on pools. ok deraadt@ kettenis@
* SROP mitigation. sendsig() stores a (per-process ^ &sigcontext) cookiederaadt2016-05-101-2/+2
| | | | | | | | inside the sigcontext. sigreturn(2) checks syscall entry was from the exact PC addr in the (per-process ASLR) sigtramp, verifies the cookie, and clears it to prevent sigcontext reuse. not yet tested on landisk, sparc, *88k, socppc. ok kettenis
* Flush page (through the direct map) before mapping it into AGP. Fixeskettenis2016-05-071-1/+17
| | | | | | | artifacts seen in X on some G5 machines. Unfortunately not enough to fix G4 machines. With help from Marcus Glocker. ok mpi@
* Use a Thread Information Block in both single and multi-threaded programs.guenther2016-05-071-1/+4
| | | | | | | | | | | | | | | | | This stores errno, the cancelation flags, and related bits for each thread and is allocated by ld.so or libc.a. This is an ABI break from 5.9-stable! Make libpthread dlopen'able by moving the cancelation wrappers into libc and doing locking and fork/errno handling via callbacks that libpthread registers when it first initializes. 'errno' *must* be declared via <errno.h> now! Clean up libpthread's symbol exports like libc. On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec. Testing by various, particularly sthen@ and patrick@ ok kettenis@
* G/C DDB_REGS.mpi2016-04-271-2/+1
|
* Reduces the noise around the global ``ticks'' variable by renamingmpi2016-03-192-7/+7
| | | | | | all the local ones to ``nticks''. ok stefan@, deraadt@
* DDB_REGS -> ddb_regsmpi2016-03-061-5/+5
|