Commit Graph

246109 Commits

Author SHA1 Message Date
jhb
dd16f28153 Only clear a pending thread event if one is pending.
This fixes a panic when attaching to an already-stopped process after
r325028.  While here, clean up a few other things in the control flow
of the 'sendsig' section:
- Only check for P_STOPPED_TRACE rather than either of P_STOPPED_SIG
  or P_STOPPED_TRACE for most ptrace requests.  The signal handling
  code in kern_sig.c never sets just P_STOPPED_SIG for a traced
  process, so if P_STOPPED_SIG is stopped, P_STOPPED_TRACE should be
  set anyway.  Remove a related debug printf.  Assuming P_STOPPED_TRACE
  permits simplifications in the 'sendsig:' block.
- Move the block to clear the pending thread state up into a new
  block conditional on P_STOPPED_TRACE and handle delivering pending
  signals to the reporting thread and clearing the reporting thread's
  state in this block.
- Consolidate case to send a signal to the process in a single case
  for PT_ATTACH.  The only case that could have been in the else before
  was a PT_ATTACH where P_STOPPED_SIG was not set, so both instances
  of kern_psignal() collapse down to just PT_ATTACH.

Reported by:	pho, mmel
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D12837
2017-11-13 19:58:58 +00:00
arichardson
37d9f9afaa Remove -fuse-ld= when creating _LDFLAGS from LDFLAGS
The -fuse-ld flag is only meant to be passed to the compiler driver so
direct linker invocations should not include it.

Reviewed by:	emaste, jhb
Approved by:	jhb (mentor)
Differential Revision:	https://reviews.freebsd.org/D12910
2017-11-13 19:44:33 +00:00
gjb
fda85a2a94 Update the GUMSTIX image build to use arm/arm TARGET/TARGET_ARCH.
Update the TARGET/TARGET_ARCH matching in release/release.sh and
release/Makefile.mirrors for simplification.

Discussed with:	mmel
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2017-11-13 19:31:51 +00:00
manu
46978620bb arm: rpi2: Fix cpufreq(4)
Since r324184 the root node compatible for rpi2 is "brcm,bcm2836", add
it to the compatible list of bcm2835_cpufreq.

Tested On: RPI2 v1.1 RPI2 v1.2

Reported by:	many on freebsd-arm@
2017-11-13 18:53:41 +00:00
hselasky
160a26a6fa Properly handle the case where the linux_cdev_handle_insert() function
in the LinuxKPI returns NULL. This happens when the VM area's private
data handle already exists and could cause a so-called NULL pointer
dereferencing issue prior to this fix.

Found by:	greg@unrelenting.technology
MFC after:	1 week
Sponsored by:	Mellanox Technologies
2017-11-13 18:16:26 +00:00
vangyzen
83a341a5aa Fix formatting of _umtx_op(2)
Do not use macros in the -width of a .Bl, since mandoc does not support them.

Fix issues reported by igor and mandoc -Tlint.

Use a .Bl for list of clock IDs instead of a comma list.

MFC after:	3 days
Sponsored by:	Dell EMC
2017-11-13 17:46:38 +00:00
imp
b70c8be094 Add notes about overlapping copies.
Add notes to each of these that specifically state that results are
undefined if the strings overlap. In the case of memcpy, we document
the overlapping behavior on FreeBSD (pre-existing). For str*, it is
left unspecified, however, since the default (and x86) implementations
do not handle overlapping strings properly.

PR: 223653
Sponsored by: Netflix
2017-11-13 17:04:44 +00:00
vangyzen
e89d381ee1 Add __BEGIN_DECLS and __END_DECLS to <sys/umtx.h>
This allows C++ programs to call _umtx_op().

MFC after:	3 days
Sponsored by:	Dell EMC
2017-11-13 16:53:36 +00:00
kib
bb9ce4f821 Do not leak PMC_PO_OWNS_LOGFILE on error.
Note that PMCLOG_RESERVE_WITH_ERROR() macro contains goto error;
statement and executed after the flag is set.

Reported and tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2017-11-13 10:45:31 +00:00
kib
6f8de9c7ee Style bug.
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2017-11-13 10:43:31 +00:00
delphij
62fdd4ef88 Be more careful when doing calculation with request from userland.
MFC after:	2 weeks
2017-11-13 07:47:43 +00:00
imp
60dfbe416a Document MACHINE, MACHINE_ARCH, CPUTYPE, TARGET and TARGET_ARCH
historical use and general philosphy.

Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D12981
2017-11-13 00:32:44 +00:00
imp
731eded035 Use proper include file. While <boot/userboot/userboot.h> works, it
only works because we have -Isys on the command line. We also have
-Isys/boot/userboot on the command line, so bring it in directly with
<userboot.h>. No functional change, but it removes one hard to see
dependency on the boot loader's location in sys/boot.

Sponsored by: Netflix
2017-11-13 00:30:38 +00:00
br
ba3ffebf37 Add Intel Processor Trace (PT) MSRs.
Sponsored by:	DARPA, AFRL
2017-11-12 23:13:04 +00:00
tuexen
03175f1fb8 Cleanup the handling of control chunks. While there fix some minor
bug related to clearing the assoc retransmit counter and the dup TSN
handling of NR-SACK chunks.

MFC after:	3 days
2017-11-12 21:43:33 +00:00
emaste
7618e84142 boot1: also check for NULL device
r325681 fixed a NULL pointer dereference on RPi3 caused by a lack of
functionality in uboot's EFI implementation.  That rev checked the boot1
load path for NULL but not the load device.  In practice if the former
works the latter will as well, but improve correctness by checking each
separately.

Submitted by:	Keith White <kwhite@eecs.uottawa.ca>
Reported by:	jhb
MFC after:	5 days
MFC with:	r325681
Sponsored by:	The FreeBSD Foundation
2017-11-12 17:15:54 +00:00
imp
3f53028c4a Make sure the proper loader.rc gets installed.
There were two things wrong. First, the wrong path was listed in .PATH
statement. Second, BOOTSRC wasn't yet defined for the .PATH, so it
didn't properly add it. Third, even if these were right, . was in the
path before, so it wouldn't have worked. Replace this with a simple
loop so the proper loader.rc gets selected.

Noticed by: dhw@ (menus stopped working on boot)
Sponsored by: Netflix
2017-11-12 17:10:57 +00:00
bapt
a9a87e19a8 Stop installing eqnchar which has been removed
Pointyhat to:	bapt
2017-11-12 09:42:42 +00:00
oshogbo
799ff1d3f3 dhclient(8) should not close stdio using daemon(3) function.
dhclient(8) is chrooted so opening /dev/null always will fail.
In capability world this is also annoying because we getting error that
open(2) is not permitted in Capsicum. dhclient(8) is closing stdio by
precaching fd to /dev/null before chroot.
This is done few lines below daemon(3) function so let's not try to do that
in daemon(3) function.

Reviewed by:	cem@
Differential Revision:	https://reviews.freebsd.org/D12826
2017-11-12 08:54:23 +00:00
oshogbo
90ae5f55e7 Use syslog service in dhclient(8).
dhclient(8) is failing during boot to connect to the syslog service, because
syslog daemon is started after dhclient(8). This can be reproduced by stooping
syslog daemon and ktrace the dhclient or use kern.trap_enotcap sysctl and boot
the machine. Using the Casper syslog service fix the problem.

Reviewed by:	bapt@
Differential Revision:	https://reviews.freebsd.org/D12825
2017-11-12 08:42:43 +00:00
oshogbo
321aa05b3b Introduce syslog service for Casper.
syslog in libc secretly reconnects to the daemon.
Another issue is that we don't have any information from openlog(3) if we
succeeded to open log or not so we don't know if we are ready
to enter cabability mode.
Because all of that we decided we need a syslog service for Caspser.

Reviewed by:	bapt@
Differential Revision:	https://reviews.freebsd.org/D12824
2017-11-12 08:34:25 +00:00
bapt
c5328450e6 Remove the special character definitions files for eqn(1)
This files hasn't been used since groff(1) was introduced in base 23 years ago.
2017-11-12 08:31:17 +00:00
bapt
2642f0b4d5 Update to 2017.10.21
MFC after:	3 days
2017-11-12 08:00:57 +00:00
oshogbo
fff97aa66a We return a pointer when we are using cap_init() or cap_service_open()
function, so check if cap_chanel_t is NULL is not enough.
Casper with a normal libc will still fail in capability mote so let's not
enter capability mode without casper support when we need to resolve DNS.

Reviewed by:	cem
Differential Revision:	https://reviews.freebsd.org/D12823
2017-11-12 07:18:10 +00:00
will
d1f8082780 libkvm: fix lib32 build. 2017-11-12 03:28:47 +00:00
mjg
3552994d2f amd64: stop nesting preemption counter in spinlock_enter
Discussed with:	jhb
2017-11-12 03:13:01 +00:00
mjg
b77ed9cba6 Use passed thread pointer instead of curthread in sys_sched_yield
No functional changes.
2017-11-12 02:34:33 +00:00
will
0152cb948f libkvm: fix build failures 2017-11-12 01:36:48 +00:00
will
1e2c7368f6 libkvm: fix 'index' shadowing. 2017-11-12 00:00:38 +00:00
will
3ba444b8c8 libkvm: add kvm_walk_pages API.
This API allows callers to enumerate all known pages, including any
direct map & kernel map virtual addresses, physical addresses, size,
offset into the core, & protection configured.

For architectures that support direct map addresses, also generate pages
for any direct map only addresses that are not associated with kernel
map addresses.

Fix page size portability issue left behind from previous kvm page table
lookup interface.

Reviewed by:	jhb
Sponsored by:	Backtrace I/O
Differential Revision:	https://reviews.freebsd.org/D12279
2017-11-11 23:30:58 +00:00
robak
746101149f bhyve: avoid applying capsicum capabilities to file that was not opened
When using -l option targeting file that can't be opened (ie. nmdm module
is not loaded and /dev/nmdm* is specified) bhyve tries to apply capsicum
capabilities to a file that was not opened.

Enclose that code in an if statement and only run it on correctly opened
descriptor also providing meaningful message in case of an error.

Submitted by:	Pawel Biernacki <pawel.biernacki@gmail.com>
Reviewed by:	grehan, emaste
Sponsoied by:	Mysterious Code Ltd.
Differential Revision:	D12985
2017-11-11 22:50:14 +00:00
mjg
1e871cdd86 Avoid locking and refing in sysctl_kern_proc_args if possible.
Turns out the sysctl is called a lot e.g. by pkg-static.
2017-11-11 22:39:33 +00:00
mjg
524a7f5fe0 sysctl: try to avoid malloc in name2oid
name2oid is called all the time and passed names are almost always very short
(< 16 characters).
2017-11-11 21:50:36 +00:00
hselasky
01a8046591 Implement missing KDGETMODE IOCTL in VT.
Obtained from:	Johannes Lundberg <yohanesu75@gmail.com>
Sponsored by:	Mellanox Technologies
MFC after:	1 week
2017-11-11 20:12:48 +00:00
delphij
7c06f090ee find(1): Don't treat statfs() error as fatal in f_fstype, which can happen
when a directory is removed in the middle of find.

Instead of a full err(), allow find to continue, plus print a warning with
exitstatus set when appropriate.

Reported by:	100.chksetuid via gordon
Reviewed by:	jilles
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D13024
2017-11-11 19:18:47 +00:00
mjg
cbe24d82fa Use pfind_any in linux_rt_sigqueueinfo and kern_sigqueue 2017-11-11 18:10:09 +00:00
mjg
2127391bd8 Add pfind_any
It looks for both regular and zombie processes. This avoids allproc relocking
previously seen with pfind -> zpfind calls.
2017-11-11 18:04:39 +00:00
mjg
15a19385fd Avoid allproc lock in pfind if curproc->pid == pid 2017-11-11 18:03:26 +00:00
mjg
3aa5eba714 Remove useless proc lookup from sysctl_out_proc 2017-11-11 18:02:23 +00:00
imp
2deab8647a Fix typo in filename.
Noticed by: Shawn Webb
2017-11-11 16:09:20 +00:00
bapt
4aa4e45a7a Remove __unused attributed on arguments that are actually used
MFC after:	3 days
2017-11-11 15:18:25 +00:00
bapt
51aef4df21 Fix some nroff style issue
MFC after:	3 days
2017-11-11 14:39:13 +00:00
allanjude
6eb85a3d98 vmstat: fix duplicate key in libxo output
In the libxo output from vmstat, the number of pages that have been
paged out uses the same key name as the number of times pages have been
paged. Appears to have been a typo or copy-pasto.

PR:		222198
Submitted by:	Yavuz Tanriverdi <stemix@gmail.com>
Reviewed by:	phil, garga
Differential Revision:	https://reviews.freebsd.org/D12395
2017-11-11 14:02:21 +00:00
bapt
a895f9f0a3 Follow up on zstd update 2017-11-11 13:57:30 +00:00
bapt
41e12ee91f Update to zstd 1.3.2 2017-11-11 13:54:37 +00:00
hselasky
757e3c2aff Remove release and acquire semantics when accessing the "state" field of the
LinuxKPI task struct. Change type of "state" variable from "int" to
"atomic_t" to simplify code and avoid unneccessary casting.

MFC after:	1 week
Sponsored by:	Mellanox Technologies
2017-11-11 11:01:50 +00:00
hselasky
3cbfbde84e Mask away return codes from del_timer() and del_timer_sync() because
they are not the same like in Linux.

MFC after:	1 week
Sponsored by:	Mellanox Technologies
2017-11-11 10:46:12 +00:00
mjg
41984bdd76 rwlock: use fcmpset for setting RW_LOCK_WRITE_SPINNER 2017-11-11 09:34:11 +00:00
eadler
dd7fc76e27 secure: chase removal of pkg_install 2017-11-11 07:21:49 +00:00
eadler
8a99a343ec Chase removal of pkg_* commands 2017-11-11 07:20:14 +00:00