summaryrefslogtreecommitdiff
path: root/sbin/init
AgeCommit message (Collapse)Author
2022-09-10init(8): fix signal handler boolean type and qualifierScott Soule Cheloha
The variable "clang" is modified from a signal handler. Change it from an 'int' to a 'sig_atomic_t' and mark it 'volatile', as we recommend in signal(3). ok millert@ kn@
2021-10-24For open/openat, if the flags parameter does not contain O_CREAT, theTheo de Raadt
3rd (variadic) mode_t parameter is irrelevant. Many developers in the past have passed mode_t (0, 044, 0644, or such), which might lead future people to copy this broken idiom, and perhaps even believe this parameter has some meaning or implication or application. Delete them all. This comes out of a conversation where tb@ noticed that a strange (but intentional) pledge behaviour is to always knock-out high-bits from mode_t on a number of system calls as a safety factor, and his bewilderment that this appeared to be happening against valid modes (at least visually), but no sorry, they are all irrelevant junk. They could all be 0xdeafbeef. ok millert
2020-03-25init(8): use err(3) instead of hand-rolled fprintf(3) messagescheloha
2019-06-28When system calls indicate an error they return -1, not some arbitraryTheo de Raadt
value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future.
2018-08-24Drop special handling of SIGSYS.cheloha
Tolerance for up to 25 SIGSYS deliveries was added to init(8) soon after the addition of sysctl(2) at CSRG, presumably to ease the transition to the new ABI. After 25 years of work the ABI transition is finally complete and we can now safely remove this splint. In general, we now have better practices and methods for helping userspace across kernel ABI breaks. ok deraadt@
2018-01-31Check GETTY_SPACING against the monotonic clock.cheloha
Ensures that we can use the check if the system clock is set backwards. While here, move time retrieval into the child process in start_getty(), and only get the time if se_started has been set. ok millert@ tb@
2018-01-16GETTY_SLEEP is 30 seconds, not 10cheloha
ok deraadt@
2018-01-06unifdef LOGIN_CAP, we always want to use login.confTodd C. Miller
OK jca@, no objection deraadt@
2017-06-16s/CPU_LIDSUSPEND/CPU_LIDACTION/Martin Natano
ok mlarkin
2017-05-03Use the safe idiom of cleaning sensitive data from memory with explicit_bzero,Ricardo Mestre
instead of relying on other methods, after readpassphrase. Some programs on this diff won't benefit that much since it happens near the terminal path, but someone might copy the unsafe idiom to another program and place it where it may leak sensitive data. Discussed aeons ago with tb@, OK deraadt@ and beck@
2017-03-02Add a new sysctl machdep.lidaction. The sysctl works as follows:Martin Natano
machdep.lidaction=0 # do nothing machdep.lidaction=1 # suspend machdep.lidaction=2 # hibernate lidsuspend is just an alias for lidaction, so if you change one, the other one will have the same value. The plan is to remove machdep.lidsuspend eventually when people have upgraded their /ets/sysctl.conf. discussed with deraadt, who came up with the new MIB name no objections mlarkin ok stsp halex jcs
2016-10-06fix HISTORY;Ingo Schwarze
patches from Sevan Janiyan <venture37 at geeklan dot co dot uk>; verified using minnie.tuhs.org/cgi-bin/utree.pl
2016-09-05for consistency, hyphenate "single-user";Jason McIntyre
from rob pierce
2016-09-05replace obsolete getpass() by readpassphrase()Gleydson Soares
OK tedu millert
2016-09-04Use an RB tree instead of BDB to map process->session, ok tedu millertNicholas Marriott
2016-08-27Pull in <sys/time.h> for struct timespecPhilip Guenther
ok deraadt@
2016-05-10Do not close the stdio file desciptors in init(8), but dup2(2) themAlexander Bluhm
from /dev/null. The code is taken from daemon(3). Also move this operation to the beginning. OK millert@ deraadt@
2016-02-01Remove variable unneeded since introduction of crypt_checkpassJeremie Courreges-Anglas
ok millert@
2015-12-23Use NULL rather than 0 for pointers. No binary change.mmcc
2015-12-10Remove NULL-checks before free(). ok tb@mmcc
2015-11-18use _shadow getpwnam (and crypt_checkpass)Ted Unangst
2015-09-25there's no need to keep init secret these days, and the (unused)Ted Unangst
immutable flags would just be a pita. remove custom bin mode.
2015-08-20<stdlib.h> is included, so do not need to cast result fromTheo de Raadt
malloc, calloc, realloc* ok krw millert
2015-07-14Use volatile sig_atomic_t for requested_transition since it isTodd C. Miller
modified inside signal handlers. Instead of returning a function pointer, the state functions now return an enum for the next state. This is used as an index into an array of function pointers to do the actual state change in transition(). OK deraadt@
2015-03-18Make init(8) static PIE.Pascal Stumpf
ok deraadt@
2015-01-16Replace <sys/param.h> with <limits.h> and other less dirty headers whereTheo de Raadt
possible. Annotate <sys/param.h> lines with their current reasons. Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution. These are the files confirmed through binary verification. ok guenther, millert, doug (helped with the verification protocol)
2014-12-06Do not define the variable pid twice to avoid a compiler warning.Alexander Bluhm
OK millert@
2014-04-22malloc/memset->calloc. with bonus null check. from peter malone.Ted Unangst
2014-01-03Do not raise the securelevel when transitioning from catatonia toTodd C. Miller
multiuser since we are not actually going multiuser. Fixes a problem where the securelevel was raised for rc.shutdown even when reboot was run from single user mode. OK deraadt@
2013-02-11Ignore sysctl failure for CPU_LIDSUSPEND when errno is EOPNOTSUPP.Todd C. Miller
Just because CPU_LIDSUSPEND is defined in cpu.h does mean it is actually supported by the hardware. OK halex@
2012-10-11fix "disable lidsuspend on shutdown":Alexander Hall
- pull in machine/cpu.h so we can actually see CPU_LIDSUSPEND if it's there - fix the resulting compilation errors now that the code is actually used "Just go for it" deraadt@
2012-04-06no need to (unsigned) a small constantTheo de Raadt
2011-09-04knock out useless Pp;Jason McIntyre
2011-05-10Some cleanup and simplifications:Ingo Schwarze
- Explain single user mode once, not three times. - Do not claim that the boot program talked to init; it cannot do so. - Mention that the OpenBSD kernel does not support init -f. - And some minor rewordings and reorderings. Feedback and ok jmc@.
2010-10-15tweak previous;Jason McIntyre
2010-10-15freebsd uses SIGINT to request a reboot, we may as well be consistent.David Gwynne
pointed out by kettenis@ and deraadt@
2010-10-14add a SIGQUIT handler that does the same as USR1 and USR2, except itDavid Gwynne
reboots the machine instead just halting or powering down. diff from Jonathan Matthew manpage tweaks from jmc@ ok deraadt@
2010-09-29Add missing err.h includeDavid Coppa
OK deraadt@
2010-09-19more wacky macro fixing;Jason McIntyre
2010-08-07disable lidsuspend when we are powering downPeter Hessler
"I like this" marco@, "Sure" deraadt@
2010-03-14.Pd -> .PqJason McIntyre
2009-10-28rcsid[] and sccsid[] and copyright[] are essentially unmaintained (andTheo de Raadt
unmaintainable). these days, people use source. these id's do not provide any benefit, and do hurt the small install media (the 33,000 line diff is essentially mechanical) ok with the idea millert, ok dms
2007-09-03malloc(n * m) -> calloc(n, m); ok espieTheo de Raadt
2007-05-31convert to new .Dd format;Jason McIntyre
2007-01-29sort FILES;Jason McIntyre
2007-01-29add /fastboot to FILES, since these pages discuss that file;Jason McIntyre
2006-07-25correct .Xr; from marcus poppJason McIntyre
2006-06-22let's just use "getty" as the plural of `getty', because "getty's" isJason McIntyre
very painful, and "gettys" is misleading;
2006-06-22accept SIGUSR2. Like SIGUSR1, except it makes RB_POWERDOWN mandatory.Theo de Raadt
This will be used by kernel components which are trying to really really power the system down. suggested and tested by jason
2006-03-19Fix mem leaks in error path. From NetBSD's coverity analysis. ok pat@Otto Moerbeek
deraadt@