Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2204330imm; Mon, 28 May 2018 03:54:22 -0700 (PDT) X-Google-Smtp-Source: AB8JxZraF+1K3pzWVir1zmaQlbU5Ioj2ZH7GtJnnvDvE8hS8iMA0A+lmFYPmj25kk3rOGjG2f1ya X-Received: by 2002:a65:5807:: with SMTP id g7-v6mr10143300pgr.409.1527504862529; Mon, 28 May 2018 03:54:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527504862; cv=none; d=google.com; s=arc-20160816; b=DAtjY0n9jE6VaQMU16pmr4Bugyd0c2/QCQg+99Dq2cj6fiefJhkKZErw0yWI7Lm61A ZSqXELWq7Gr1kHqmdaDIVKKHVtdlvg0agBgA1HAzSpycZ8dEnF8GNelc+clmhGgd4Lv/ eDYDXJOYkKPhywfBRVtPPo2m2IGpQesNfRolL2F2omMQxhFTGL4noaHDkKKS/3JSLcH/ tWs9n6Zq3/k/oBbfYHtx4JxHaE2oRFq7leCet0qGt2jGA27QA/gm6BrGIGh3bYFAdss6 qN/D3spiW+3P28Guo9epqpvF2M0uRK/94av5dh9vKy2TnleFr36GY4cTy9MfqqibesaH OWlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=qBquM0seQOAyTBzxp70RJ9oxJ0pjjaFqVFmQGiITnGQ=; b=ARDpathc4Uhb0mBT+APk4Intc6KXNVKIB/FtkCnqDw38b0s/RGhVD5XfNQ4VQN8rQk Sek7aYWmIrE+iTycObSnipQYpquZaOOBPCRcl1+GGj4TExhagKc6rNhYVQR3CsSL2rw9 JO90D6hPPsTwwm5p6kO3NM28mYI75tWC6vyP1U/ARe0xEHrFOiaiT1yUh+Kzt/n1tQw4 uNL5Kndpru0uAZZ8t0fLSp/Na5gPhCCS7CPlkPIo9ukhhxsBvQ4LPcy5LpzhLuEfss9W lti5m7gzqQPALyAD+esNB9bVqY4pSXz/Aa5EsihuIPxreIvwqDoqwZ8a/rrCQkH1sR6G zseA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=b5h0voQw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s9-v6si4975031plp.182.2018.05.28.03.54.07; Mon, 28 May 2018 03:54:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=b5h0voQw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1164220AbeE1Kxy (ORCPT + 99 others); Mon, 28 May 2018 06:53:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:42776 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1164165AbeE1Kxk (ORCPT ); Mon, 28 May 2018 06:53:40 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C73BE2075C; Mon, 28 May 2018 10:53:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527504820; bh=WPZ0U4OxGbSBngeKEREYdY0n55HO6oj3lXBJk4HBrEo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b5h0voQw7Rs6qlbbdi6MHxg2RJ40O8ZLmUPUkFhPXSDlNswW5viVUySFVuUW1VZ5T sDYHnzsO2SGEZvUOsdtydAbJU7XkguAswG9fMD9TwLMLkSR/YdjynKYHvIE3ZGEFRD +dO71GgeZ/lFhJgEiCEQskN61a3EDBgKA6sW/c9w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Lindroth , Nicolas Pitre , Masahiro Yamada , Sasha Levin Subject: [PATCH 4.14 274/496] kbuild: make scripts/adjust_autoksyms.sh robust against timestamp races Date: Mon, 28 May 2018 12:00:59 +0200 Message-Id: <20180528100331.392392518@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100319.498712256@linuxfoundation.org> References: <20180528100319.498712256@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-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/adjust_autoksyms.sh | 7 +++++++ 1 file changed, 7 insertions(+) --- a/scripts/adjust_autoksyms.sh +++ b/scripts/adjust_autoksyms.sh @@ -84,6 +84,13 @@ while read sympath; do depfile="include/config/ksym/${sympath}.h" 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 ) changed=${changed:-0}