aboutsummaryrefslogtreecommitdiff
path: root/sys/compat
Commit message (Collapse)AuthorAgeFilesLines
* linuxkpi xarray: Correct expression in assertion.John Baldwin2022-02-111-2/+2
| | | | | | Reported by: GCC -Wparantheses Reviewed by: wulf, hselasky Differential Revision: https://reviews.freebsd.org/D34197
* fd: make fget_unlocked take a thread argumentMateusz Guzik2022-02-112-10/+4
| | | | | Just like other fget routines. This enables embedding fd table pointer in struct thread, avoiding taking a trip through proc.
* linuxkpi: Add parentheses to pacify -Wparentheses warnings from GCC.John Baldwin2022-02-071-1/+1
| | | | | Reviewed by: bz, emaste Differential Revision: https://reviews.freebsd.org/D34145
* Trim duplicate code for copying in iovecs for PT_[GS]ETREGSET.John Baldwin2022-02-071-8/+1
| | | | | Reviewed by: andrew, emaste Differential Revision: https://reviews.freebsd.org/D34177
* lindebugfs: Fix writeEmmanuel Vadot2022-02-041-2/+8
| | | | | | | | | | | For write operation pseudofs creates an sbuf with the data. Use this data instead of the uio as it's not usable anymore after uiomove. Reviewed by: hselasky MFC after: 1 week Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D34114
* linux: Provide dummy seccomp(2)Edward Tomasz Napierala2022-01-283-2/+19
| | | | | | | | | | Don't emit messages; this isn't any different from a Linux kernel built without OPTIONS_SECCOMP, so the userspace already needs to know how to deal with it. This is also similar with how we handle seccomp in linux_prctl(). Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D33808
* Add PT_GETREGSETAndrew Turner2022-01-272-0/+26
| | | | | | | | | | | | | | | | | | | This adds the PT_GETREGSET and PT_SETREGSET ptrace types. These can be used to access all the registers from a specified core dump note type. The NT_PRSTATUS and NT_FPREGSET notes are initially supported. Other machine-dependant types are expected to be added in the future. The ptrace addr points to a struct iovec pointing at memory to hold the registers along with its length. On success the length in the iovec is updated to tell userspace the actual length the kernel wrote or, if the base address is NULL, the length the kernel would have written. Because the data field is an int the arguments are backwards when compared to the Linux PTRACE_GETREGSET call. Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D19831
* Revert "LinuxKPI: Allow wake_up to be executed within a critical section"Vladimir Kondratyev2022-01-261-4/+2
| | | | | | This change was based on currently reverted commit 7dea0c9e6eba. This reverts commit 89889ab470b9f1a1cd36913dd219b78efbf484df.
* Revert "LinuxKPI: Allow spin_lock_irqsave to be called within a critical ↵Vladimir Kondratyev2022-01-261-23/+4
| | | | | | | | | | section" This change results in deadlocks on UP systems This reverts commit 7dea0c9e6eba4dc127cd67667c81fa2c250f1024. Requested by: kib, hselasky
* linuxkpi: i2c: Add MODULE_DEPEND for iicbusEmmanuel Vadot2022-01-261-0/+1
| | | | | | | | MFC after: 1 month MFC with: 1961a14a4743 Fixes: 1961a14a4743 ("linuxkpi: Add i2c support") Reported by: GregV Sponsored by: Beckhoff Automation GmbH & Co. KG
* linuxkpi: Add i2c supportEmmanuel Vadot2022-01-255-0/+707
| | | | | | | | | | | | | | | | | | | | | | | | | Add i2c support to linuxkpi. This is needed by drm-kmod. For every i2c_adapter added by i2c_add_adapter we add a child to the device named "lkpi_iic". This child handle the conversion between Linux i2c_msgs to FreeBSD iic_msgs. For every i2c_adapter added by i2c_bit_add_bus we add a child to the device named "lkpi_iicbb". This child handle the conversion between Linux i2c_msgs to FreeBSD iic_msgs. With the help of iic(4), this expose the i2c controller to userspace allowing a user to query DDC information from a monitor. e.g.: i2c -f /dev/iic0 -a 0x28 -c 128 -d r will query the standard EDID from the monitor if plugged. The bitbang part (lkpi_iicbb) isn't tested at all for now as I don't have compatible hardware (all my hardware have native i2c controller). Tested on: Intel (SandyBridge, Skylake, ApolloLake) Tested on: AMD (Picasso, Polaris (amd64 and arm64)) MFC after: 1 month Reviewed by: hselasky Sponsored by: Beckhoff Automation GmbH & Co. KG Differential Revision: https://reviews.freebsd.org/D33053
* Revert "linux: Provide dummy seccomp(2)"Edward Tomasz Napierala2022-01-202-19/+0
| | | | | | This reverts commit 56981629f91fcdd358ccb41081ff6dcc2edac12f. Wrong patch; fails to build on i386.
* linux: Provide dummy seccomp(2)Edward Tomasz Napierala2022-01-252-0/+19
| | | | | | | | | | Don't emit warnings; this isn't any different from a Linux kernel built without OPTIONS_SECCOMP, so the userspace already needs to know how to deal with it. This is also similar with how we handle seccomp in linux_prctl(). Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D33808
* Add security.bsd.allow_ptrace sysctlKonstantin Belousov2022-01-222-1/+8
| | | | | | | | | that disables any access to ptrace(2) for all processes. Reviewed by: emaste Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D33986
* LinuxKPI: Allow wake_up to be executed within a critical sectionVladimir Kondratyev2022-01-181-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | by replaceing of spin_lock() call with spin_lock_irqsave() This fixes following panic in drm-kmod: panic: mi_switch: switch in a critical section cpuid = 2 time = 1636939794 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b vpanic() at vpanic+0x187 panic() at panic+0x43 mi_switch() at mi_switch+0x198 __mtx_lock_sleep() at __mtx_lock_sleep+0x1c9 __mtx_lock_flags() at __mtx_lock_flags+0xa2 linux_wake_up() at linux_wake_up+0x38 __active_retire() at __active_retire+0xb7 dma_fence_signal() at dma_fence_signal+0x100 dma_resv_add_shared_fence() at dma_resv_add_shared_fence+0x96 i915_gem_do_execbuffer() at i915_gem_do_execbuffer+0x11d0 i915_gem_execbuffer2_ioctl() at i915_gem_execbuffer2_ioctl+0x19a drm_ioctl_kernel() at drm_ioctl_kernel+0x72 drm_ioctl() at drm_ioctl+0x2c4 linux_file_ioctl() at linux_file_ioctl+0x297 kern_ioctl() at kern_ioctl+0x1dc sys_ioctl() at sys_ioctl+0x124 amd64_syscall() at amd64_syscall+0x124 fast_syscall_common() at fast_syscall_common+0xf8 --- syscall (54, FreeBSD ELF64, sys_ioctl) MFC after: 1 week Reviewed by: manu Reported by: Graham Perrin <grahamperrin_AT_gmail_DOT_com> PR: 261166 Differential Revision: https://reviews.freebsd.org/D33888
* LinuxKPI: Allow spin_lock_irqsave to be called within a critical sectionVladimir Kondratyev2022-01-181-4/+23
| | | | | | | | | | | | | with spinning on spin_trylock. dma-buf part of drm-kmod depends on this property and absence of it support results in "mi_switch: switch in a critical section" assertions [1][2]. [1] https://github.com/freebsd/drm-kmod/issues/116 [2] https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=261166 MFC after: 1 week Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D33887
* freebsd32: Fix layout of struct shmid_kernel32.John Baldwin2022-01-181-4/+4
| | | | | | | | | The kernel pointers in this structure need to be 32-bit pointers, not native pointers to 32-bit integers. Reviewed by: kib Sponsored by: The University of Cambridge, Google Inc. Differential Revision: https://reviews.freebsd.org/D33905
* proc: Add a sysctl to fetch virtual address space layout infoMark Johnston2022-01-171-0/+13
| | | | | | | | | | This provides information about fixed regions of the target process' user memory map. Reviewed by: kib MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33708
* exec: Remove the stack gap implementationMark Johnston2022-01-172-3/+0
| | | | | | | | | | | | | | | ASLR stack randomization will reappear in a forthcoming commit. Rather than inserting a random gap into the stack mapping, the entire stack mapping itself will be randomized in the same way that other mappings are when ASLR is enabled. No functional change intended, as the stack gap implementation is currently disabled by default. Reviewed by: kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33704
* exec: Introduce the PROC_PS_STRINGS() macroMark Johnston2022-01-171-1/+1
| | | | | | | | | | | Rather than fetching the ps_strings address directly from a process' sysentvec, use this macro. With stack address randomization the ps_strings address is no longer fixed. Reviewed by: kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33704
* sysent: Add a sv_psstringssz field to struct sysentvecMark Johnston2022-01-171-0/+1
| | | | | | | | | | | The size of the ps_strings structure varies between ABIs, so this is useful for computing the address of the ps_strings structure relative to the top of the stack when stack address randomization is enabled. Reviewed by: kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33704
* linux: add sysctl to pass untranslated interface namesAlexander V. Chernikov2022-01-175-15/+28
| | | | | | Reviewed by: kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D33792
* linux: fix linux_recvmsg() MSG_PEEK flag handlingAlexander V. Chernikov2022-01-171-0/+6
| | | | | | Reviewed by: kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D33790
* linux: Make compat.linux.preserve_vstatus default to 1Edward Tomasz Napierala2022-01-171-1/+1
| | | | | | | | From a user point of view, this makes ^T work out of the box. Reviewed By: debdrup (man page) Sponsored By: EPSRC Differential Revision: https://reviews.freebsd.org/D33842
* LinuxKPI: 802.11 correct enum ieee80211_channel_flagsBjoern A. Zeeb2022-01-161-9/+9
| | | | | | | | | | | | | enum ieee80211_channel_flags are used as bit fields and not as 1..n. Correct the values using BIT(n). This is also hoped to fix problems with 7260 cards which come up and panic due to an empty channel list as all channels are set disabled [1]. It will hopefully also fix the one or other oddity. Reported by: ambrisko, Mike Tancsa (mike sentex.net) [1] Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11 Refine/add DTIM/TSF handlingBjoern A. Zeeb2022-01-152-25/+61
| | | | | | | | | | | | | | | | | | Correct data types related to delivery traffic indication map (DTIM)/ timing synchronization function (TSF) and implement/refine their handling. This information is used/needed by iwlwifi to set a station as associated. This will hopefully avoid more "no beacon heard" time event failures. The recording of the Linux specific sync_device_ts is done in the receive path for now in case we do have the right information available. I need to investigate as to how-much it may make sense to also migrate it into net80211 in the future depending on the usage in other drivers (or how we did handle this in the past in natively ported versions, e.g. iwm). Sponsored by: The FreeBSD Foundation MFC after: 3 days
* LinuxKPI: 802.11 handle connection loss differentlyBjoern A. Zeeb2022-01-151-2/+2
| | | | | | | | | Rather than just bouncing back to SCAN bounce to INIT on connection loss. This is should be refined in the future as the comment already indicates but we need to tie two different worlds together. Sponsored by: The FreeBSD Foundation MFC after: 3 days
* ia32_signal.h: Drop #ifdef's for old compat structures.John Baldwin2022-01-141-8/+0
| | | | Requested by: kib
* ia32: Rename a struct ia32_sigcontext3 -> struct ia32_osigcontext.John Baldwin2022-01-141-1/+1
| | | | Fixes: bd7630ef6198 ia32: Sync signal context type names with i386.
* ia32: Sync signal context type names with i386.John Baldwin2022-01-143-18/+18
| | | | | | | | | - Use ia32_freebsd4_* instead of ia32_*4. - Use ia32_o* instead of ia32_*3. Reviewed by: brooks, imp, kib Sponsored by: The University of Cambridge, Google Inc. Differential Revision: https://reviews.freebsd.org/D33882
* Revert "syscallarg_t: Add a type for system call arguments"Brooks Davis2022-01-122-3/+3
| | | | | | | | Missed issues in truss on at least armv7 and powerpcspe need to be resolved before recommit. This reverts commit 3889fb8af0b611e3126dc250ebffb01805152104. This reverts commit 1544e0f5d1f1e3b8c10a64cb899a936976ca7ea4.
* sysent: regen for syscallarg_tBrooks Davis2022-01-122-3/+3
|
* LinuxKPI: 802.11 fix locking in lkpi_stop_hw_scan()Bjoern A. Zeeb2022-01-101-0/+4
| | | | | | | | | | | | | | In lkpi_stop_hw_scan() we have to unlock around cancelling the hardware scan and an msleep to wait for the confirmation that the scan ended. Otherwise we are sleeping with the non-sleepable net80211 com lock held. At the same time we need to hold the lhw lock for the msleep(). This lock change got lost in the refactoring of lkpi_iv_newstate(). Reported by: ambrisko, delphij PR: 261075 MFC after: 3 days Sponsored by: The FreeBSD Foundation
* LinuxKPI: Add sort() wrapper.Vladimir Kondratyev2022-01-101-0/+41
| | | | | | | | | | swap parameter is not supported as it is rarely used in Linux kernel and its implementation will add some preprocessor spaghetti to qsort. Required by drm-kmod. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D33675
* LinuxKPI: Use negative bit field size to trigger BUILD_BUG_ON_ZEROVladimir Kondratyev2022-01-101-3/+1
| | | | | | | | | | | compile time assertion on non-NULL pointers. Tests conducted show that _Static_assert, negative array size method and current code does not handle pointers well enough. Bit field method solves this problem. This change is derrived from Linux implementation of BUILD_BUG_ON_ZERO. MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D33674
* LinuxKPI: Constantly use _LINUXKPI_ prefix in include guardsVladimir Kondratyev2022-01-10160-469/+469
| | | | | | MFC after: 1 week Reviewed by: bz, emaste, hselasky, manu Differential Revision: https://reviews.freebsd.org/D33562
* LinuxKPI: Import MTRR support functions from drm-kmodVladimir Kondratyev2022-01-102-0/+80
| | | | | | | | | | | | They are superseded by PAT and mostly useless nowadays but still can be used on Pentium III/IV era processors. Unlike drm-kmod version, this one ignores MTRR if PAT is available that fixes confusing "Failed to add WC MTRR for [0xXXXX-0xYYYY]: 22; performance may suffer" message often appearing during drm-kmod initialization process. MFC after: 1 week Reviewed by: hselasky, manu Differential Revision: https://reviews.freebsd.org/D33561
* LinuxKPI: Import linux/ratelimit.hVladimir Kondratyev2022-01-101-0/+17
| | | | | | | | | Required by drm-kmod. Obtained from: OpenBSD MFC after: 1 week Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D33560
* LinuxKPI: Add linux/capability.h headerVladimir Kondratyev2022-01-101-0/+51
| | | | | | | | | | Required by drm-kmod. Obtained from: DragonflyBSD MFC after: 1 week Reviewed by: hselasky, manu Differential Revision: https://reviews.freebsd.org/D33559
* LinuxKPI: Add readx_poll_timeout wrapperVladimir Kondratyev2022-01-101-0/+3
| | | | | | | | Required by drm-kmod 5.7 MFC after: 1 week Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D33307
* LinuxKPI: Add static_cpu_has() implementationVladimir Kondratyev2022-01-101-0/+37
| | | | | | | | | static_cpu_has returns true if CPU supports requested feature. Obtained from: OpenBSD MFC after: 1 week Reviewed by: hselasky, manu Differential Revision: https://reviews.freebsd.org/D33301
* LinuxKPI: Implement efi_enabled(EFI_BOOT)Vladimir Kondratyev2022-01-101-0/+73
| | | | | | | | | efi_enabled(EFI_BOOT) returns true if machine was booted from EFI Used by drm-kmod and some unported drm drivers like hyperv MFC after: 1 week Reviewed by: hselasky, manu Differential Revision: https://reviews.freebsd.org/D33300
* LinuxKPI: Import linux/jump_label.hVladimir Kondratyev2022-01-101-0/+48
| | | | | | | Required by drm-kmod Obtained from: DragonflyBSD Differential Revision: https://reviews.freebsd.org/D33299
* LinuxKPI: Move kfree_async() functionality in to kfree()Vladimir Kondratyev2022-01-101-15/+10
| | | | | | | | Obsolete it usage but keep for a while for drm-kmod 5.4 compatibility MFC after: 1 week Reviewed by: hselasky, manu Differential Revision: https://reviews.freebsd.org/D33298
* LinuxKPI: Add stdarg.h proxy headerVladimir Kondratyev2022-01-101-0/+33
| | | | | | | | To reduce amount of drm-kmod patching MFC after: 1 week Reviewed by: hselasky, manu Differential Revision: https://reviews.freebsd.org/D33297
* LinuxKPI: Add some typical header pollutionVladimir Kondratyev2022-01-105-0/+8
| | | | | | | | To reduce amount of drm-kmod patching MFC after: 1 week Reviewed by: hselasky, manu Differential Revision: https://reviews.freebsd.org/D33297
* LinuxKPI: Implement smp_*mb barriers with atomic_thread_fence_*Vladimir Kondratyev2022-01-103-1/+59
| | | | | | | | for x86 and move them to asm/barrier.h MFC after: 1 week Reviewed by: bz, hselasky, manu Differential Revision: https://reviews.freebsd.org/D33296
* LinuxKPI: Make lockdep*_pin_lock macros useable for drm-kmodVladimir Kondratyev2022-01-101-5/+7
| | | | | | | | | | | Summary: - Add dummy struct pin_cookie definition; - Convert lockdep_pin_lock macro to function; - Fix 'unused variable' compile-time errors; MFC after: 1 week Reviewers: hselasky, manu Differential Revision: https://reviews.freebsd.org/D33295
* LinuxKPI: Convert schedule() to inlined functionVladimir Kondratyev2022-01-101-2/+6
| | | | | | | | to prevent name clashing with drm-kmod MFC after: 1 week Reviewed by: hselasky, manu Differential Revision: https://reviews.freebsd.org/D33294
* LinuxKPI: Add support for XA_FLAGS_ALLOC1 xarray flagVladimir Kondratyev2022-01-102-6/+11
| | | | | | | | | | XA_FLAGS_ALLOC1 causes allocation of xarray entries starting at 1 Required by drm-kmod 5.7 MFC after: 1 week Reviewed by: hselasky, manu Differential Revision: https://reviews.freebsd.org/D33293