Commit Graph

256845 Commits

Author SHA1 Message Date
chs 3084abc1e1 add DTRACE_OPTS and HOST_DTRACE_OPTS to allow disabling various optimizations
that interfere with using dtrace.  use them when MKDTRACE=yes.
2018-02-25 18:53:23 +00:00
chs 9f52f2295e remove hard-coded -fomit-frame-pointer for pthread stuff,
let these use the same setting as the rest of the tree.
the performance difference is marginal and this allows
dtrace ustack() to work better.
2018-02-25 18:51:18 +00:00
chs eec15c920c add some flag definitions from a newer version of FreeBSD's libproc
that are needed by the new dtrace.  these don't do anything yet,
but dtrace doesn't mind.  I'll do a full resync to the latest FreeBSD
libproc / librtld_db later.
2018-02-25 18:48:39 +00:00
uwe 5ff411e65c Use tagged list. 2018-02-25 17:45:40 +00:00
uwe a2bbeaadcd Flags are .Fl not .Ar 2018-02-25 17:37:05 +00:00
kamil b5d237a157 Document _UC_MACHINE_*() in ucontext(2)
Document:
 - _UC_MACHINE_SP()
 - _UC_MACHINE_FP()
 - _UC_MACHINE_PC()
 - _UC_MACHINE_INTRV()
 - _UC_MACHINE_SET_PC()

Document fragileness of the frame-pointer accessor.

Sponsored by <The NetBSD Foundation>
2018-02-25 16:53:51 +00:00
jdolecek 51cdc2d5b6 adjust KASSERT() triggered in PR port-cobalt/53054 to provide more info 2018-02-25 16:44:31 +00:00
christos 6f17b07f09 fix spello 2018-02-25 15:31:07 +00:00
kamil 16ed291475 Add new tests in lib/libc/sys/t_ucontext
New tests:
 - ucontext_sp
 - ucontext_fp
 - ucontext_pc
 - ucontext_intrv

They test respectively:
 - _UC_MACHINE_SP
 - _UC_MACHINE_FP
 - _UC_MACHINE_PC
 - _UC_MACHINE_INTRV

These tests attempt to access and print the values from ucontext, without
interpreting the values.

This is a follow up of the _UC_MACHINE_FP() introduction.

These tests use PRIxREGISTER, and require to be built with -D_KERNTYPES.

Sponsored by <The NetBSD Foundation>
2018-02-25 14:27:07 +00:00
maxv 3c99c64a1d Remove the first entry from the todo list, it's handled properly now. 2018-02-25 13:15:35 +00:00
maxv ccc038a88e Remove INTRENTRY_L, it's not used anymore. 2018-02-25 13:14:27 +00:00
maxv f6bdf0e58c Mmh. We shouldn't read %cr2 here. %cr2 is initialized by the CPU only
during page faults (T_PAGEFLT), so here we're reading a value that comes
from a previous page fault.

That's a real problem; if you launch an unprivileged process, set up a
signal handler, make it sleep 10 seconds, and trigger a T_ALIGNFLT fault,
you get in si_addr the address of another LWP's page - and perhaps this
can be used to defeat userland ASLR.

This bug has been there since 2003.
2018-02-25 13:09:33 +00:00
uwe d9a4227719 Use .Dl instead of .Bd -literal, fix vertical spacing. 2018-02-25 12:57:39 +00:00
kamil bc6d305e96 Register the x86/imcsmb man/cat/html page 2018-02-25 12:53:22 +00:00
uwe f8b4672497 .Po/.Pc are not appropriate for enclosing sentences. 2018-02-25 12:51:33 +00:00
uwe 5a14c3e55e Add FreeBSD 11.0 and 12.0 2018-02-25 12:46:49 +00:00
uwe 172e2d8237 Fix a typo. 2018-02-25 12:39:44 +00:00
maxv 5871e8d651 Fix handling of segment register faults when running with SVS. The behavior
is changed also in the non-SVS case.

I've put a documentation in amd64_trap.S. Basically, the problem with SVS
is that if iret faults, we already have a full trapframe pushed on the
stack and the CPU will push another frame on this stack (nested), but it
hits the redzone below the stack since it is still running with the user
page table loaded.

To fix that, we pop a good part of the trapframe earlier in intrfastexit.
If iret faults, the current %rsp has enough room for an iret frame, and
the CPU can push that without problem. We then switch back to the outer
iret frame (the frame the CPU was trying to pop by executing iret, but that
it didn't pop for real because iret faulted), call INTRENTRY, and handle
the trap as if it had been received from userland directly.
2018-02-25 12:37:16 +00:00
kamil fc4bdd88b3 Correct OpenSSL 1.1 entries in plist
Fix references to:
./usr/share/man/cat3/BIO_get_data.0
./usr/share/man/cat3/SSL_CONF_cmd.0

This is obserbable with the MKCATPAGES=yes build option.
2018-02-25 12:28:18 +00:00
maxv a26f6f08b3 Ah. Don't use NENTRY() to declare check_swapgs, use LABEL() instead. NENTRY
puts the code in the .text section, so the effect of TEXT_USER_BEGIN was
overwritten, and check_swapgs was not put in the .text.user section.

As a result kernels running SVS would crash when jumping here - because we
execute this place with the user page table loaded, and in this page table
only .text.user is mapped.

While here, rename check_swapgs -> kernuser_reenter, because we do more
things than just SWAPGS.
2018-02-25 11:57:44 +00:00
kamil b9c59384fe Remove ksem module reference
This does not exist in HEAD.

It looks like accidentally committed in:

Add new modules (for i386 and amd64 only) for the imcsmb SMBus driver.
src/sys/modules/Makefile r1.200
2018-02-25 10:17:12 +00:00
wiz 2eec357965 Fix xrefs, remove empty lines, fix RCS Id. 2018-02-25 10:04:04 +00:00
maxv bbd4780fe3 Replace %rax -> %rdi, so that check_swapgs clobbers only one register. 2018-02-25 08:28:55 +00:00
pgoyette 385290482f Ooops - forgot to add NetBSD License 2018-02-25 08:27:15 +00:00
skrll 41a65159c9 KNF 2018-02-25 08:24:36 +00:00
skrll 945e7fe4c5 Use correct MID_ value 2018-02-25 08:23:09 +00:00
pgoyette 41f0512382 Add the man page for new imcsmb driver 2018-02-25 08:22:53 +00:00
pgoyette 2d5aed5404 Update for newly added imcsmb driver modules. 2018-02-25 08:21:57 +00:00
pgoyette e51164ac34 Add new modules (for i386 and amd64 only) for the imcsmb SMBus driver. 2018-02-25 08:20:28 +00:00
pgoyette cbf9e83cc4 Import imcsmb driver from FreeBSD. This driver allows access to the
SMBus controllers which are part of the integrated memory controllers
on certain modern Intel CPUs.  These SMBus are attached only to the
memory DIMMs, so we provide only a minimum amount of functionality.

Deliberately not included in GENERIC, as on some motherboards there
can be conflicting access between the driver and the motherboard.  The
motherboards generally will provide a mechanism to synchronize access,
but the methods are likely proprietary;  the driver provides a place
for inserting user-provided synchronization.
2018-02-25 08:19:34 +00:00
maxv 2de8e9c17a There are two places where we reload %gs:
* In setusergs. Here we can't fault. So we don't need to handle this
   case.

 * In intrfastexit for 32bit processes. This case needs to be handled,
   and we already have a label.

So use the label instead of disassembling %rip.
2018-02-25 08:09:07 +00:00
mrg 924dadf563 fix some types of netbsd arm builds. 2018-02-25 01:05:09 +00:00
mrg b63cf4b769 add a special rule to build m68k/fpu.c to avoid passing -msoft-float.
fixes GCC 6 kernel builds that use this file.
2018-02-25 00:27:16 +00:00
mrg 2e19323388 add LIBKRB5_LDADD/LIBKRB5_DPADD and their static counterparts
to bsd.prog.mk.  use them instead of hard coding various lists
of libraries for krb5.

this fixes static builds.
2018-02-25 00:16:48 +00:00
christos 1bfb3e3818 dedup 2018-02-24 21:51:22 +00:00
christos 34c1b54ff7 we don't yet have __atomic_is_lock_free 2018-02-24 21:47:34 +00:00
christos 6462075721 fix sparc. 2018-02-24 21:45:57 +00:00
christos 96c8300010 add the right assembler flags for the two new files. 2018-02-24 20:23:58 +00:00
maxv 9fd7163ce9 Fix one thing in the documentation, I meant to say only SVS_UTLS. 2018-02-24 19:52:46 +00:00
sevan bcdb0608f9 Remove legacy comment regarding the instability of awacs(4)
Enable awacs(4), skipping MAMBO config as it is for an emulator.

From <macallan>
"that warning about the awacs driver making some
machines lock up can probably go. It's ancient and I've never seen it
actually happen, I have several oldish macs with different awacs
variants and it's enabled in all my configs. In fact it predates my
macppc interrupt cleanup ( I think I did that in 2005 or so ) and I
strongly suspect that fixed the problem.
( the ancient code didn't properly distinguish between edge and level
triggered interrupts on grand central / heathrow type hardware, IIRC it
always just checked the level register(s) which resulted in edge
triggered interrupts being missed or misdetected. Most of the mac-io
goop from that time uses edge triggered interrupts, which includes
awacs )

If this actually happens to anyone I'd like to know about it"
2018-02-24 18:58:00 +00:00
maxv 46f5472cb5 Use %rax instead of %r15 in the non-SVS case, to reduce the diff against
SVS. In SVS we use %rax instead of %r15 because the following instructions
cannot be encoded:

	movq	%r15,SVS_UTLS+UTLS_SCRATCH
	movq	SVS_UTLS+UTLS_RSP0,%r15
2018-02-24 17:12:10 +00:00
mlelstv 9a0e12e05f Regen. 2018-02-24 14:06:27 +00:00
mlelstv d981ae536b Add AMD KERNCZ chipset for Zen processors. 2018-02-24 14:05:46 +00:00
maxv d0f578163a Document SVS. Also, remove an entry from the todo list. 2018-02-24 10:31:30 +00:00
ozaki-r daf303d013 Avoid a race condition of DAD timer destructions
When we see dp->dad_ifa == NULL, it means that the ifa is being deleted and also
the callout is scheduled again by someone.  We shouldn't rely on a result of
callout_pending to know if the callout is scheduled because it returns false if
the subsequent callout handler is already on the fly.

We have to always delegate the destruction of dp to the subsequent handler
unconditionally if dp->dad_ifa == NULL. Otherwise, the first handler destroys
the dp and the second handler tries to handle destroyed dp.
2018-02-24 07:53:15 +00:00
ozaki-r ebc34b07ac Simplify; pass dp to nd6_dad_duplicated instead of looking it up again in it 2018-02-24 07:40:40 +00:00
ozaki-r 588831e435 Use KASSERT for checking a programming error 2018-02-24 07:38:05 +00:00
ozaki-r ef58cf2ca2 Avoid a deadlock between softnet_lock and IFNET_LOCK
A deadlock occurs because there is a violation of the rule of lock ordering;
softnet_lock is held with hodling IFNET_LOCK, which violates the rule.
To avoid the deadlock, replace softnet_lock in in_control and in6_control
with KERNEL_LOCK.

We also need to add some KERNEL_LOCKs to protect the network stack surely.
This is required, for example, for PR kern/51356.

Fix PR kern/53043
2018-02-24 07:37:08 +00:00
skrll 366599d113 Switch hppa to gcc 6.4 2018-02-23 21:16:01 +00:00
maxv fb601e36f3 Fix off-by-one, we don't want the entry point to equal the maximum
address.
2018-02-23 19:43:08 +00:00