Displaying 1 50 of 262,148 commits (0.049s)

HardenedBSD — sys/dev/bhnd/cores/chipc chipc.c

bhnd_chipc(4): Fix leak of child device ivars by explicitly deleting
any children prior to detach.

With the newbus child deletion ordering changes introduced in r307518,
parent devices are now detached (and their driver set to NULL) prior to
detaching and deleting child devices; child-related bus methods (e.g.
BUS_CHILD_DETACHED, BUS_CHILD_DELETED) are no longer be dispatched to the
parent device driver after it returns 0 (success) from DEVICE_DETACH.

Sponsored by:   The FreeBSD Foundation
Delta File
+3 -0 sys/dev/bhnd/cores/chipc/chipc.c
+3 -0 1 file

HardenedBSD — usr.bin/limits limits.1

MFC r327946 r327947:

limits(1): fix grammar

PR:           225147
Delta File
+3 -3 usr.bin/limits/limits.1
+3 -3 1 file

HardenedBSD — sys/dev/bwn if_bwn_pci.c

bwn(4): Add missing BCM4306 PCI IDs.

Sponsored by:        The FreeBSD Foundation
Delta File
+3 -0 sys/dev/bwn/if_bwn_pci.c
+3 -0 1 file

HardenedBSD — sys/dev/bwn if_bwn_siba_compat.c

bwn(4): Fix DMA translation lookup on devices limited to 30-bit host
addressing. The host addressing constraint does not apply to device address
space, and shouldn't be passed to bhnd_get_dma_translation() as the
maximum supported device address width.

Sponsored by:        The FreeBSD Foundation
Delta File
+29 -8 sys/dev/bwn/if_bwn_siba_compat.c
+29 -8 1 file

HardenedBSD — sys/dev/bhnd/bhndb bhndb_pci.c

bhndb_pci(4): Implement bridge support for CardBus-attached devices.

 - Extend the probe method to accept devclasses that inherit from the pci
   devclass (e.g. cardbus).
 - Some BCM4306-based CardBus adapters appear to advertise 4K SPROM, but
   only the first 2K is mapped into BAR0. We can safely assume that the
   SPROM data fits within the first 2K of the SPROM, rather than rejecting
   the SPROM mapping as invalid.

Sponsored by:        The FreeBSD Foundation
Delta File
+19 -10 sys/dev/bhnd/bhndb/bhndb_pci.c
+19 -10 1 file

HardenedBSD — sys/powerpc/aim trap_subr64.S

On AIM systems without a software-managed SLB, such as POWER9 systems using
either hardware segment tables or radix-tree-based page tables, do not try
to install SLB entries at trap boundaries.
Delta File
+9 -0 sys/powerpc/aim/trap_subr64.S
+9 -0 1 file

HardenedBSD — sys/arm/include vmparam.h, sys/compat/linuxkpi/common/src linux_page.c

Define PHYS_TO_DMAP() and DMAP_TO_PHYS() as panics on the architectures
(i386 and arm) that never implement them. This allows the removal of
#ifdef PHYS_TO_DMAP on code otherwise protected by a runtime check on
PMAP_HAS_DMAP. It also fixes the build on ARM and i386 after I forgot an
#ifdef in r328168.

Reported by:        Milan Obuch
Pointy hat to:        me

HardenedBSD — sys/amd64/amd64 exception.S trap.c, sys/amd64/include asmacros.h pcpu.h

PTI: Trap if we returned to userspace with kernel (full) page table
still active.

Map userspace portion of VA in the PTI kernel-mode page table as
non-executable. This way, if we ever miss reloading ucr3 into %cr3 on
the return to usermode, the process traps instead of executing in
potentially vulnerable setup.  Catch the condition of such trap and
verify user-mode %cr3, which is saved by page fault handler.

I peek this trick in some article about Linux implementation.

Reviewed by:        alc, markj (previous version)
Sponsored by:        The FreeBSD Foundation
MFC after:        12 days
DIfferential revision:        https://reviews.freebsd.org/D13956

HardenedBSD — sys/dev/bhnd/cores/chipc/pwrctl bhnd_pwrctl.c, sys/dev/bhnd/siba siba.c

bhnd(4): fix a few bugs in pwrctl/fixed-clock device support.

 - Do not panic on siba(4) detach when the bhnd(4) bus calls
   bhnd_get_pmu_info() on a PMU-less device.
 - Fix bhnd_pwrctl attach/detach on fixed-clock devices:
    - Treat bhnd_pwrctl_updateclk() as a no-op on fixed-clock devices.
    - Use bhnd_pwrctl_updateclk() to perform the appropriate clock
      transition on detach.

Sponsored by:        The FreeBSD Foundation

HardenedBSD — sys/dev/bhnd/cores/chipc chipc.c

bhnd_chipc(4): Fix the assignment of non-wildcard child unit numbers
introduced in r326102 and r326109; all chipc children should be added with
a wildcard unit (-1).

Sponsored by:        The FreeBSD Foundation
Delta File
+3 -3 sys/dev/bhnd/cores/chipc/chipc.c
+3 -3 1 file

HardenedBSD — usr.bin/dtc fdt.cc dtc.1

dtc(1): Update to upstream ea3c233

Highlights of this update:
- /__local_fixups__ is now generated to be GPL dtc and libfdt compliant
- Compiling with -@ will now cause dtc to assign phandles to all labelled
  nodes
- /include/ and /incbin/ now handle absolute paths correctly
- The manpage now has information about overlays, including how to apply
  them and how to generate them
- Syntactic sugar for overlays is now supported, allowing an overlay DTS
  like:

=
/dts-v1/;
/plugin/;

&foo {
    foo,status = "okay";
};
=

to generate a fragment targetting <&foo>.

HardenedBSD — contrib/bsnmp/snmpd action.c main.c

Rename "index" variable to "idx" since gcc complains that it shadows
index(3) function declaration.

Reported by:        lwhsu
MFC after:        2 weeks

HardenedBSD — sys/amd64/amd64 pmap.c, sys/x86/x86 identcpu.c

HBSD: enable PTI by default, when option PAX specified

This is a follow up commit to 1cf1c6c06d2f9cc2a208d17d610064cbc621e01a
and 25b11e7bcfb13d7e8f24148af7374769e25166da .

Suggested-by: noptrix
Signed-off-by: Oliver Pinter <oliver.pinter at hardenedbsd.org>

HardenedBSD — sys/dev/aac aac.c

MFC r323317 (by scottl): Move the intrhook release to later in the function
so that GEOM knows to wait longer for possible root devices to come online.
This fixes a race that seems to be triggered by EARLY_AP_STARTUP.

Submitted by:        cgull at glup.org
Delta File
+5 -5 sys/dev/aac/aac.c
+5 -5 1 file

HardenedBSD — contrib/bsnmp/snmpd main.c action.c

Add to bsnmpd(1) ability to specify multiple community strings with
different access rights.

By default there are two community strings with index 1 and 2, one for
read-only access and second for read-write access:

  begemotSnmpdCommunityString.0.1 = $(read)
  begemotSnmpdCommunityString.0.2 = $(write)

Now it is possible to define additional community strings using different
indexes:

  begemotSnmpdCommunityString.0.3 = "SomeString1"
  begemotSnmpdCommunityPermission.0.3 = 1
  begemotSnmpdCommunityString.0.4 = "SomeString2"
  begemotSnmpdCommunityPermission.0.4 = 2
  begemotSnmpdCommunityString.0.5 = "SomeString3"
  begemotSnmpdCommunityString.0.6 = "SomeString4"

New attribute begemotSnmpdCommunityPermission can be used to specify access
rights: 1 means "read-only" access, 2 means "read-write" access. If
attribute is not specified for some index this means "read-only" rights.

Community strings must be unique, i.e. must not be the same for different
indexes.

    [5 lines not shown]

HardenedBSD — sys/modules Makefile

Unbreak i386 build

The logical result of a right shift >= the width of a type is zero, but our
compiler decides this is a warning (and thus, error).  Just remove ccp(4)
from i386.

Reported by:        cy
Sponsored by:        Dell EMC Isilon
Delta File
+1 -1 sys/modules/Makefile
+1 -1 1 file

HardenedBSD — gnu/usr.bin/gdb/kgdb trgt_amd64.c

Recognize mchk_calltrap as a trapframe generator.

Should have been included in r328157.
Delta File
+1 -0 gnu/usr.bin/gdb/kgdb/trgt_amd64.c
+1 -0 1 file

HardenedBSD — sys/amd64/amd64 exception.S machdep.c, sys/amd64/include intr_machdep.h

Use a dedicated per-CPU stack for machine check exceptions.

Similar to NMIs, machine check exceptions can fire at any time and are
not masked by IF.  This means that machine checks can fire when the
kstack is too deep to hold a trap frame, or at critical sections in
trap handlers when a user %gs is used with a kernel %cs.  Use the same
strategy used for NMIs of using a dedicated per-CPU stack configured
in IST 3.  Store the CPU's pcpu pointer at the stop of the stack so
that the machine check handler can reliably find the proper value for
%gs (also borrowed from NMIs).

This should also fix a similar issue with PTI with a MC# occurring
while the CPU is executing on the trampoline stack.

While here, bypass trap() entirely and just call mca_intr().  This
avoids a bogus call to kdb_reenter() (there's no reason to try to
reenter kdb if a MC# is raised).

Reviewed by:        kib
Tested by:        avg (on AMD without PTI)
Differential Revision:        https://reviews.freebsd.org/D13962

HardenedBSD — stand/arm/uboot ldscript.arm, stand/efi/loader/arch/arm ldscript.arm

stand: Move sections around to fix stand/ build with ld.lld on armv7

When building loader bits, lld fails with the following error:
"ld: error: section: .dynamic is not contiguous with other relro sections"
on both ubldr and EFI loader.

Move .dynamic up to make ld.lld happy, adjust .got as necessary for ubldr.

Tested on:        OrangePi One (ld.lld, ubldr)
Tested on:        Banana Pi-M3 (ld.lld, ubldr)
Tested on:        qemu-armv7 (ld.lld, EFI)
Tested on:        qemu-armv7 (ld.bfd, EFI)
Tested on:        Raspberry Pi 2 (ld.bfd, ubldr) [manu]
Tested on:        Banana Pi-M2 (ld.bfd, ubldr) [manu]
Reviewed by:        andrew, emaste, imp
Differential Revision:        https://reviews.freebsd.org/D13942

HardenedBSD — share/man/man9 style.9

No need for the zero width space now that I put the comma in.
Delta File
+2 -2 share/man/man9/style.9
+2 -2 1 file

HardenedBSD — share/man/man9 style.9

Make igor happier with this file:
o Don't use contractions.
o Add common after e.g. where needed
Delta File
+7 -7 share/man/man9/style.9
+7 -7 1 file

HardenedBSD — sys/amd64/amd64 exception.S

Remove two no-longer-used labels from the NMI interrupt handler.

Reviewed by:        kib
Delta File
+1 -3 sys/amd64/amd64/exception.S
+1 -3 1 file

HardenedBSD — lib/libc/regex engine.c

MFC r322288: regex(3): Refactor fast/slow stepping bits in matching engine

Adding features for matching is fairly straightforward, but this requires
some duplication because of this fast/slow setup. They can be fairly
trivially combined into a single walk(), so do it to make future additions
less error prone.
Delta File
+50 -142 lib/libc/regex/engine.c
+50 -142 1 file

HardenedBSD — lib/libc/regex regcomp.c regex2.h

MFC r320742, r320750, r320796: Refactor regex(3) for maintainability

MFC r320742:
The impending libregex will implement GNU extensions to bring BREs and
EREs closer together. Prepare for this and reduce the diff of libregex
changes by refactoring and combining the top-level parsers for EREs/BREs
ahead of time.

Branching functionality has been split out to make it easier to follow the
combined version of the top-level parser. It may also be enabled in the
parsing context to make it easier when libregex enables branching for BREs.

A branching context was also added for the various branching functions and
so that BREs, for instance, can determine if they're the first expression in
a chain of expressions within the current branch and treat '*' as ordinary
if so.

This should have no functional impact and negligible performance impact.

MFC r320750: Fix sparc64 libc build after r320742.

p_branch_empty was declared but never used due to an oversight. Use it as
designed, further comment on its return value.

MFC r320796:

    [7 lines not shown]
Delta File
+231 -92 lib/libc/regex/regcomp.c
+1 -0 lib/libc/regex/regex2.h
+232 -92 2 files

HardenedBSD — usr.bin/hexdump display.c

MFC r327567: hexdump(1): Speed up -s flag on devices

Using the -s flag on devices is extraordinarily slow due to using fseek(3) a
little too conservatively. Address this by using fseek on character/block
devices as well, falling back to getchar(3) only if we fail to seek or we're
operating on tape drives, where fseek may succeed while not actually being
supported.

PR:                86485
Delta File
+35 -11 usr.bin/hexdump/display.c
+35 -11 1 file

HardenedBSD — usr.bin/patch patch.c

MFC r326084: patch(1): don't assume match if we run out of context to check

Patches with very little context (-U0 and -U1) could get misapplied if
the file to be patched changes and a hunk is no longer applicable. Matching
with fuzz would be attempted and default to a match when we unexpectedly ran
out of context.

This also affected patches with higher levels of context but had limited
actual context due to the hunk being located near the beginning/end of file.

PR:                74127
Delta File
+3 -0 usr.bin/patch/patch.c
+3 -0 1 file

HardenedBSD — usr.bin/patch pch.c

MFC r324431: patch(1): Don't overrun line buffer in some cases

Patches like file.txt attached to PR 190195 with a final line formed
like ">(EOL)" could cause a copy past the end of the current line buffer. In
the case of PR 191641, this caused a duplicate line to be copied into the
resulting file.

Instead of running past the end, treat it as if it were a blank line.

PR:                191641
Delta File
+6 -1 usr.bin/patch/pch.c
+6 -1 1 file

HardenedBSD — lib/libusb libusb10_desc.c libusb.h

MFC r322322: Expose device caps as libusb_bos_descriptor::dev_capability

Some libusb consumers in Linux-land (in this case, libusb4java) expect a
dev_capability member that they can use to enumerate the device
capabilities.

No particular layout is expected of this, just that it can be traversed
using the bLength member until bNumDeviceCapabilities are read and that the
consumer may then use one of the libusb_get_*_descriptor methods to extract
specific (usb 2.0 vs. ss) capability information.
Delta File
+26 -2 lib/libusb/libusb10_desc.c
+1 -0 lib/libusb/libusb.h
+27 -2 2 files

HardenedBSD — bin/df df.c df.1

MFC r322293: df(1): Add --si as an alias for -H
Delta File
+9 -1 bin/df/df.c
+2 -2 bin/df/df.1
+11 -3 2 files

HardenedBSD — usr.bin/du du.c du.1, usr.bin/du/tests du_test.sh

MFC r322291: du(1): Add --si option to display in terms of powers of 1000
Delta File
+29 -11 usr.bin/du/du.c
+16 -10 usr.bin/du/du.1
+15 -0 usr.bin/du/tests/du_test.sh
+60 -21 3 files

HardenedBSD — usr.bin/indent indent.c indent.1

MFC r322177: Respect SIMPLE_BACKUP_SUFFIX environment variable in indent(1)

Instead of using a non-configurable ".BAK" suffix, respect the
SIMPLE_BACKUP_SUFFIX environment variable also used by patch(1). This
simplifies cleanup operations in some patch/indent workflows.

HardenedBSD — sys/arm64/arm64 machdep.c

Set the base address of translation table 0.

This fixes operation on Qualcomm Snapdragon and some other platforms.

During boot time on subsystems initialization we have some amount of
kernel threads created, then scheduler gives CPU time to each thread.
Eventually scheduler returns CPU execution back to thread 0. In this
case writing zero to ttbr0 in cpu_switch leads Qualcomm board to
reboot (asynchronously, CPU continues execution).

Similar to other kernel threads install a valid physical address
(kernel pmap) to user page table base register ttbr0.

Reviewed by:        andrew
Sponsored by:        DARPA, AFRL
Differential Revision:        https://reviews.freebsd.org/D13536
Delta File
+3 -0 sys/arm64/arm64/machdep.c
+3 -0 1 file

HardenedBSD — sys/fs/nfsserver nfs_nfsdstate.c

nfs: Do not printf each time a lock structure is freed during module unload

There can be a lot of those structures and printing a line each time we free
one on module unload.

MFC after:        3 days
Delta File
+1 -3 sys/fs/nfsserver/nfs_nfsdstate.c
+1 -3 1 file

HardenedBSD — sys/amd64/amd64 machdep.c, sys/amd64/include md_var.h cpu.h

Move the kernphys declaration to machine/md_var.h.

Apparently machinde/cpu.h is supposed to contain MD implementations of
MI interfaces.  Also, remove kernphys declaration from machdep.c,
since it is already provided by md_var.h.

Requested and reviewed by:        bde
MFC after:        13 days

HardenedBSD — sys/compat/cloudabi cloudabi_futex.c cloudabi_util.h, sys/compat/cloudabi32 cloudabi32_poll.c

MFC r327560:

  Allow timed waits with relative timeouts on locks and condvars.

  Even though pthreads doesn't support this, there are various alternative
  APIs that use this. For example, uv_cond_timedwait() accepts a relative
  timeout. So does Rust's std::sync::Condvar::wait_timeout().

  Though I personally think that relative timeouts are bad (due to
  imprecision for repeated operations), it does seem that people want
  this. Extend the existing futex functions to keep track of whether an
  absolute timeout is used in a boolean flag.

HardenedBSD — sys/boot/common reloc_elf.c

MFC r327822:
Skip IRELATIVE relocations when loader processes ELF files.
Delta File
+8 -0 sys/boot/common/reloc_elf.c
+8 -0 1 file

HardenedBSD — sys/amd64/amd64 exception.S

MFC r327819:
Do not redundantly clear %RFLAGS.DF on fast syscall entry.
Delta File
+0 -1 sys/amd64/amd64/exception.S
+0 -1 1 file

HardenedBSD — sys/amd64/amd64 machdep.c mp_machdep.c, sys/amd64/include md_var.h

MFC r327818:
Move the hardware setup for fast syscalls into a common function.

HardenedBSD — sys/vm vm_swapout.c

MFC r327555:
Restructure swapout tests after vm map locking was removed.
Delta File
+45 -98 sys/vm/vm_swapout.c
+45 -98 1 file

HardenedBSD — sys/vm vm_swapout.c

MFC r327450 (by alc):
Eliminate "minslptime".
Delta File
+6 -13 sys/vm/vm_swapout.c
+6 -13 1 file

HardenedBSD — sys/powerpc/powerpc mp_machdep.c

Call platform_smp_ap_init before decr_ap_init

    In platform_smp_ap_init we are doing some crucial code (eg. set LPCR register)
    which have influence over further execution.

    Practiculary in PowerNV platform we have experienced Data Storage Interrupt
    before we set apropriate LPCR. It caused code execution from location which was
    legal in bootloader (petitboot based on linux) but illegal in FreeBSD
Delta File
+3 -3 sys/powerpc/powerpc/mp_machdep.c
+3 -3 1 file

HardenedBSD — sys/powerpc/powerpc vm_machdep.c swtch64.S

PPC64: fix TOC behavior on process initialization

Set stack pointer to correct value after thread's stack pointer restore

Restoring new thread's stack pointer caused stack corruption because
restored stack pointer didn't point to callee (cpu_switch) stack frame but
caller stack frame.

As a result we had mysterious errors in caller function (sched_switch).

Solution: simply set stack pointer to correct value

Also, initialize TOC to a valid pointer once the thread is being
created.

Created by:            Patryk Duda <pdk at semihalf.com>
Submitted by:          Wojciech Macek <wma at semihalf.com>
Obtained from:         Semihalf
Reviewed by:           nwhitehorn
Differential revision: https://reviews.freebsd.org/D13947
Sponsored by:          QCM Technologies

HardenedBSD — sys/powerpc/powerpc machdep.c

PPC: machdep, zero BSS always but BookE

Zero BSS always. The only case when this operation is
ommitted is when booting on BookE.

Created by:            Wojciech Macek <wma at semihalf.com>
Obtained from:         Semihalf
Reviewed by:           imp, nwhitehorn
Differential revision: https://reviews.freebsd.org/D13948
Sponsored by:          QCM Technologies
Delta File
+9 -8 sys/powerpc/powerpc/machdep.c
+9 -8 1 file

HardenedBSD — sys/kern subr_kdb.c

KDB: restart only CPUs stopped by KDB

There is a case when not all CPUs went online. In that situation,
restart only APs which were operational before entering KDB.

Created by:            Wojciech Macek <wma at semihalf.com>
Obtained from:         Semihalf
Reviewed by:           nwhitehorn
Differential revision: https://reviews.freebsd.org/D13949
Sponsored by:          QCM Technologies
Delta File
+3 -1 sys/kern/subr_kdb.c
+3 -1 1 file

HardenedBSD — sys/powerpc/conf GENERIC64

    PPC64: add AHCI back to GENERIC64
    
    > Description of fields to fill in above:                     76 columns --|
    > PR:                       If a GNATS PR is affected by the change.
    > Submitted by:             If someone else sent in the change.
    > Reviewed by:              If someone else reviewed your modification.
    > Approved by:              If you needed approval for this commit.
    > Obtained from:            If the change is from a third party.
    > MFC after:                N [day[s]|week[s]|month[s]].  Request a reminder email.
    > MFH:                      Ports tree branch name.  Request approval for merge.
    > Relnotes:                 Set to 'yes' for mention in release notes.
    > Security:                 Vulnerability reference (one per line) or description.
    > Sponsored by:             If the change was sponsored by an organization.
    > Differential Revision:    https://reviews.freebsd.org/D### (*full* phabric URL 
needed).
    > Empty fields above will be automatically removed.
    
    M    sys/powerpc/conf/GENERIC64
Delta File
+1 -1 sys/powerpc/conf/GENERIC64
+1 -1 1 file

HardenedBSD — sbin/geom/class/nop gnop.8 geom_nop.c, sys/geom/nop g_nop.c g_nop.h

gnop(8): add the ability to set a nop provider's physical path

While I'm here, expand the existing tests a bit.

MFC after:        3 weeks
Differential Revision:        https://reviews.freebsd.org/D13579

HardenedBSD — etc/mtree BSD.root.dist, share/man/man7 hier.7

stand: Add /boot/overlays to allow separation of overlays from base FDT

This matches directory structure used commonly in Linux-land, and it's
cleaner than mixing overlays into the existing module paths. Overlays are
still mixed in by specifying fdt_overlays in loader.conf(5).

Reviewed by:        manu
Differential Revision:        https://reviews.freebsd.org/D13922

HardenedBSD — usr.sbin/kldxref ef_powerpc.c

Adjust format string to fix build.
Delta File
+1 -1 usr.sbin/kldxref/ef_powerpc.c
+1 -1 1 file

HardenedBSD — usr.sbin/kldxref ef_powerpc.c

Tidy some whitespace.
Delta File
+2 -2 usr.sbin/kldxref/ef_powerpc.c
+2 -2 1 file

HardenedBSD — sys/amd64/include vmm.h, sys/amd64/vmm/amd svm.c svm.h

Save and restore guest debug registers.

Currently most of the debug registers are not saved and restored
during VM transitions allowing guest and host debug register values to
leak into the opposite context.  One result is that hardware
watchpoints do not work reliably within a guest under VT-x.

Due to differences in SVM and VT-x, slightly different approaches are
used.

For VT-x:

- Enable debug register save/restore for VM entry/exit in the VMCS for
  DR7 and MSR_DEBUGCTL.
- Explicitly save DR0-3,6 of the guest.
- Explicitly save DR0-3,6-7, MSR_DEBUGCTL, and the trap flag from
  %rflags for the host.  Note that because DR6 is "software" managed
  and not stored in the VMCS a kernel debugger which single steps
  through VM entry could corrupt the guest DR6 (since a single step
  trap taken after loading the guest DR6 could alter the DR6
  register).  To avoid this, explicitly disable single-stepping via
  the trace flag before loading the guest DR6.  A determined debugger
  could still defeat this by setting a breakpoint after the guest DR6
  was loaded and then single-stepping.


    [14 lines not shown]