Commit 405544d5 authored by Nicolas Pitre's avatar Nicolas Pitre Committed by Greg Kroah-Hartman
Browse files

kbuild: make scripts/ robust against timestamp races

[ Upstream commit 825d4875


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: default avatarThomas Lindroth <>
Signed-off-by: default avatarNicolas Pitre <>
Tested-by: default avatarThomas Lindroth <>
Signed-off-by: Masahiro Yamada's avatarMasahiro Yamada <>
Signed-off-by: default avatarSasha Levin <>
Signed-off-by: default avatarGreg Kroah-Hartman <>
parent 0839b0ce
......@@ -84,6 +84,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"
echo $((count += 1))
done | tail -1 )
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment