This flag was introduced at 8036234c72
to prevent the SIOCSPFXFLUSH_IN6 ioctl from removing manually-added
entries. However, this flag did actually not work due to an
incomplete implementation making prelist_update() not handle it before
calling nd6_prelist_add().
This patch removes the flag because a prefix is derived from an RA
always has an entry in the ndpr_advrtrs member in the struct
nd_prefix. Having a separate flag is not a good idea because it can
cause a mismatch between the flag and the ndpr_advrtrs entry. Testing
using LIST_EMPTY() is simpler for the origial goal.
This also removes in a prefix check in the ICMPV6CTL_ND6_PRLIST sysctl
to exclude manually-added entries. This ioctl is designed to list all
entries, and there is no relationship to SIOCSPFXFLUSH_IN6.
Differential Revision: https://reviews.freebsd.org/D46441
Provide a clock through clock_gettime() that returns the current TAI
time (UTC without leap seconds) as a complement to CLOCK_REALTIME. This
provides compatibility with Linux, which also provides a CLOCK_TAI since
kernel 2.6.26, and this seems to be becoming the standard way to acquire
TAI time. Unlike Linux, this code will return EINVAL if the TAI offset
(set by ntpd, ptpd, etc.) is not known since it seems pathological for
CLOCK_TAI to silently give the wrong (UTC) time if the offset is not
known as it does on Linux.
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D46268
Variables for command-line options like $foo_flags can contain characters
that perform pathname expansions, such as '[', ']', and '*'. They were
passed without escaping, and the matched entries in the working directory
affected the command-line options. This change turns off the expansion
when run_rc_command() is called.
While this changes the current behavior, an invocation of a service
program should not depend on entries in the working directory.
Differential Revision: https://reviews.freebsd.org/D45855
The get{addr,name}info(3) API is designed to return an API-specific error
code that is independent of errno. The cap_get{addr,name}info() functions
returned either an errno or API-specific error code inconsistently.
This change fixes this mismatch.
When the API returns an errno, the return value itself is set to
EAI_SYSTEM and errno is set depending on the actual error. So, usually
this API is called in the following form:
error = getnameinfo(...);
if (error == EAI_SYSTEM)
perror("getnameinfo");
else if (error)
errx(1, "getnameinfo: %s", gai_strerror(error);
If the above getnameinfo() call is replaced with cap_getnameinfo(),
it breaks the error handling. For example, the cap_get{addr,name}info()
functions can return ENOTCAPABLE.
This change simply adds "errno", in addition to "error", to the nvlout and
cap_get{addr,name}info() restores the errno if the error code is EAI_SYSTEM.
Reviewed by: oshogbo
Differential Revision: https://reviews.freebsd.org/D45859
cap_net.h uses "#define cap_f(chan, a) f(a)" to call the conventional
service function with the first argument of cap_f() dropped for
compatibility with the environment where the casper service is
unavailable. However, this function-like macro does not work when the
arguments contains C99 compound literals, such as f(chan, (int[]){1,2,3}).
The following is a typical example:
error = cap_getaddrinfo(capnet, "192.168.0.1", "100",
&(struct addrinfo){
.ai_family = AF_INET,
.ai_flags = AI_NUMERICHOST
}, &res);
Using cap_f(chan, ...) and __VA_ARGS__ in C99 seems a reasonable solution
for this problem. While there is a workaround using parenthesis around
the compound literal like f(chan, ((int[]){1,2,3})), it is not intuitive
and the above example works when the cap_net is available and f() is
defined as a function.
A possible moot point is that __VA_ARGS__ cannot control how many
arguments are passed at the macro level, and "chan" is not protected.
However, "chan" is less likely to be written in compound literal, and
the function prototype should check the remaining arguments.
Reviewed by: oshogbo
Differential Revision: https://reviews.freebsd.org/D45858
Newer versions of drivers such as libwacom (graphics tablets) or
libfprint (fingerprint scanners) call g_usb_device_get_parent. This in
turn calls libusb_get_parent on platforms which implement it, and
returns NULL on platforms that don't. This patch implements this
function on FreeBSD.
Reviewed by: bapt, kevans
Differential Revision: https://reviews.freebsd.org/D46992
Despite being discouraged in the man page people are trying to load
the driver from loader. In that case firmware is missing and the
root file system is not there yet and the LinuxKPI based drivers
will panic the system on boot. Simply avoid any further support
trouble by disallowing them to be loaded from loader.
If someone still wants to do it, they will need to figure out how
to remove them from the blocklst and how to loader the firmware
file(s) in advance themselves.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
PR: 287480
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D50817
Running out of O_* flag bits will end out ability to make additions that
are source compatible with other operating systems.
Add a warning to coordinate all additions with srcmgr@.
Reviewed by: markj, emaste
Differential Revision: https://reviews.freebsd.org/D50703
When creating the kernel page tables we create them all executable to
allow the kernel to boot.
We can reduce the number of l2 blocks or l3 pages created as executable
by looking where the end of the .text section is and only marking
memory up to this as executable (rounded up to the block/page size).
Memory after the .text is marked as execute never as it will be data.
Reviewed by: alc
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D45063
Use the existing lables to find the early page tables. This allows
us to change the size and layout of these as needed, e.g. adding a
new level.
Reviewed by: alc
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D45062
HDMI audio did not work on my older Radeon GPU, the error message
during attach was:
hdac0: hdac_get_capabilities: Invalid corb size (0)
This is fixed by calling hdac_reset() before the HDA device
capabilities are retrieved. This solution was proposed by Andriy Gapon
in 2010, but apparently did not solve the problem reported at the time.
Approved by: christos
Differential Revision: https://reviews.freebsd.org/D50737
We only define SIG2STR_MAX with careful visibility, but define the
fortified version unconditionally. It needs to have the same visibility
both places.
Fixes: 3d12567133
Reviewed by: jrtc27, kevans
Sponsored by: Netflix
consider the following C++ code:
struct S { int a, b; };
S f() { return {1, 2}; }
according to style(9), the return statement should be formatted as:
return ({1, 2});
however, this is not valid C++ code and will not compile.
add an exception to style(9) to cover this case.
Reviewed by: imp, emaste
Pull Request: https://github.com/freebsd/freebsd-src/pull/1623
Closes: https://github.com/freebsd/freebsd-src/pull/1623
usb_msc_auto_quirk() potentially crashes usb devices with a hidden
storage (see bug 287333). These devices may still operate normally if
usb_msc_auto_quirk() would not be called all and the hidden storage is
ignored. This patch makes sure, that usb_msc_auto_quirk() is not called
when the UQ_MSC_IGNORE quirk is set for a device. It shouldn't be called
anyway if the hidden storage supposed to be ignored. This gives users a
chance to get their devices working by using
'usbconfig add_dev_quirk_vplh <vid> <pid> <lo_rev> <hi_rev> UQ_MSC_IGNORE'.
Reviewed by: imp
MFC After: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/1716
Closes: https://github.com/freebsd/freebsd-src/pull/1716
vm_page_lock() and its underlying array of locks, pa_lock[], have been
replaced throughout the virtual memory system by either atomics or
busy-style, per-page synchronization. The Linux KPI support contained
the only remaining use cases. Eliminate or update them as appropriate
to each case.
Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D50767
Switch to using sys/stdarg.h for va_list type and va_* builtins.
Make an attempt to insert the include in a sensible place. Where
style(9) was followed this is easy, where it was ignored, aim for the
first block of sys/*.h headers and don't get too fussy or try to fix
other style bugs.
Reviewed by: imp
Exp-run by: antoine (PR 286274)
Pull Request: https://github.com/freebsd/freebsd-src/pull/1595
While the type of va_list and implementation of va_*() psuedo functions
varies (sometimes greatly) by architecture, they will always be defined
by the compiler in a consistant way that does not require machine
dependent handling.
MFC after: 1 week
Reviewed by: imp
Exp-run by: antoine (PR 286274)
Pull Request: https://github.com/freebsd/freebsd-src/pull/1595
Rely in sys/_visible for visibility macros and use __buitin_va_list
instead of __va_list everywere we declare va_list.
Reviewed by: imp
Exp-run by: antoine (PR 286274)
Pull Request: https://github.com/freebsd/freebsd-src/pull/1595
Switch to sys/_visible.h for visibility macros.
Prefer __builtin_offsetof over __offset. sys/cdefs.h always defines
__offsetof to __builtin_offsetof so just use the latter to remove a
dependency on sys/cdefs.h. Realistically, we're never going to care
about a compiler that doesn't supply this builtin.
Add a somewhat questionable guard around the offsetof() definition
because the compiler no longer thinks it the same as a number of other
redundent definitions scattered around (e.g., in the openzfs codebase).
It is actually the same and those defintions likely shouldn't exist at
all, but it's easy to add a guard for now.
Reviewed by: imp
Exp-run by: antoine (PR 286274)
Pull Request: https://github.com/freebsd/freebsd-src/pull/1595
Some headers need to support our non-portable visibility macros, but
would be more portable if they provided less overall pollution (e.g.,
stddef.h currently provides __BEGIN_DECLS/__END_DECLS).
Reviewed by: imp
Exp-run by: antoine (PR 286274)
Pull Request: https://github.com/freebsd/freebsd-src/pull/1595
Use __attribute__((__aligned__(x))) and __alignof__(x) in places of local
macros that ultimately wrap these. We don't support compilers that don't
define these so there's little loss of generality.
This mirrors Clang's stddef.h.
Reviewed by: imp
Exp-run by: antoine (PR 286274)
Pull Request: https://github.com/freebsd/freebsd-src/pull/1595
These headers relied in __BEGIN_DECS/__END_DECLS being defined when
sys/_types.h was included, but there's not a requirement that this be
the case.
Reviewed by: imp
Exp-run by: antoine (PR 286274)
Pull Request: https://github.com/freebsd/freebsd-src/pull/1595
While it is too late for 14.3-R point people at fwget(8) to install
firmware if the driver cannot find any.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: emaste, ziaee
Differential Revision: https://reviews.freebsd.org/D50777
Use LIST_FOREACH_SAFE to avoid a use-after-free in scmi_reqs_pool_free.
The next pointer will be invalid after the call to free meaning
LIST_FOREACH will dereference a freed struct to move to the next item.
Reviewed by: emaste
Sponsored by: Arm Ltd
Differential Revision: https://reviews.freebsd.org/D50753
Pci video graphic card is 15d8 needs gpu-firmware-amd-kmod-picasso and
it won't work with gpu-firmware-amd-kmod-raven.
Tested on Thinkpad T495.
PR: 287441
MFC After: 3 days