Linux kernel mentorship experience - summer 2022
Around the start of May 2022, I was browsing through the mentorships on the linux foundation site, and I came across the Linux kernel bug fixing mentorship summer 2022. I had just decided to learn more about the linux kernel, so this was a great chance to proceed ahead on my goal. I applied to the program and was selected after the initial screening round. I will share my experience of being a part of the 3 month program.
In the initial part of the program, I started by learning about event tracing, static analysis, dynamic analysis and fuzzing, since these techniques are the main techniques used for finding and fixing bugs. Once I was familiar with the basic debugging techniques, I started looking for the bugs. Since the kernel is a huge and complex codebase, our mentors - Shuah Khan and Pavel Skripkin suggested us to explore all the subsystems and then start working on our areas of interest. So, I started exploring various areas of the kernel and contributed by fixing static analysis warnings in various parts of the kernel. Along with this, I was also exploring the various subsystems of the kernel. Finally, I decided to work on kselftests, memory management, and syzbot bugs.
I started to work on the kselftests by running each selftest and trying to find bugs and missed cases. I started by improving documentation and error messages. Gradually, as I learned more, I started looking the tests for each subsystem. When I attempted to run the damon tests, I noticed that all the tests were skipped without providing the reason. So I started digging and figured out the cause. I sent a patch to add the new tests and it was accepted.
Next, I started looking at syzbot bugs. I scanned through many bugs before I came across a bug which I thought I could work on. The bug involved the block layer and the nbd driver. So I started learning about the block layer - how it handles the bio requests, the working of blk_mq layer and so on. I worked on the bug for a few weeks, but all the approaches I tried led me into rabbit holes. Since it looked to be a complex race condition, I decided to learn more before giving it a shot again.
So I continued working with kselftests and damon - data access monitoring framework to improve memory management performance. For kselftests, I decided to look at the TODOs that have been left there by other developers. I worked on refactoring a piece of code in ipsec tests in selftests/net, which was responsible for checking the cryptography algorithm used. I sent out a patch for this, which was accepted. Next, I wanted to contribute to damon, so I started looking at damon tests. I noticed that some of the tests are located out of the tree, so I started learning about them. I worked on adding hugepage support to masim, so that masim can simulate memory access workloads on hugepages. Next, I added a hugepage test to damon-tests by utilizing the hugepage support in masim. This test ensures that access to hugepages can be recorded and validated.
I also improved another test - mode_filter_without_nnp in the seccomp selftests section. In the file seccomp_bpf.c, there is a piece of code that can be only executed by a user who has the capability CAP_SYS_ADMIN. However, the code only checked if the function geteuid() returned a value greater than zero, which is not exactly accurate. So I added support to instead check if the process executing this code has CAP_SYS_ADMIN capability.
Overall, the Linux kernel mentorship program has been an excellent learning opportunity for me, especially with awesome mentors who guided us throughout the program. Furthermore, the kernel community is very welcoming to new developers, which definitely is an encouraging aspect. I learned a lot, identified my areas of interest and I aim to continue to improve on them by working as a kernel developer.