| #
2353fa1a
|
| 17-Mar-2026 |
John Baldwin <jhb@FreeBSD.org> |
LinuxKPI: Fix simple_read_from_buffer for zero-size and off-the-end reads
I noticed that the buf_size < 0 check can never be true (it's a size_t) and decided to check for this condition by an altern
LinuxKPI: Fix simple_read_from_buffer for zero-size and off-the-end reads
I noticed that the buf_size < 0 check can never be true (it's a size_t) and decided to check for this condition by an alternate expression, and I also noticed that a read_size of 0 would incorrectly return -EFAULT. Instead, return success for both of these cases as reading beyond the EOF of a normal file also returns EOF, not EINVAL.
Reviewed by: bz Sponsored by: AFRL, DARPA Differential Revision: https://reviews.freebsd.org/D55845
show more ...
|
| #
2cf15144
|
| 17-Mar-2026 |
John Baldwin <jhb@FreeBSD.org> |
lindebugfs: Pass user buffer pointers to the read/write file operations
The Linux file_operations API expects the read and write operations to take a single user buffer pointer (along with the lengt
lindebugfs: Pass user buffer pointers to the read/write file operations
The Linux file_operations API expects the read and write operations to take a single user buffer pointer (along with the length and the file offset as an in/out parameter).
However, the debugfs_fill function was violating this part of the contract as it was passing down kernel pointers instead. An earlier commit (5668c22a13c6befa9b8486387d38457c40ce7af4) hacked around this by modifying simple_read_from_buffer() to treat its user pointer argument as a kernel pointer instead. However, other commits keep tripping over this same API mismatch (e.g. 78e25e65bf381303c8bdac9a713ab7b26a854b8c passes a kernel pointer to copy_from_user in fops_str_write).
Instead, change debugfs_fill to use the "raw" pseudofs mode where the uio is passed down to directly to the fill callback rather than an sbuf. debufs_fill now iterates over the iovec in the uio similar to the implementation of uiomove invoking the read or write operation on each user pointer.
This also fixes a tiny bug where the initial file offset from uio_offset was ignored. Instead, the operations were always invoked with a file offset of 0.
As part of this, revert the the changes to simple_read_from_buffer() from commit 5668c22a13c6befa9b8486387d38457c40ce7af4.
Also as part of this, the simple_attr_read/write methods and seq_read now also need to accept and handle user pointers (also matching the API in Linux).
For simple_attr_write*(), copy the user buffer into a kernel buffer before parsing. Also, do not permit writes at an offset as it's unclear what the semantics for those would even be (perhaps you would write out the formatted value into a buffer first and then allow the copy_from_user to overwrite/extend that buffer and then re-parse the integer value?). The old handling of *ppos for writes was definitely wrong before and only worked for an offset of 0 anyway.
Reviewed by: bz Sponsored by: AFRL, DARPA Differential Revision: https://reviews.freebsd.org/D55833
show more ...
|
| #
c2a59181
|
| 08-Feb-2025 |
Jean-Sébastien Pédron <dumbbell@FreeBSD.org> |
linuxkpi: Add `show_fdinfo()` to `struct file_operations`
We never call this field but it allows to compile drivers without modifications.
This is used by the DRM drivers for some time, but another
linuxkpi: Add `show_fdinfo()` to `struct file_operations`
We never call this field but it allows to compile drivers without modifications.
This is used by the DRM drivers for some time, but another change part of the update to Linux 6.8 led to compile them with `CONFIG_PROC_FS`. This connected code that uses this struct field.
Reviewed by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D49069
show more ...
|
| #
585cdb74
|
| 05-Feb-2025 |
Jean-Sébastien Pédron <dumbbell@FreeBSD.org> |
linuxkpi: Defaults to `get_file_rcu()` version from Linux 6.7
To use the old version, one has to explicitly set `LINUXKPI_VERSION` to the expected version of Linux KPI.
Reported by: bz Reviewed by:
linuxkpi: Defaults to `get_file_rcu()` version from Linux 6.7
To use the old version, one has to explicitly set `LINUXKPI_VERSION` to the expected version of Linux KPI.
Reported by: bz Reviewed by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48860
show more ...
|
| #
e3cf2321
|
| 01-Jan-2025 |
Jean-Sébastien Pédron <dumbbell@FreeBSD.org> |
linuxkpi: Add `get_file_active()`
[Why] This is used by the i915 DRM driver starting from Linux 6.7.
Reviewed by: manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.fr
linuxkpi: Add `get_file_active()`
[Why] This is used by the i915 DRM driver starting from Linux 6.7.
Reviewed by: manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48757
show more ...
|
| #
1de8fcf4
|
| 01-Jan-2025 |
Jean-Sébastien Pédron <dumbbell@FreeBSD.org> |
linuxkpi: Add Linux 6.7 `get_file_rcu()` variant
[Why] In Linux 6.7, the signature of `get_file_rcu()` changed significantly, going from:
bool get_file_rcu(struct linux_file *f);
... to:
linuxkpi: Add Linux 6.7 `get_file_rcu()` variant
[Why] In Linux 6.7, the signature of `get_file_rcu()` changed significantly, going from:
bool get_file_rcu(struct linux_file *f);
... to:
struct linux_file * get_file_rcu(struct linux_file **f);
I.e., both the argument and the return value changed in an incompatible way.
This is used by the i915 DRM driver.
[How] This patch introduces the variant and hide the new prototype behind `LINUXKPI_VERSION >= 60700`.
Reviewed by: manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D48756
show more ...
|
| #
5668c22a
|
| 27-Jun-2024 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI/lindebugfs: stop panicing in lindebugfs, fix simple_read_from_buffer
Trying to use lindebugfs for debugging wirless drivers two issues became apparent: (a) a panic in lindebugfs calling a h
LinuxKPI/lindebugfs: stop panicing in lindebugfs, fix simple_read_from_buffer
Trying to use lindebugfs for debugging wirless drivers two issues became apparent: (a) a panic in lindebugfs calling a hard coded release function if the caller had not provided one. This seems to be based on assumptions that no longer hold up. Remove the hard coded release function to prevent panics. (b) In LinuxKPI simple_read_from_buffer() would call copy_to_user() but buffers weren't setup for this (lindebugfs copies data from its own buffer) and then pseudofs will do another copyout to the user on this; remove the copy_to_user() and simply copy the data over to the provided buffer; this works for as long as the only consumers remain debugfs callers (which currently seems to be the case). [the only out-of-tree consumers I am aware off are two drm-kmod drivers/gpu/drm/amd/pm/* debugfs functions I cannot test].
Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Tested by: jfree Differential Revision: https://reviews.freebsd.org/D45755
show more ...
|
| #
8c5c5721
|
| 26-Jun-2024 |
Vladimir Kondratyev <wulf@FreeBSD.org> |
LinuxKPI: Add DEFINE_DEBUGFS_ATTRIBUTE_SIGNED to linux/debugfs.h
Sponsored by: Serenity CyberSecurity, LLC MFC after: 1 week Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D456
LinuxKPI: Add DEFINE_DEBUGFS_ATTRIBUTE_SIGNED to linux/debugfs.h
Sponsored by: Serenity CyberSecurity, LLC MFC after: 1 week Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D45615
show more ...
|
| #
fdafd315
|
| 24-Nov-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Automated cleanup of cdefs and other formatting
Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row.
Remov
sys: Automated cleanup of cdefs and other formatting
Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row.
Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/
Sponsored by: Netflix
show more ...
|
| #
95ee2897
|
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove $FreeBSD$: two-line .h pattern
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
|
| #
af393426
|
| 22-Oct-2022 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: add a no-op generic_file_llseek()
This is needed for debugfs implementations in drivers.
Sponsored by: The FreeBSD Foundation MFC after: 3 days OKed by: jfree Differential Revision: https
LinuxKPI: add a no-op generic_file_llseek()
This is needed for debugfs implementations in drivers.
Sponsored by: The FreeBSD Foundation MFC after: 3 days OKed by: jfree Differential Revision: https://reviews.freebsd.org/D37092
show more ...
|
| #
f697b943
|
| 20-Sep-2022 |
Jake Freeland <jfree@FreeBSD.org> |
linuxkpi: drm-kmod debugfs support
This diff extends LinuxKPI to support simple attribute files in debugfs. These simple attributes are an essential component for compiling drm-kmod with CONFIG_DEBU
linuxkpi: drm-kmod debugfs support
This diff extends LinuxKPI to support simple attribute files in debugfs. These simple attributes are an essential component for compiling drm-kmod with CONFIG_DEBUG_FS enabled. This will allow for easier graphics driver debugging using Intel's igt-gpu-tools.
Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D35883 Sponsored by: Google, Inc. (GSoC 2022)
show more ...
|
| #
307f78f3
|
| 19-Dec-2021 |
Vladimir Kondratyev <wulf@FreeBSD.org> |
LinuxKPI: Constantly use _LINUXKPI_ prefix in include guards
MFC after: 1 week Reviewed by: bz, emaste, hselasky, manu Differential Revision: https://reviews.freebsd.org/D33562
|
| #
f1a7639a
|
| 04-Dec-2021 |
Vladimir Kondratyev <wulf@FreeBSD.org> |
LinuxKPI: Add some typical header pollution
To reduce amount of drm-kmod patching
MFC after: 1 week Reviewed by: hselasky, manu Differential Revision: https://reviews.freebsd.org/D33297
|
| #
41dee251
|
| 25-Oct-2021 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: add simple_open() to fs.h
Add a dummy simple_open() to fs.h as we have for other (unsupported) functions. This is needed by a wireless driver.
MFC after: 3 days Reviewed by: hselasky Diff
LinuxKPI: add simple_open() to fs.h
Add a dummy simple_open() to fs.h as we have for other (unsupported) functions. This is needed by a wireless driver.
MFC after: 3 days Reviewed by: hselasky Differential Revision: https://reviews.freebsd.org/D32642
show more ...
|
| #
a81b36c6
|
| 29-Sep-2021 |
Vladimir Kondratyev <wulf@FreeBSD.org> |
LinuxKPI: Implement get_file_rcu()
get_file_rcu() grabs a file if the file->f_count is not zero.
Required by drm-kmod 5.6
Reviewed by: hselasky, manu (previous version) MFC after: 2 weeks Differen
LinuxKPI: Implement get_file_rcu()
get_file_rcu() grabs a file if the file->f_count is not zero.
Required by drm-kmod 5.6
Reviewed by: hselasky, manu (previous version) MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D31672
show more ...
|
| #
a91b408a
|
| 02-Oct-2020 |
Emmanuel Vadot <manu@FreeBSD.org> |
linuxkpi: Add dmi_* function
dmi function are used to get smbios values. The DRM subsystem and drivers use it to enabled (or not) quirks.
Reviewed by: hselasky Sponsored by: The FreeBSD Foundation
linuxkpi: Add dmi_* function
dmi function are used to get smbios values. The DRM subsystem and drivers use it to enabled (or not) quirks.
Reviewed by: hselasky Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26046
show more ...
|
| #
1a180032
|
| 01-Sep-2020 |
Mateusz Guzik <mjg@FreeBSD.org> |
compat: clean up empty lines in .c and .h files
|
| #
e2515283
|
| 27-Aug-2020 |
Glen Barber <gjb@FreeBSD.org> |
MFH
Sponsored by: Rubicon Communications, LLC (netgate.com)
|
| #
e81829d0
|
| 16-Aug-2020 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r364264 through r364278.
|
| #
a92a971b
|
| 16-Aug-2020 |
Mateusz Guzik <mjg@FreeBSD.org> |
vfs: remove the thread argument from vget
It was already asserted to be curthread.
Semantic patch:
@@
expression arg1, arg2, arg3;
@@
- vget(arg1, arg2, arg3) + vget(arg1, arg2)
|
| #
24a22d1d
|
| 22-Feb-2020 |
Dimitry Andric <dim@FreeBSD.org> |
Merge r358179 through r358238.
PR: 244251
|
| #
1179b649
|
| 21-Feb-2020 |
Emmanuel Vadot <manu@FreeBSD.org> |
linuxkpi: Move shmem related functions in it's own file
For drmkpi (D23085) we don't want the Linux struct file as we don't emulate everything. Also the prototypes should be in shmem_fs.h to have 10
linuxkpi: Move shmem related functions in it's own file
For drmkpi (D23085) we don't want the Linux struct file as we don't emulate everything. Also the prototypes should be in shmem_fs.h to have 100% compatibility with Linux.
Reviewed by: hselasky MFC after: Maybe Differential Revision: https://reviews.freebsd.org/D23764
show more ...
|
| #
18b18078
|
| 25-Feb-2019 |
Enji Cooper <ngie@FreeBSD.org> |
MFhead@r344527
|
| #
a8fe8db4
|
| 25-Feb-2019 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r344178 through r344512.
|