Embedded data structures are a common occurrence in Linux Kernel code. Use-after-free errors can easily creep in when they include multiple ref-counted objects with different lifetimes if the data structure is released prematurely. This article will explore some of the problems commonly encountered with lifetime management of embedded data structures when writing Kernel code, and it will cover some essential steps you can follow to prevent these issues from creeping into your own code. What Makes Embedded Structure Lifetime so Complicated? Let’s look at a few examples of embedded structures. Structure A embeds structure B, structure B embeds structure C, and structure C embeds structures D and E. There is no problem as long as all these structures have identical lifespans and the structure memory can be released all at once. If structure D has a different lifespan overall or in some scenarios, then when structure A goes away, structure […]
I’m setting up a new system at work, and yet again found myself faced with trying to nut out which driver corresponds to which device, so I can figure out what’s wrong with the touchpad and keyboard hotkeys. I’m also curious what wired and wireless drivers are in use and if there’s any unneeded power sucks I could eliminate to increase battery life. This article will show you a quick hack I put together to identify the drivers my laptop uses so I can search for information about them on the web.