NerdResa utilise witches.town. Vous pouvez læ suivre et interagir si vous possédez un compte quelque part dans le "fediverse".

I might try to teach myself kernel hacking soon, specifically TCP.
Does anyone have any suggestions where to start and what to read?
I know C, but so far only in user space.

NerdResa @NerdResa

Should have specified that:
I'm interested to hack the Linux kernel.
I've done low-level user space hacking in C on Linux. Now wondering how much additional knowledge I need for Linux kernel stuff…

@NerdResa The Linux Device Drivers book is available online under Creative Commons and works for many people as a way to get started:

lwn.net/Kernel/LDD3/

There are repositories on GitHub with the examples updated to newer kernel versions, e.g.

github.com/martinezjavier/ldd3

My advice would be to find some area that interests you or an itch to scratch and read a lot of code. I started with the crypto subsystem (Ripemd algo) and the code got merge surprisingly quickly :p

@Kensan Thanks, I'll take a look at it!
My area is Networking, specifically TCP. (Don't worry, I'm not trying to get this upstream)

@NerdResa @Kensan Unfortunately the Linux Device Drivers book covers very little of the networking stack, because it's focused on things developers need to know to write… well, device drivers. 😅 But the first eight chapters may have good context for Linux kernel hacking in general, and the network drivers chapter should at least cover some of the abstractions that are shared with the higher layers.

@NerdResa The bible there is „Understanding Linux Network Internals“ but it had aged quite a bit and is not free.

Now if you are not set in Linux and are open to consider FreeBSD or even the MirageOS TCP/IP stack then I am sure @hannesm can give you some pointers ;)

@NerdResa @Kensan for me the stevens is still a very good book on tcp/ip and how to implement it

@NerdResa @Kensan from the theory side, i suggest cl.cam.ac.uk/~pes20/Netsem/pap and the full label transition system cl.cam.ac.uk/~pes20/Netsem/all -- but this doesn't contain anything about kernel programming, just tcp/ip.. ;)

@NerdResa You probably don't need anything more to start hacking. You will see, however, a lot of kernel specific programming patterns and utilities: lists, rcu, offsetof, macros (tons of them) etc. Always look at two implementations of object of the same class like TCP and SCTP to find patterns in the interfacing code.

@steelman That sounds helpful, thanks! :)

@NerdResa if you have an idea of what you want to hack on just jump in and try to make it work. Enjoy the discovery, you can worry about doing-things-the-right-way-TM later...

Ofc things may go horribly wrong, but it's easier to find help with a practical problem later on :)

@NerdResa hm maybe mobile.twitter.com/alicegoldfu can give some advice. Afaik she's starting in the topic as well.

@NerdResa The best introductory/tutorial material I'm aware of for getting started on Linux kernel hacking is the first-patch documentation for Outreachy internship applicants: kernelnewbies.org/Outreachyfir

Most of the Linux kernel is plain C, with some caveats: 1) Linux kernel developers often use obscure corners of the language standard as well as GCC/clang-specific extensions; 2) the standard library is not available, so e.g. there's kmalloc not malloc, etc.

@NerdResa Also you may find kernel.org/doc/ helpful as reference material. Alternatively you can find a fair amount of the same material in your kernel source tree checkout under the Documentation/ directory. I often use `git grep` on either the Documentation/ or include/ directory when I see a function I don't understand.

@jamey Oooh, I was looking for something like this! Thank you *-*

@NerdResa There's some amount of material you'll need to learn but depending on what you want to do it might not be all that much. A lot of kernel stuff has analogies in userspace, just with different names.

It helps to do some reading about fundamental kernel concepts before diving into code. I have some slightly outdated linux 2.6-ish kernel development books collecting dust on my shelf which I could drop off somewhere at TU for you if you want.

@stsp Yea, I think the thing I'm planning to do isn't actually that much, but I'm not sure yet. Usually I'd read a book but I don't think I've got enough time, I'll just start hacking. :)
Thanks for the offer though, I might get back to it.