bluhm [Tue, 20 Oct 2015 12:40:19 +0000 (12:40 +0000)]
After pledge "dns" has been refactored and setsockopt(SO_RCVBUF)
has been added to it, the syslogd privsep parent does not need
pledge "inet" anymore.
discussed with deraadt@
sthen [Tue, 20 Oct 2015 11:29:07 +0000 (11:29 +0000)]
Add an explicit check for a malformed AS segment with (segment length 0),
avoiding division by zero when deciding whether it contains 2- or 4-byte ASNs.
Refactor TCHECK calls to ensure proper coverage.
From Kevin Reay, ok canacar with wording tweak (I used "malformed" rather
than canacar's suggested "invalid size" or Kevin's original "empty").
jsg [Tue, 20 Oct 2015 11:26:40 +0000 (11:26 +0000)]
fix a use after free found by clang using an approach suggested by renato
ok renato@
pascal [Tue, 20 Oct 2015 11:15:07 +0000 (11:15 +0000)]
On xmalloc failure, stop trying to determine the total amount of allocated
memory up to this point by using sbrk(2). This is of course wildly incorrect
for any mmap-based malloc(3).
This also makes it possible to bring pledge(2) to gnu/.
comments kettenis@, ok miod@
semarie [Tue, 20 Oct 2015 06:44:51 +0000 (06:44 +0000)]
update regress for pledge after whitelisted-path view inclusion
reyk [Tue, 20 Oct 2015 06:42:59 +0000 (06:42 +0000)]
Fix ocsp by adding a missing TAILQ_INIT().
Confirmed by markus@ with an identical diff
semarie [Tue, 20 Oct 2015 06:40:00 +0000 (06:40 +0000)]
clear whitelisted-paths view in pledge.
the following diff adds a clear view of whitelisted-paths in pledge.
before, whitelisting "/usr/local/bin" path would make only "/usr/local/bin"
VNODE was present and let "/usr/local", "/usr", and "/" been ENOENT. It was a
somehow odd filesystem hierarchy, and it breaks realpath(3).
with this diff, the directories that are one of the parents of a
whitelisted-directory become visible to stat(2) related syscalls, but only
with restricted permissions: stat(2) will lie a bit, and saying they owned by
root:wheel and mode is --x--x--x. Note that only stat(2) is affected by this
"view", and the owner/mode aren't effectively changed: it is just a "lie".
while here, refactor a bit pledge_namei() in order to avoid multiple for-loop
on whitelisted-path array.
ok deraadt@
deraadt [Tue, 20 Oct 2015 05:18:34 +0000 (05:18 +0000)]
allow SO_ERROR all the time
deraadt [Tue, 20 Oct 2015 04:34:12 +0000 (04:34 +0000)]
sync
mmcc [Tue, 20 Oct 2015 03:36:35 +0000 (03:36 +0000)]
Replace a function-local allocation with stack memory.
ok djm@
schwarze [Tue, 20 Oct 2015 02:00:49 +0000 (02:00 +0000)]
In order to become able to generate syntax tree nodes on the roff(7)
level, validation must be separated from parsing and rewinding.
This first big step moves calling of the mdoc(7) post_*() functions
out of the parser loop into their own mdoc_validate() pass, while
using a new mdoc_state() module to make syntax tree state handling
available to both the parser loop and the validation pass.
deraadt [Tue, 20 Oct 2015 01:44:00 +0000 (01:44 +0000)]
Always allow the setsockopt & getsockopt system calls... however, in the
default case only allows SOL_SOCKET SO_RCVBUF which is very common in
network-facing daemons. Many of them manage this on a socket after
dropping abilities which can get them _new_ sockets.. syslogd, bgpd,
relayd, etc etc. Other sockopts still require specific pledges.
Tested by bluhm.
deraadt [Mon, 19 Oct 2015 23:13:38 +0000 (23:13 +0000)]
Remove old tame() stub
yasuoka [Mon, 19 Oct 2015 22:07:37 +0000 (22:07 +0000)]
Add pledge(2) for radiusctl(8) and radiusd(8).
- radiusd: "stdio inet"
- radiusd_radius: "stdio inet"
- radiusd_bsdauth:
- "stdio proc" for the non-priviledged process
- "stdio getpw rpath proc exec" for the priviledged process
- radiusctl: "stdio dns inet"
"go ahead" deraadt
naddy [Mon, 19 Oct 2015 21:32:13 +0000 (21:32 +0000)]
break long lines in examples; ok jmc@
bluhm [Mon, 19 Oct 2015 20:16:09 +0000 (20:16 +0000)]
Test syslogd logging to a tty which belongs to a user. This is
done with a utmp entry for a pty fake login. All messages are read
from the pty and written into a log file.
schwarze [Mon, 19 Oct 2015 20:03:57 +0000 (20:03 +0000)]
style cleanup, no functional change
kettenis [Mon, 19 Oct 2015 19:54:35 +0000 (19:54 +0000)]
Enable some code that does power management magic.
schwarze [Mon, 19 Oct 2015 19:51:06 +0000 (19:51 +0000)]
Simplify, no functional change:
Delete the outmdoc, outman, and outfree function pointers.
kettenis [Mon, 19 Oct 2015 19:24:54 +0000 (19:24 +0000)]
Properly restore the prefetchable memory window upon resume.
ok deraadt@
krw [Mon, 19 Oct 2015 19:22:32 +0000 (19:22 +0000)]
Add parenthesis gcc wants and remove defined but unused label gcc
complains about.
ok deraadt@ on parethesis
schwarze [Mon, 19 Oct 2015 19:08:44 +0000 (19:08 +0000)]
Delete the empty example file "ftpchroot"; no example is needed.
Move the one useful bit of information contained in the file ("one
user name per line") to the ftpd(8) manual page where it belongs.
OK deraadt@ sthen@
krw [Mon, 19 Oct 2015 19:07:59 +0000 (19:07 +0000)]
LABELSECTOR is a DEV_BSIZE quantity. So multiply by DEV_BSIZE and not
d_secsize when calculating disklabel location.
ok jsing@
krw [Mon, 19 Oct 2015 19:05:24 +0000 (19:05 +0000)]
Nuke unused variable.
schwarze [Mon, 19 Oct 2015 18:58:20 +0000 (18:58 +0000)]
including <ohash.h> requires including <stdint.h> beforehand;
noticed by Svyatoslav Mishyn <juef at openmailbox dot org>
deraadt [Mon, 19 Oct 2015 18:53:35 +0000 (18:53 +0000)]
pledge "stdio exec proc" early on, setpriority, then pledge "stdio exec"
from Theo Buehler
beck [Mon, 19 Oct 2015 17:59:39 +0000 (17:59 +0000)]
free rbio before wbio
ok jsing@
tedu [Mon, 19 Oct 2015 17:24:07 +0000 (17:24 +0000)]
missing deref on char check. from David Binderman
mmcc [Mon, 19 Oct 2015 17:15:53 +0000 (17:15 +0000)]
Remove the define NOT, replace it with '!'. No binary change.
"The ^ is used in regular expressions and many versions of fnmatch(3)
accept both ! and ^. However, we are never going to accept ^ instead of
! so I think this makes sense" -millert@
"go for it" -nicm@
mmcc [Mon, 19 Oct 2015 17:10:53 +0000 (17:10 +0000)]
A little style(9) for sh.h includes
ok nicm@
beck [Mon, 19 Oct 2015 16:32:37 +0000 (16:32 +0000)]
Stop supporing "legcay" time formats that OpenSSL supports. Rewrite the
utctime and gentime wrappers accordingly. Along with some other cleanup.
this also removes the need for timegm.
ok bcook@ sthen@ jsing@
beck [Mon, 19 Oct 2015 16:29:22 +0000 (16:29 +0000)]
Change regress to not believe legacy times are valid
deraadt [Mon, 19 Oct 2015 16:20:56 +0000 (16:20 +0000)]
Allow setpriority in "proc" as well, since a few shells have "nice"
builtin. make a note that setpriority() should be weakened, unless "id"
is also present.
pointed out by Theo Buehler
mmcc [Mon, 19 Oct 2015 14:43:46 +0000 (14:43 +0000)]
Move stddef.h include from sh.h to the file that uses it.
ok nicm@
mmcc [Mon, 19 Oct 2015 14:42:16 +0000 (14:42 +0000)]
Move string.h include from sh.h to the files that use it.
ok nicm@
jsg [Mon, 19 Oct 2015 14:15:59 +0000 (14:15 +0000)]
fix memory leaks in error paths
ok renato@
mpi [Mon, 19 Oct 2015 14:05:01 +0000 (14:05 +0000)]
Revert transfer submission to r1.85. Seems to make okan@'s scanner
work properly.
mmcc [Mon, 19 Oct 2015 14:03:21 +0000 (14:03 +0000)]
Move limits.h include from sh.h to the files that actually need it. No
binary change.
ok nicm@
mmcc [Mon, 19 Oct 2015 14:01:37 +0000 (14:01 +0000)]
More removal of EXTERN.
ok nicm@
nicm [Mon, 19 Oct 2015 12:55:32 +0000 (12:55 +0000)]
Print vnode type for sendfd/recvfd not file type, ok semarie
mpi [Mon, 19 Oct 2015 12:11:28 +0000 (12:11 +0000)]
Stop checking for RTF_UP directly, call rtisvalid(9) instead.
While here add two missing ``rtableid'' checks in in6_selectsrc().
ok bluhm@
mpi [Mon, 19 Oct 2015 12:10:05 +0000 (12:10 +0000)]
Stop checking for RTF_UP directly, call rtisvalid(9) instead.
While here add a missing ``rtableid'' check in in_selectsrc().
ok bluhm@
mpi [Mon, 19 Oct 2015 12:02:11 +0000 (12:02 +0000)]
Sync rtisvalid(9) check for local route entries with r1.257 of
net/ip_input.c
mpi [Mon, 19 Oct 2015 11:59:26 +0000 (11:59 +0000)]
Remove superfluous NULL checks.
ifa are refcounted to ensure that rt_ifa is always valid.
jca [Mon, 19 Oct 2015 11:52:51 +0000 (11:52 +0000)]
optarg and optind are declared by unistd.h
jca [Mon, 19 Oct 2015 11:51:17 +0000 (11:51 +0000)]
Add err.h, missing after pledge() introduction.
reyk [Mon, 19 Oct 2015 11:27:35 +0000 (11:27 +0000)]
Fix control_imsg_forward() by changing imsg_compose() to
imsg_compose_event(). This was done by pyr@ in relayd/control.c
-r1.32 (2009/06/05, ok eric@) but somehow didn't slip into other
daemons that imported control.c.
reyk [Mon, 19 Oct 2015 11:25:35 +0000 (11:25 +0000)]
Remove the ikev1 stub - Since I started iked, it has an empty privsep
process for ISAKMP+IKEv1. I kept it to let somebody either contribute
the old protocol one day, I never intended to implement IKEv1 myself,
or to add a new kind of pipe to isakmpd to hand off IKEv1 messages.
As IKEv2 is widely supported by all major OS and networking vendors
now, I'm happy to scrap the idea of supporting ISAKMP+IKEv1. It is
still possible to use isakmpd for legacy VPNs.
OK mikeb@
yasuoka [Mon, 19 Oct 2015 09:47:37 +0000 (09:47 +0000)]
Remove a duplicated '#include <stdio.h>' line.
reyk [Mon, 19 Oct 2015 09:32:51 +0000 (09:32 +0000)]
Fix control_imsg_forward() by changing imsg_compose() to
imsg_compose_event(). This was done by pyr@'s in relayd/control.c
-r1.32 (2009/06/05, ok eric@) but somehow didn't slip into other
daemons that imported control.c.
reyk [Mon, 19 Oct 2015 09:17:23 +0000 (09:17 +0000)]
Print control socket client fd in debug message to differentiate between
control connections. Helps to debug problems.
sunil [Mon, 19 Oct 2015 09:15:35 +0000 (09:15 +0000)]
Kill whitespace at eol.
Ok gilles@
vgross [Mon, 19 Oct 2015 08:49:13 +0000 (08:49 +0000)]
deduplicate in[6]_pcbbind() port scan loop.
ok mpi@
yasuoka [Mon, 19 Oct 2015 07:58:28 +0000 (07:58 +0000)]
Avoid a NULL dereference when getgrnam_r() returns NULL for `result'.
dcoppa [Mon, 19 Oct 2015 07:55:31 +0000 (07:55 +0000)]
Update etc/mtree/BSD.x11.dist (freetype-2.6.1)
yasuoka [Mon, 19 Oct 2015 07:18:31 +0000 (07:18 +0000)]
Call tzset() before dropping the priviledge to use correct timezone.
yasuoka [Mon, 19 Oct 2015 06:56:58 +0000 (06:56 +0000)]
Can't assert "module->fd >= 0" in radiusd_stop() since the module may
be closed already when error.
jmatthew [Mon, 19 Oct 2015 05:31:25 +0000 (05:31 +0000)]
Move bge rxeof and txeof outside the kernel lock.
To make rxeof safe, use a separate ring refill timeout for each ring.
We activate the refill timeout for a ring when it's too empty to receive
packets, which ensures we won't attempt to refill it from interrupt context.
To make txeof safe, remove the list of dma maps and just allocate maps based on
the ring slots occupied by the packet, and use atomic operations to adjust
bge_txcnt. Rework some parts of the txeof and start loops so that we only
adjust bge_txcnt after exiting the loop, and only take actions such as setting
or clearing OACTIVE based on the final value.
tested on 5703, 5714, 5721 by me, 5753 by semarie@, 5761 by naddy@, and
also in snapshots for a while
ok mpi@, dlg@
mmcc [Mon, 19 Oct 2015 02:15:45 +0000 (02:15 +0000)]
Apply style(9) to header includes.
ok nicm@
guenther [Sun, 18 Oct 2015 23:27:43 +0000 (23:27 +0000)]
Need <string.h> for memset()
benno [Sun, 18 Oct 2015 22:37:30 +0000 (22:37 +0000)]
pledge bgplg(8).
ok deraadt
rpe [Sun, 18 Oct 2015 21:33:18 +0000 (21:33 +0000)]
Finish first round of rework of the rc script.
OK krw@ halex@
nicm [Sun, 18 Oct 2015 20:42:42 +0000 (20:42 +0000)]
Pass current directory as a string rather than a file descriptor because
pledge doesn't let us pass directory file descriptors.
uaa [Sun, 18 Oct 2015 20:24:10 +0000 (20:24 +0000)]
The change of 5.7's sys/arch/i386/i386/bus_space.c and
sys/arch/i386/include/bus.h invokes the kernel crash at boot
when ignored (disabled) channel is detected.
In all ATA controllers, ignored (disabled) channel is still set cp->hwok = 1.
And pciide_mapregs_native() is not called, wdc_cp->cmd_iot is 0.
5.6 and before, cmd_iot = 0 is treated as I386_BUS_SPACE_IO,
so there is no problem to call bus_space_read_1() in wdcintr().
5.7 and after, cmd_iot is used as function pointer.
We have to initialize it with pciide_mapregs_native() or something,
otherwise set cp->hwok = 0 to prevent calling wdcintr().
When ignored (disabled) channel is found, default_chip_map() should set
cp->hwok = 0. So all controllers do same thing.
ok by deraadt@
deraadt [Sun, 18 Oct 2015 20:15:10 +0000 (20:15 +0000)]
Instead of fragile CMSG parsing, control pledge "sendfd" and "recvfd"
in unp_internalize and unp_externalize.
ok kettenis guenther
guenther [Sun, 18 Oct 2015 19:30:39 +0000 (19:30 +0000)]
Pull in <float.h> instead of declaring __flt_rounds() locally
ok miod@ jsg@
jung [Sun, 18 Oct 2015 18:59:51 +0000 (18:59 +0000)]
fix lmtp delivery regressions introduced in previous:
- strip \r\n and add them explicitly to all DATA lines
- fix DATA termination
- add missing QUIT command (and check for reply)
- remove free() and fclose() and use exit(3) instead of _exit(2)
to handle cleanup
ok sunil gilles
mmcc [Sun, 18 Oct 2015 18:05:35 +0000 (18:05 +0000)]
Move more EXTERN-defined globals from sh.h.
ok nicm@
kettenis [Sun, 18 Oct 2015 18:00:45 +0000 (18:00 +0000)]
Backport another Broadwell fix from Linux 3.15
Ben Widawsky
drm/i915: Provide PDP updates via MMIO
e178f7057b81c87a7ceaae0ca204487b6f7eedcf
Doesn't make resume work, but at least it prevents the machine from hanging
and/or resetting.
miod [Sun, 18 Oct 2015 17:53:51 +0000 (17:53 +0000)]
Use "getpw" rather than "flock", per deraadt@'s suggestion.
tobias [Sun, 18 Oct 2015 17:32:22 +0000 (17:32 +0000)]
Avoid integer overflow with very large files.
ok millert
rpe [Sun, 18 Oct 2015 17:24:25 +0000 (17:24 +0000)]
Fix comments.
OK krw@
miod [Sun, 18 Oct 2015 17:20:49 +0000 (17:20 +0000)]
pledge+=flock, for /var/run/ypbind.lock. ok semarie@
millert [Sun, 18 Oct 2015 17:02:03 +0000 (17:02 +0000)]
Do not warn for sort -o if we can't chown the output temporary file
to match the owner of the output file.
bluhm [Sun, 18 Oct 2015 16:35:06 +0000 (16:35 +0000)]
Add "id" pledge to syslogd privsep process. Needed for logging to pipe.
OK deraadt@
jca [Sun, 18 Oct 2015 16:11:19 +0000 (16:11 +0000)]
Make use of pledge(2); initial diff from deraadt@
As Theo says, there's probably room for stricter pledge requests, but
this would involve refactoring.
deraadt [Sun, 18 Oct 2015 15:28:03 +0000 (15:28 +0000)]
actually, it uses getaddrinfo
deraadt [Sun, 18 Oct 2015 15:15:00 +0000 (15:15 +0000)]
libc DNS functions will now use the new dnssocket() / dnsconnect()
system calls. These signal to the pledge kernel code that a DNS
transaction is happening. These special sockets only work well with
port 53 (there are some cute plans...).
Programs calling pledge "inet" will not work! You need pledge "dns",
and of course, you need a fairly fresh kernel.
ok guenther kettenis tedu
jca [Sun, 18 Oct 2015 14:35:36 +0000 (14:35 +0000)]
Tweak previous: call fatal(), not err(3), for consistency. err.h goes away.
semarie [Sun, 18 Oct 2015 13:01:40 +0000 (13:01 +0000)]
regress pledge: test kill()
since "inet" has PLEDGE_SELF, and now calling kill() to self is permitted with PLEDGE_SELF, try this with "fattr"
semarie [Sun, 18 Oct 2015 12:54:25 +0000 (12:54 +0000)]
regress pledge: remove cmsg
it has no sens to keep it.
semarie [Sun, 18 Oct 2015 12:53:32 +0000 (12:53 +0000)]
regress pledge: cpath test
you need to read the directory before creating something in. add rpath
semarie [Sun, 18 Oct 2015 12:26:21 +0000 (12:26 +0000)]
regress pledge: cmsg is deprecated
semarie [Sun, 18 Oct 2015 12:25:33 +0000 (12:25 +0000)]
regress pledge: tweak a bit the manner to grab hte syscall number
permit debug string be present on the line
doug [Sun, 18 Oct 2015 11:27:17 +0000 (11:27 +0000)]
Need native-pledge for id.
guenther [Sun, 18 Oct 2015 08:02:58 +0000 (08:02 +0000)]
ld.so no longer needs or uses a bind lock, so stop setting it. This
eliminates a chunk of complexity from the libpthread init and the fork
wrapper, as it was the bind lock that needed prebinding before use.
jsg [Sun, 18 Oct 2015 07:09:44 +0000 (07:09 +0000)]
Tadpole/Sun Voyager IIi reported to work via dmesg@
semarie [Sun, 18 Oct 2015 05:26:55 +0000 (05:26 +0000)]
move SS_DNS socket check from kern_plegde.c to sys_generic.c
this check has nothing to do with pledge(2). make it lives in sys_ioctl() call.
while here, move the (fp == NULL) check early and remove duplicate check from
pledge_ioctl_check().
ok guenther@ deraadt@
guenther [Sun, 18 Oct 2015 05:03:22 +0000 (05:03 +0000)]
Use offsetof() instead of adding the sizes of the preceeding struct members
ok millert@
ajacoutot [Sun, 18 Oct 2015 04:45:21 +0000 (04:45 +0000)]
Make sure sm_rotate_bak() is only run once.
deraadt [Sun, 18 Oct 2015 04:21:39 +0000 (04:21 +0000)]
getting sloppy, lost a }
deraadt [Sun, 18 Oct 2015 04:18:41 +0000 (04:18 +0000)]
sorry, sdiff -o interactive mode does another spawn
deraadt [Sun, 18 Oct 2015 03:54:22 +0000 (03:54 +0000)]
Add "dns" to the pledges. Previously these worked because of "inet",
alas "dns" is now a mandatory statement if you want to do dns!
deraadt [Sun, 18 Oct 2015 03:51:11 +0000 (03:51 +0000)]
Forcibly delete /var/run/ypbind.lock to prepare for the worst cases.
ok aja
deraadt [Sun, 18 Oct 2015 03:41:14 +0000 (03:41 +0000)]
unrelated commit; not ready yet
deraadt [Sun, 18 Oct 2015 03:39:37 +0000 (03:39 +0000)]
First casualty of making pledge "dns" mandatory for dns users.
"dns" was missing, and this was relying on "inet" support..
deraadt [Sun, 18 Oct 2015 03:30:01 +0000 (03:30 +0000)]
Move your drink further away... When a program pledged "getpw" fails to
get a response from a YP server, it will open "/dev/tty" and spit out:
'YP server for domain %s not responding, still trying'
For now allow open of /dev/tty for "getpw". I hope to re-architect the
libc:YP communication protocol (strategy similar to syslog->sendsyslog,
isatty->fcntl, dnssocket/dnsconnect) and then we can reevaluate this.
deraadt [Sun, 18 Oct 2015 03:17:48 +0000 (03:17 +0000)]
after kmem is open and setup, pledge "stdio rpath wpath cpath"
seems to be working. commiting to get feedback from people who crash.
deraadt [Sun, 18 Oct 2015 03:13:07 +0000 (03:13 +0000)]
Collapse some strange programmer style with too much abstraction.
deraadt [Sun, 18 Oct 2015 03:09:11 +0000 (03:09 +0000)]
With TIOCSTI supported in pledge "tty proc", csh is good enough to run
with pledge "stdio rpath wpath cpath fattr getpw proc exec tty". (Note
that ksh "emacs mode" is also a abus^Wconsumer of TIOCSTI, but we had
let that slide for a week since noone uses it...)