| #
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 ...
|
| #
43b5a264
|
| 09-Aug-2025 |
Jean-Sébastien Pédron <dumbbell@FreeBSD.org> |
linuxkpi: Add option to skip trailing newline in `lkpi_hex_dump()`
This will be useful in the upcoming implementation of `hex_dump_to_buffer()` which doesn't add one.
Reviewed by: bz, emaste Sponso
linuxkpi: Add option to skip trailing newline in `lkpi_hex_dump()`
This will be useful in the upcoming implementation of `hex_dump_to_buffer()` which doesn't add one.
Reviewed by: bz, emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D51844
show more ...
|
| #
cdfdafdc
|
| 20-Jun-2025 |
Jean-Sébastien Pédron <dumbbell@FreeBSD.org> |
linuxkpi: Define `DEFINE_SHOW_STORE_ATTRIBUTE()`
It is the same as `DEFINE_SHOW_ATTRIBUTE()` with a `write` function added.
The i915 DRM driver started to use it in Linux 6.9.
Reviewed by: manu Sp
linuxkpi: Define `DEFINE_SHOW_STORE_ATTRIBUTE()`
It is the same as `DEFINE_SHOW_ATTRIBUTE()` with a `write` function added.
The i915 DRM driver started to use it in Linux 6.9.
Reviewed by: manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D50992
show more ...
|
| #
4359672e
|
| 02-Apr-2025 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: add seq_hex_dump()
Move the implementation of print_hex_dump() into linux_compat.c as lkpi_hex_dump() taking an extra function pointer and argument. Add two internal wrappers for printf an
LinuxKPI: add seq_hex_dump()
Move the implementation of print_hex_dump() into linux_compat.c as lkpi_hex_dump() taking an extra function pointer and argument. Add two internal wrappers for printf and sbuf_printf to get a common function definition (sbuf_printf takes the extra argument).
Use these to implement print_hex_dump() and the newly added seq_hex_dump().
This allows us to re-use the same implementation of print_hex_dump() for both functions without duplicating the code.
Initial implementation: D49381 by dumbbell Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D49637
show more ...
|
| #
d6d1e73e
|
| 09-Dec-2023 |
Jean-Sébastien Pédron <dumbbell@FreeBSD.org> |
linuxkpi: Include <linux/string_helpers.h> from <linux/seq_file.h>
[Why] The i915 DRM driver in Linux 5.18 relies on this indirect include.
Reviewed by: manu Approved by: manu Differential Revision
linuxkpi: Include <linux/string_helpers.h> from <linux/seq_file.h>
[Why] The i915 DRM driver in Linux 5.18 relies on this indirect include.
Reviewed by: manu Approved by: manu Differential Revision: https://reviews.freebsd.org/D43030
show more ...
|
| #
95ee2897
|
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove $FreeBSD$: two-line .h pattern
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
|
| #
4d846d26
|
| 10-May-2023 |
Warner Losh <imp@FreeBSD.org> |
spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of
spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause.
Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
show more ...
|
| #
5fbfe951
|
| 20-Feb-2023 |
Jean-Sébastien Pédron <dumbbell@FreeBSD.org> |
linuxkpi: Define `seq_has_overflowed()` and `single_open_size()`
This required non-trivial changes to `linux_seq_file.c` to manage a new `(struct seq_file)->size` field. This field is read directly
linuxkpi: Define `seq_has_overflowed()` and `single_open_size()`
This required non-trivial changes to `linux_seq_file.c` to manage a new `(struct seq_file)->size` field. This field is read directly by DRM drivers, so we can't alias it to a call to sbuf_len(9).
`single_open_size()` also depended on the ability to allocate the sbuf with a specified size instead of relying on `sbuf_new_auto()`.
Reviewed by: manu Approved by: manu Differential Revision: https://reviews.freebsd.org/D39056
show more ...
|
| #
b5a81075
|
| 22-Oct-2022 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: seq_file add "private" versions.
Add __seq_open_private() and seq_release_private() needed by iwlwifi debugfs support.
Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by:
LinuxKPI: seq_file add "private" versions.
Add __seq_open_private() and seq_release_private() needed by iwlwifi debugfs support.
Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D37089
show more ...
|
| #
cbda8bed
|
| 20-Sep-2022 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
linuxkpi: Resolve duplicate global symbol name to fix LINT kernel build.
seq_printf() is defined in both spl_procfs_list.c and linux_seq_file.c . Fix this by renaming the LinuxKPI ones and use macro
linuxkpi: Resolve duplicate global symbol name to fix LINT kernel build.
seq_printf() is defined in both spl_procfs_list.c and linux_seq_file.c . Fix this by renaming the LinuxKPI ones and use macros to invoke the correct function.
Reported by: jfree@ Differential Revision: https://reviews.freebsd.org/D35883 MFC after: 1 week Sponsored by: NVIDIA Networking
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
|
| #
0269ae4c
|
| 06-Jun-2019 |
Alan Somers <asomers@FreeBSD.org> |
MFHead @348740
Sponsored by: The FreeBSD Foundation
|
| #
6a65ca35
|
| 16-May-2019 |
Johannes Lundberg <johalun@FreeBSD.org> |
LinuxKPI: Finalize import of seq_file.
seq_file.h and linux_seq_file.c was imported form ports earlier but linux_seq_file.c was never compiled in with the module. With this commit base seq_file will
LinuxKPI: Finalize import of seq_file.
seq_file.h and linux_seq_file.c was imported form ports earlier but linux_seq_file.c was never compiled in with the module. With this commit base seq_file will replace ports seq_file and it required a few modifications to not break functionality and build.
Reviewed by: hps Approved by: imp (mentor), hps MFC after: 1 week
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.
|
| #
3f6cab07
|
| 23-Feb-2019 |
Matt Macy <mmacy@FreeBSD.org> |
import linux debugfs support
Reviewed by: hps@ MFC after: 1 week Sponsored by: iX Systems Differential Revision: https://reviews.freebsd.org/D19258
|
| #
43b5a264
|
| 09-Aug-2025 |
Jean-Sébastien Pédron <dumbbell@FreeBSD.org> |
linuxkpi: Add option to skip trailing newline in `lkpi_hex_dump()`
This will be useful in the upcoming implementation of `hex_dump_to_buffer()` which doesn't add one.
Reviewed by: bz, emaste Sponso
linuxkpi: Add option to skip trailing newline in `lkpi_hex_dump()`
This will be useful in the upcoming implementation of `hex_dump_to_buffer()` which doesn't add one.
Reviewed by: bz, emaste Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D51844
show more ...
|
| #
cdfdafdc
|
| 20-Jun-2025 |
Jean-Sébastien Pédron <dumbbell@FreeBSD.org> |
linuxkpi: Define `DEFINE_SHOW_STORE_ATTRIBUTE()`
It is the same as `DEFINE_SHOW_ATTRIBUTE()` with a `write` function added.
The i915 DRM driver started to use it in Linux 6.9.
Reviewed by: manu Sp
linuxkpi: Define `DEFINE_SHOW_STORE_ATTRIBUTE()`
It is the same as `DEFINE_SHOW_ATTRIBUTE()` with a `write` function added.
The i915 DRM driver started to use it in Linux 6.9.
Reviewed by: manu Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D50992
show more ...
|
| #
4359672e
|
| 02-Apr-2025 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: add seq_hex_dump()
Move the implementation of print_hex_dump() into linux_compat.c as lkpi_hex_dump() taking an extra function pointer and argument. Add two internal wrappers for printf an
LinuxKPI: add seq_hex_dump()
Move the implementation of print_hex_dump() into linux_compat.c as lkpi_hex_dump() taking an extra function pointer and argument. Add two internal wrappers for printf and sbuf_printf to get a common function definition (sbuf_printf takes the extra argument).
Use these to implement print_hex_dump() and the newly added seq_hex_dump().
This allows us to re-use the same implementation of print_hex_dump() for both functions without duplicating the code.
Initial implementation: D49381 by dumbbell Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D49637
show more ...
|
| #
d6d1e73e
|
| 09-Dec-2023 |
Jean-Sébastien Pédron <dumbbell@FreeBSD.org> |
linuxkpi: Include <linux/string_helpers.h> from <linux/seq_file.h>
[Why] The i915 DRM driver in Linux 5.18 relies on this indirect include.
Reviewed by: manu Approved by: manu Differential Revision
linuxkpi: Include <linux/string_helpers.h> from <linux/seq_file.h>
[Why] The i915 DRM driver in Linux 5.18 relies on this indirect include.
Reviewed by: manu Approved by: manu Differential Revision: https://reviews.freebsd.org/D43030
show more ...
|
| #
95ee2897
|
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove $FreeBSD$: two-line .h pattern
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
|
| #
4d846d26
|
| 10-May-2023 |
Warner Losh <imp@FreeBSD.org> |
spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of
spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause.
Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
show more ...
|
| #
5fbfe951
|
| 20-Feb-2023 |
Jean-Sébastien Pédron <dumbbell@FreeBSD.org> |
linuxkpi: Define `seq_has_overflowed()` and `single_open_size()`
This required non-trivial changes to `linux_seq_file.c` to manage a new `(struct seq_file)->size` field. This field is read directly
linuxkpi: Define `seq_has_overflowed()` and `single_open_size()`
This required non-trivial changes to `linux_seq_file.c` to manage a new `(struct seq_file)->size` field. This field is read directly by DRM drivers, so we can't alias it to a call to sbuf_len(9).
`single_open_size()` also depended on the ability to allocate the sbuf with a specified size instead of relying on `sbuf_new_auto()`.
Reviewed by: manu Approved by: manu Differential Revision: https://reviews.freebsd.org/D39056
show more ...
|
| #
b5a81075
|
| 22-Oct-2022 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
LinuxKPI: seq_file add "private" versions.
Add __seq_open_private() and seq_release_private() needed by iwlwifi debugfs support.
Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by:
LinuxKPI: seq_file add "private" versions.
Add __seq_open_private() and seq_release_private() needed by iwlwifi debugfs support.
Sponsored by: The FreeBSD Foundation MFC after: 3 days Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D37089
show more ...
|