[lkml]   [2018]   [May]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH 4.9 208/329] kbuild: make scripts/ robust against timestamp races
4.9-stable review patch.  If anyone has any objections, please let me know.


From: Nicolas Pitre <>

[ Upstream commit 825d487583089f9a33d31650c9c41f6474aab7fc ]

Some filesystems have timestamps with coarse precision that may allow
for a recently built object file to have the same timestamp as the
updated time on one of its dependency files. When that happens, the
object file doesn't get rebuilt as it should.

This is especially the case on filesystems that don't have sub-second
time precision, such as ext3 or Ext4 with 128B inodes.

Let's prevent that by making sure updated dependency files have a newer
timestamp than the first file we created (i.e. autoksyms.h.tmpnew).

Reported-by: Thomas Lindroth <>
Signed-off-by: Nicolas Pitre <>
Tested-by: Thomas Lindroth <>
Signed-off-by: Masahiro Yamada <>
Signed-off-by: Sasha Levin <>
Signed-off-by: Greg Kroah-Hartman <>
scripts/ | 7 +++++++
1 file changed, 7 insertions(+)

--- a/scripts/
+++ b/scripts/
@@ -83,6 +83,13 @@ while read sympath; do
mkdir -p "$(dirname "$depfile")"
touch "$depfile"
+ # Filesystems with coarse time precision may create timestamps
+ # equal to the one from a file that was very recently built and that
+ # needs to be rebuild. Let's guard against that by making sure our
+ # dep files are always newer than the first file we created here.
+ while [ ! "$depfile" -nt "$new_ksyms_file" ]; do
+ touch "$depfile"
+ done
echo $((count += 1))
done | tail -1 )

 \ /
  Last update: 2018-05-28 12:36    [W:0.655 / U:1.972 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site