How do I know which files will be included in a linux kernel before I build it?

backus

I am working on a project that includes building an old kernel version of linux. This is fine, but I still need to patch the kernel of all previously found security vulnerabilities based on CVEs. I have the CVEs and have extracted the names of the vulnerable files mentioned in them, along with the kernel versions it affects.

So far, I have found about 150 potential vulnerabilities that could affect my build, but obviously some of them affect files relevant to graphics drivers that I don't use. So far, I have just gone through the list manually, checking if the files are included by using make menuconfig, and cating Kconfig in relevant folders. This has worked alright so far, but these methods don't show the actual file names (e.g. ipc/sem.c) so it takes more work than necessary.

Ideally, I would like to somehow print a list of all the files that will be included in my build, and then just write a script to check if vulnerable files are included.

How can I find the names of ever source file (e.g. ipc/sem.c) that will be included in my build?

Gilles 'SO- stop being evil'

Do the build, then list the .o files. I think every .c or .S file that takes part in the build is compiled into a .o file with a corresponding name. This won't tell you if a security issue required a fix in a header file that's included in the build.

make vmlinux modules
find -name '*.o' -exec sh -c '
    for f; do for x in c S; do [ -e "${f%.o}.$x" ] && echo "${f%.o}.$x"; done; done
' _ {} +

A more precise method is to put the sources on a filesystem where access times are stored, and do the build. Files whose access time is not updated by the build were not used in this build.

touch start.stamp
make vmlinux modules
find -type f -anewer start.stamp

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How do I know which File Systems my linux supports?

From Dev

How do I know which kernel configuration option enabled my driver?

From Dev

How do I know which build of Chrome I'm running, 32bit or 64bit? How do I change it

From Dev

How do I know which value is selected

From Dev

Upon booting an Arch Linux installation media, how do I know which drive is which?

From Dev

How do I know which network controller I am using on Linux?

From Dev

How do I know if my linux kernel is running in 32bit or 64bit?

From Dev

How do I know what decompression algorithms are compiled-in into the linux kernel?

From Dev

How do I know which are the first characters before "/"? asp.net vb.net

From Dev

How do I install kernel header files?

From Dev

How do I install kernel header files?

From Dev

How do I know for sure which version of JAVAC Gradle used in a build?

From Dev

How do I build the iptables kernel module for a loaded kernel?

From Dev

How do I run the Linux kernel?

From Dev

Is this a Linux Kernel Crash? How do I resolve it?

From Dev

How do I compile the Linux kernel with Clang?

From Dev

How do I build in an exception to `::before`?

From Dev

How do I know which view is associated with which controller?

From Dev

GitFlow: How do I know which feature I am working on?

From Dev

How do I know which Mosh Client I am?

From Dev

How do I know which version of Debian I'm running?

From Dev

How do I know which modernizr part I need?

From Dev

how do i know my OpenCL kernel is running on the GPU?

From Dev

How do i get webdriver to see elements in included html files

From Dev

How can I know which type of process of linux will use for these?

From Dev

How can I know which type of process of linux will use for these?

From Java

How do I know what the standard location is for putting server files on Linux systems?

From Dev

How do I debug a kernel module in which a NULL pointer appears?

From Dev

How do I build a single in-tree kernel module?

Related Related

  1. 1

    How do I know which File Systems my linux supports?

  2. 2

    How do I know which kernel configuration option enabled my driver?

  3. 3

    How do I know which build of Chrome I'm running, 32bit or 64bit? How do I change it

  4. 4

    How do I know which value is selected

  5. 5

    Upon booting an Arch Linux installation media, how do I know which drive is which?

  6. 6

    How do I know which network controller I am using on Linux?

  7. 7

    How do I know if my linux kernel is running in 32bit or 64bit?

  8. 8

    How do I know what decompression algorithms are compiled-in into the linux kernel?

  9. 9

    How do I know which are the first characters before "/"? asp.net vb.net

  10. 10

    How do I install kernel header files?

  11. 11

    How do I install kernel header files?

  12. 12

    How do I know for sure which version of JAVAC Gradle used in a build?

  13. 13

    How do I build the iptables kernel module for a loaded kernel?

  14. 14

    How do I run the Linux kernel?

  15. 15

    Is this a Linux Kernel Crash? How do I resolve it?

  16. 16

    How do I compile the Linux kernel with Clang?

  17. 17

    How do I build in an exception to `::before`?

  18. 18

    How do I know which view is associated with which controller?

  19. 19

    GitFlow: How do I know which feature I am working on?

  20. 20

    How do I know which Mosh Client I am?

  21. 21

    How do I know which version of Debian I'm running?

  22. 22

    How do I know which modernizr part I need?

  23. 23

    how do i know my OpenCL kernel is running on the GPU?

  24. 24

    How do i get webdriver to see elements in included html files

  25. 25

    How can I know which type of process of linux will use for these?

  26. 26

    How can I know which type of process of linux will use for these?

  27. 27

    How do I know what the standard location is for putting server files on Linux systems?

  28. 28

    How do I debug a kernel module in which a NULL pointer appears?

  29. 29

    How do I build a single in-tree kernel module?

HotTag

Archive