This shows you the differences between two versions of the page.

Link to this comparison view

find_first_kernel_version_containing_a_certain_patch [05.04.2016 12:20] (current)
Pascal Suter created
Line 1: Line 1:
 +====== find first kernel version containing a certain patch ======
 +sometimes you have a problem with linux and you find out that eventually this problem was fixed by a patch to some file of the linux kernel. however, it can be tricky to figrue out which kernel version is the first to feature this bug fix so you know what you need to aim for when looking for updates or when compiling your own kernel (in that case you might patch the source yourself, but then again you could run into dependency issues if your kurrent kernel is way older than what the patch was made for). 
 +so here is, how you can find the kernel version starting with some info that is likely to be found in the commit logs for that patch.. ​
 +as an example lets take [[http://​permalink.gmane.org/​gmane.linux.drivers.rdma/​20239|this patch here]], which was commited on may 11 2014 yet centos 7.2 still suffered from the bug that was fixed by this patch until recently (somewhen in Q1 2016). ​
 +===== Step 1: clone the kernel source repo =====
 +since this is an old issue (as most issues will be that you run into when using any distribution packaged kernel), so we can clone the stable kernel git repo from kernel.org: ​
 +  git clone git://​git.kernel.org/​pub/​scm/​linux/​kernel/​git/​stable/​linux-stable.git
 +this will create a directory called linux-stable,​ so no need to do this in a new directory.. ​
 +now change to that directory for the following steps: ​
 +===== Step 2: find the commit id =====
 +together with the latest kernel you also downloaded the entire git history in the above step. so we can now search through the logs to find the commit id for the patch we are looking for. lets search for GFP_NOFS at first: ​
 +  git log --all --grep='​GFP_NOFS'​
 +now less is displayed containing all commits that had GFP_NOFS mentioned in their descriptions. using the ''/''​ (search) command in less we can now look for "​ipoib"​ which will lead us to the exact patch and we can see that it has ''​commit 09b93088d75009807b72293f26e2634430ce5ba9''​
 +===== Step 3: finding the first kernel version containing the commit =====
 +  git describe --contains 09b93088d75009807b72293f26e2634430ce5ba9
 +shows us that it is kernel version: ​
 +  v3.16-rc1~59^2^9~3