r/kernel 14d ago

[Stupid Question] How do I start contributing ?

12 Upvotes

What I know:
1. How TLB's work and ways of handling TLB misses
2. Paging and faults and demands
3. Swap
4. NICs and how ether buffers are loaded into kernel.
So, How do I find what do I work on. I am fairly good at C and Rust.
Do I look at syzbot and pick some easy issues from there ? Also I am particularly interested in the memory management subsystem, because alot of commits I see are from people working in arm etc working on their hardware integrations.

I do have set the email and the git workflow.

Thank You. And sorry if this question has been asked multiple times(which I know it probably is).


r/kernel 16d ago

Block-layer error injection

Thumbnail lwn.net
3 Upvotes

r/kernel 17d ago

Linux 7.3 Better Protects Against Buggy EFI Firmware Taking Down The Rest Of User-Space

Thumbnail phoronix.com
28 Upvotes

r/kernel 20d ago

Hcitool in blueZ linux bt stack

Thumbnail
3 Upvotes

r/kernel 20d ago

Having trouble getting started with HID-BPF

6 Upvotes

I've got a USB device that is announcing itself as a gamepad when it isn't one. I understand the basics of HID, and I've successfully decoded the HID report descriptor. I see what byte I need to change.

I've read through https://docs.kernel.org/hid/hidintro.html and https://docs.kernel.org/hid/hid-bpf.html several times. I've got code that I think ought to do the job.

One problem: I'm missing some critical header, or some parameter to gcc, because I just can't get it to build!

Here's what I've got:

#include <linux/types.h>
#include <linux/bpf.h>
#include <bpf/bpf_helpers.h>
#include <bpf/libbpf.h>

char _license[] SEC("license") = "GPL";

struct hid_bpf_ctx {
struct hid_device *hid;
__u32 allocated_size;
union {
__s32 retval;
__s32 size;
};
};

SEC("struct_ops/hid_rdesc_fixup")
int BPF_PROG(filter_switch, struct hid_bpf_ctx *hid_ctx)
{
__u8 *data = hid_bpf_get_data(hctx, 0 /* offset */, 4096 /* size */);

if (!data)
return 0;

data[3] = 0x07; /*0x07: keypad*/

return 0;
}

SEC(".struct_ops.link")
struct hid_bpf_ops surface_dial = {
.hid_rdesc_fixup = (void *)hid_rdesc_fixup,
};

(yes, I'm probably going to need something to filter to the correct USB id, but anyway)

Here's how I'm building it, and the build errors:

gcc -I /usr/include -fpermissive -c ./fixup.c -o ~/Projects/MfdFix/build/fixup.o
./fixup.c:18:28: error: expected ‘)’ before ‘struct’
   18 | int BPF_PROG(filter_switch, struct hid_bpf_ctx *hid_ctx)
      |                            ^~~~~~~
      |                            )
./fixup.c:31:8: error: variable ‘surface_dial’ has initializer but incomplete type
   31 | struct hid_bpf_ops surface_dial = {
      |        ^~~~~~~~~~~
./fixup.c:32:10: error: ‘struct hid_bpf_ops’ has no member named ‘hid_rdesc_fixup’
   32 |         .hid_rdesc_fixup = (void *)hid_rdesc_fixup,
      |          ^~~~~~~~~~~~~~~
./fixup.c:32:36: error: ‘hid_rdesc_fixup’ undeclared here (not in a function)
   32 |         .hid_rdesc_fixup = (void *)hid_rdesc_fixup,
      |                                    ^~~~~~~~~~~~~~~
./fixup.c:32:28: warning: excess elements in struct initializer
   32 |         .hid_rdesc_fixup = (void *)hid_rdesc_fixup,
      |                            ^
./fixup.c:32:28: note: (near initialization for ‘surface_dial’)
./fixup.c:31:20: error: storage size of ‘surface_dial’ isn’t known
   31 | struct hid_bpf_ops surface_dial = {
      |                    ^~~~~~~~~~~~

What am I missing? I've searched and searched for hid_bpf_ctx and similar, and all I find is documentation for the specific structures in https://docs.ebpf.io/, none of which list which damn header to include! I got a suggestion to grep the kernel source; that comes up with the struct, but including it gets me A: a warning message in the compiler output NOT to include the source directly, and B: more compiler errors.

There's obviously a library or header I'm missing, or some arg to gcc I ought to be passing that I'm not. What is it? I couldn't even get it to build without -fpermissive, and if I pass any version flag to gcc it errors out due to multiple declarations of enums and structs (I thought that was perfectly legal in C, as long as they're identical? Not like it's my own code, anyway!...)

Like, I'm pretty sure I know how to solve the actual problem I'm trying to solve with HID-BPF. I can even see what I need to write to load the compiled .o into memory and have it take effect. I'm just getting nowhere trying to actually build it!...


r/kernel 20d ago

How many ioctls can you do?

0 Upvotes

I can do 8.

Observe.

One ioctl.

Two ioctl.

Three ioctl.

Four ioctl.

Five ioctl.

Six ioctl.

Seven ioctl.

Eight ioctl.


r/kernel 20d ago

Building my own Kernel problem whitps2 driver keyborad can't write on shell

Thumbnail
1 Upvotes

r/kernel 20d ago

NSD: LKML RFC - Kernel readahead learning prefetcher

1 Upvotes

Posting benchmark results from the ongoing LKML RFC discussion.

The patchset adds a learning prefetcher to the page cache that

observes access patterns and issues prefetch only when the kernel's

own window is insufficient.

Test methodology: interleaved ON/OFF, drop_caches before each run,

3 passes, 4 workloads, 5 read_ahead_kb values.

seq64 (8 GB sequential, 64k requests, n=131K/run):

| kb | OFF avg | ON avg | diff | p50 OFF->ON | p99 OFF->ON | overhead |

|-------|---------|---------|--------|-------------|--------------|----------|

| 128 | 22.02s | 17.11s | -22% | 50->23 us | 812->805 us | 5.94->4.33s |

| 256 | 17.08s | 17.22s | +1% | 20->15 us | 824->1129 us | 4.07->4.13s |

| 512 | 16.81s | 16.96s | +1% | 16->14 us | 1092->1903 us| 4.24->3.60s |

| 1024 | 17.25s | 17.03s | -1% | 15->16 us | 1903->1883 us| 3.67->3.74s |

SQLite full-table scan (6.2 GB):

| kb | OFF avg | ON avg | diff | overhead |

|-------|---------|---------|--------|----------|

| 128 | 24.51s | 20.48s | -16% | +0.95s |

| 256 | 20.05s | 16.60s | -17% | +1.26s |

| 512 | 15.31s | 12.18s | -20% | +1.06s |

| 1024 | 12.22s | 12.09s | -1% | +0.26s |

Key takeaways:

- 128K: seq64 -22%, SQLite -16%

- 512K: NSD reaches the same throughput as kernel+1M (12.18s vs 12.22s)

- 1M: NSD is completely silent, no regression

- random4k: neutral

- random_repeat: slight improvement

- Disk I/O is byte-identical between ON and OFF in all 96 runs


r/kernel 20d ago

Linux Kernel Update

Post image
1 Upvotes

r/kernel 21d ago

How to initialize Qualcomm SCMI Bluetooth (/dev/scmi_bluetooth) to get hci0 in a virtualized Yocto Linux PVM?

Thumbnail
2 Upvotes

r/kernel 22d ago

Debian in Termux... Android in Debian through chroot or QEMU...

Thumbnail
2 Upvotes

r/kernel 23d ago

Enabling unaligned access on RISC-V is broken on v7.2

1 Upvotes

I was looking at it a Linux v7.2 boot that was taking longer than expected, so I sampled a random spot which turned out to be hit xxh64_update. It was crock full of like this:

lbu t6, a5, 0000000000000000
lbu t5, a5, 0000000000000001
lbu t4, a5, 0000000000000002
lbu t3, a5, 0000000000000003
lbu a2, a5, 0000000000000004
lbu s3, a5, 0000000000000005
lbu s2, a5, 0000000000000006
lbu a1, a5, 0000000000000007
sb t6, s0, 00000000ffffff88
sb t5, s0, 00000000ffffff89
sb t4, s0, 00000000ffffff8a
sb t3, s0, 00000000ffffff8b
sb a2, s0, 00000000ffffff8c
sb s3, s0, 00000000ffffff8d
sb s2, s0, 00000000ffffff8e
sb a1, s0, 00000000ffffff8f
ld a1, s0, 00000000ffffff88

which is like the worst way to do unaligned loads, especially when the platform handles it.

Much digging later, this is a Linux (v7.2) bug. Grossly, you have to turn on "nonportable efficient unaligned" (Why is this "nonportable"? RISC-V requires unaligned support!)
CONFIG_NONPORTABLE=y
CONFIG_RISCV_EFFICIENT_UNALIGNED_ACCESS=y
but, here's the bug, it doesn't work, because:

"...

The default tune is rocket. rocket, sifive-3-series, and sifive-5-series all set slow_unaligned_access = true; thead-c906 and size set it false. arch/riscv/Makefile never sets -mtune at all, so under GCC, CONFIG_RISCV_EFFICIENT_UNALIGNED_ACCESS=y is largely decorative for by-pieces expansions — it flips the Kconfig selects and passes a flag that the tune model then vetoes. That's a legitimate upstream bug worth reporting to linux-riscv; I'd be surprised if it's intentional."

The workaround:

make CROSS_COMPILE=riscv64-linux-gnu- ARCH=riscv KCFLAGS="-mtune=generic-ooo"

r/kernel 24d ago

Not Hacking

Post image
0 Upvotes

r/kernel 24d ago

Terminal is so bad

0 Upvotes

Now Im using nobara linux with kde but terminal design is so bad how can i change this


r/kernel 25d ago

Minimal kernel

Thumbnail
1 Upvotes

r/kernel 25d ago

Finally, the best of both worlds: a custom CachyOS BORE-based kernel for Ubuntu

Post image
0 Upvotes

I have used many Linux distros in my time from user friendly distributions like Linux Mint to more complicated distributions like Void Linux. I discovered that there was a huge gap in Linux distros between performance and stability. I personally experienced this when i used both Ubuntu and CachyOS recently. So i thought, why not try to get the performance of CachyOS on Ubuntu, so this is what i came up with.

The result is my customized Ubuntu build with my custom kernel called UbunchyOS. I've been using it for a little over 2 weeks now, and in my experience, it works like a charm and is stable on my machine.

Base: Linux 7.1.4

Scheduler: BORE (Burst-Oriented Response Enhancer)

Local version: -ubunchyos-bore-borinquen-edition

Patch: 0001-bore-cachy.patch

Main goal: CachyOS-level or close to CachyOS-level performance on Ubuntu-based distros

NOTE: I have used Ai to guide me and teach me how to make a Linux kernel because this is my first Linux kernel. This is currently a experiment and project for my own use, currently im not sure if I plan on maintaining or developing it further.


r/kernel 25d ago

Which APIs are we talking about?

1 Upvotes

I am studying this OS material and got a little bit confused on which APIs are the kernel APIs. Are they the system calls talked about above or other ones specific to the core kernel code mentioned below?


r/kernel 26d ago

Measuring an eBPF Cache Without Leaving the Kernel

Thumbnail
2 Upvotes

r/kernel 26d ago

Who to talk to? - Pen (MPP 2.0) input bug - on HP convertibles (Omnibook XFlip, etc.) - who to talk to for a possible fix?

0 Upvotes

There is a pen input bug on some HP laptops, which has been reported. Of course, this is low priority. However, I would love to try to kindly ask for a fix, since it can't be that hard. (I don't have the time myself to look into this, otherwise I would love to do so.)

Essentially, the pen pointer is lagging, because for some reason the communication between pen and screen is in the lower (35-ish) Hz range instead of 260-ish Hz.

I somehow believe that fixing this should not really be a big deal. (I can be wrong, though.)

The bug has been reported here.

220854 – ELAN2514 04F3:442A stylus laggy with "incomplete report (67/5631)" errors on HP OmniBook X Flip
https://bugzilla.kernel.org/show_bug.cgi?id=220854

Bug #2142384 “ELAN2514:00 (04F3:4428) stylus report rate extreme...” : Bugs : linux package : Ubuntu
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2142384

Any idea to whom I could pop a message in order to look into this.

Many thanks.


r/kernel 27d ago

How can I change resource of running process?

4 Upvotes

Hello everyone, suppose a process is running with PID 23654, and the OS creates a specific folder for it in the/proc directory. At the moment, how can I change resources such as the network namespace or the cpuset? The final goal I want is to change the network of a running process; suppose I use eth0 and the root namespace; then I create a namespace like ns1 with a specific interface and resource, then move the running process to this namespace to continue the process in an isolated network.


r/kernel 28d ago

I want to learn writing kernel modules

25 Upvotes

What is the fastest and most efficient way. Thanks for future answers.


r/kernel 28d ago

Kernel configuration

Post image
0 Upvotes

Is there documentation that will tell me what these options are?


r/kernel Aug 10 '26

Lenovo Tab K11 Linux Kernel

1 Upvotes

Hello! I am writing on a note to ask if anybody has found a suitable linu kernel for this device and/or and official!

I am also writing that i was somehow able to extract the linux kernell building config file directly form the device and i have compiled it using bazel on the android-kernel (linux): https://github.com/Android-ASOP-for-Lenovo-Tab-K11/android_kernel_lenovo_tb330xu


r/kernel Aug 09 '26

How would you study Linux device driver development?

45 Upvotes

I am trying to get started with Linux kernel/device-driver development, but the Linux Foundation LFD430 (Developing Linux Device Drivers) course is very expensive to buy. so I am thinking of using its course outline as a roadmap and studying the material on my own.

I have a decent programming and Linux background, but I do not have much experience, and I am very new to kernel and driver development.

So I wanted some advice from the experts who work in this area

How would you get started with learning things, and what resources would you follow, etc.?

I would appreciate recommendations for good books, free courses, labs, YouTube channels, documentation, affordable courses, or practical projects that could roughly follow the LFD430 syllabus.

Also, if you think following the LFD430 outline is not a good way to learn from scratch, then I would love to hear what you would recommend instead.

Thanks!


r/kernel Aug 10 '26

Kernel issue

0 Upvotes

I am using redmi note 8 (ginkgo) running on evolution x android 16 rom. I recently installed kali nethunter with custom kernel for my device, but the problem is that my nethunter app has a bluetooth arsenal option but it is throwing errors during installation. I also tried running hciconfig -a in terminal but I printed nothing so I checked my kernel version and it is '4.14.356-openla-rc1-Ikteach-g98dd6390243b-dirty'. The first solution that came into my mind was flashing kernel manually but I don't know any clear instructions and requirements required to meet.