summaryrefslogtreecommitdiffstats
path: root/lib/libc/sys/stack_protector.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* clang doesn't propagate attributes like "asm labels" and "visibility(hidden)"guenther2017-11-291-2/+2
| | | | | | | | | to builtins like mem{set,cpy,move} and __stack_smash_handler. So, when building with clang, instead mark those as protected visibility to get rid of the PLT relocations. We can't take the address of them then, but that's ok: it's a build-time error not a run-time error. ok kettenis@
* Rename the system call sendsyslog2 to sendsyslog. Keep the old onebluhm2016-03-211-2/+2
| | | | | | as osendsyslog for a while. The three argument variant is the only one that will stay. input kettenis@; OK deraadt@
* environ and __progname are not declared in a public header; declare themguenther2016-03-131-2/+2
| | | | | | in libc's hidden/stdlib.h instead of in each .c file that needs one ok deraadt@ gsoares@ mpi@
* use strlcat instead of strlcpy with modified arguments. ok deraadt@canacar2015-12-011-6/+5
|
* Rather than using syslog(3) (which pulls in snprintf), creating the reportderaadt2015-11-251-4/+14
| | | | | | | | string using simpler strings functions and use sendsyslog2() directly. Also, use the LOG_CONS flag so that single-user reports are more clear. Use a buffer size of 1024 (from bluhm) discussed with guenther and matthew ok millert
* Split the intra-thread functionality from kill(2) into its own syscallguenther2015-11-101-5/+4
| | | | | | | | | | | | thrkill(2), rolling the kill(2) syscall number with the ABI change to avoid breaking binaries during during the transition. thrkill(2) includes a 'tcb' argument that eliminates the need for locking in pthread_kill() and simplifies pthread_cancel(). Switch __stack_smash_handler() to use thrkill(2) and explicitly unblock SIGABRT. Minor bump to both libc and libpthread: make sure you install a new kernel! ok semarie@
* libc.so can't be unloaded, so move the hidden atexit() and pthread_atfork()guenther2015-11-101-1/+15
| | | | | | | | | | | stubs for the executable from crtbegin.o into libc, which lets them be excluded from static links that don't use them. For this, drop the normal crt{begin,end}S.o from libc.so: the .init and .fini sections for libc aren't called at the right times anyway, so it's good that they're unused. libc.so just needs __guard_local and the .note.openbsd.ident section, so add them to stack_protector.c for now (this will be improved) "good time" deraadt@
* Pull in namespace.h when building all .c files using gcc's -include option,guenther2015-09-101-5/+3
| | | | | | | | so that we can provide asm labels for the memcpy/memset/__stack_smash_handler calls that it generates ab initio. Eliminate direct #includes of it. Make sure it's a dependency of all objects (unnecessary for asm, but close enough). ok deraadt@
* Move to the <limits.h> universe.deraadt2015-01-161-2/+1
| | | | review by millert, binary checking process with doug, concept with guenther
* Do not need __guard[] anymore since we are now relying on __guard_localderaadt2013-12-281-3/+1
| | | | | for a while already ok miod kettenis
* do not need to create the stack cookie using a constructor anymore,deraadt2013-12-271-29/+1
| | | | | since the kernel supplies a .openbsd.randomdata segment. ok matthew miod guenther
* remove non-openbsd.randomdata partsderaadt2013-12-271-12/+1
| | | | ok miod matthew
* Don't attempt to warn about uninitialized __guard values yet. It'smatthew2012-08-241-2/+2
| | | | | | too early to assume that everyone has updated their compiler toolchains, and it seems to cause problems at least on armish when an out-of-date binutils is used.
* Change ld.so and libc to use .openbsd.randomdata on ELF platforms formatthew2012-08-221-4/+17
| | | | | | | | | | initializing their __guard values. For the time being, we're leaving libc's constructor method as a backup to make sure __guard actually gets initialized and to emit syslog warnings when it's not. Not really an ABI change, so no shlib bump... "hold on to your butts" ok deraadt, kettenis
* ARGSUSED where neededderaadt2006-03-311-1/+2
|
* Use sysctl(KERN_ARND) to get n bytes, instead of just 4 at a timeotto2005-11-301-10/+5
| | | | | | | and remove fallback code. If somebody is dumb enough to make the sysctl fail using systrace, he deserves what he gets. Saves 7 syscalls on process startup. looks good miod@ ok deraadt@ tedu@
* zap remaining rcsid.espie2005-08-081-5/+1
| | | | | | Kill old files that are no longer compiled. okay theo
* lint says unsigned...deraadt2004-09-141-4/+6
|
* Directly invoke the sysctl system call, rather than going through the sysctl(3)miod2003-10-011-3/+5
| | | | | | wrapper. ok deraadt@ millert@
* add missing includesdavid2003-07-181-2/+5
| | | | ok tedu@
* in the handler, block signals handlers as soon as possible; ok miod millertderaadt2003-03-031-3/+9
|
* bug fixetoh2002-12-101-3/+3
|
* KNFderaadt2002-12-021-6/+6
|
* Import propolice (http://www.trl.ibm.com/projects/security/ssp), a stackmiod2002-12-021-0/+87
attack protection scheme, into gcc. This protection is enabled by default. It can be turned off by using the -fno-stack-protector flag. Code by Hiroaki Etoh (etoh at jp dot ibm dot com); work on openbsd-specific integration by fgsch@, deraadt@ and myself; tests by fgsch@, naddy@ and myself; beer drinking by myself. Please note that system upgrades with this new code will require a new libc and ld.so to be build and installed before the propolice-enabled compiler can be installed.