I am writing an LSM, and I am compiling it using my kernel 6.2.0-20-generic. When I browse the files in /lib/modules/6.2.0-20-generic/build, I can see that there is a struct named lsm_id. But When I examine the recent Linux source tree in Github, I can not see this struct. I tried downloading a different version but I could not find this struct anywhere in any of the Linux kernel source codes.

I can see that there is a patch that has been released this year but I am not sure why I can not see it in the source tree and how it got in my kernel source code in /lib/modules? I want to have the source code of the kernel with patches applied, is there any way to get that?

Link for the patch https://patchwork.kernel.org/project/linux-security-module/patch/[email protected]/


  • 1
    Reading the discussion on kernel.org about this topic (ending in lore.kernel.org/lkml/… ) involving greg k-h, I fear that chances that this patch ever made its way to commit are very… poor.
    – MC68020
    Aug 10, 2023 at 17:47
  • Thanks @MC68020
    – maysara
    Aug 11, 2023 at 1:45

1 Answer 1


The structure is present because Ubuntu applies the relevant patches to its kernel.

The easiest way to get a complete, patched source tree for your kernel is to install the linux-source-6.2.0 package.

  • Thank you Stephen! Does this mean that an LSM developer has to write now different code to support Ubuntu changes? Also is there any chance that this gets merged into the main source tree of the kernel or no? Thanks!
    – maysara
    Aug 11, 2023 at 1:45
  • I’m not familiar enough with the patch set in question to answer either of those questions, sorry. Aug 11, 2023 at 6:54
  • 1
    @maysara : As you can read it, this patch won't be accepted as is. However, the door is left open. If the author provides another version successfully addressing the points greg k-h highlighted, the adequately modified version of the patch will be committed to the source tree (and eventually backported).
    – MC68020
    Aug 11, 2023 at 10:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .