From 73070466ed3b5e4620e03c159ee12a570b171d08 Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Mon, 17 Mar 2025 12:21:57 +0100 Subject: objtool: Use O_CREAT with explicit mode mask MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Recent Ubuntu enforces 3-argument open() with O_CREAT: CC /home/mingo/tip/tools/objtool/builtin-check.o In file included from /usr/include/fcntl.h:341, from builtin-check.c:9: In function ‘open’, inlined from ‘copy_file’ at builtin-check.c:201:11: /usr/include/x86_64-linux-gnu/bits/fcntl2.h:52:11: error: call to ‘__open_missing_mode’ declared with attribute error: open with O_CREAT or O_TMPFILE in second argument needs 3 arguments 52 | __open_missing_mode (); | ^~~~~~~~~~~~~~~~~~~~~~ Use 0400 as the most restrictive mode for the new file. Signed-off-by: Ingo Molnar Cc: Josh Poimboeuf Cc: Peter Zijlstra Cc: linux-kernel@vger.kernel.org --- tools/objtool/builtin-check.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c index 39ddca64cb58..5f761f420b8c 100644 --- a/tools/objtool/builtin-check.c +++ b/tools/objtool/builtin-check.c @@ -198,7 +198,7 @@ static int copy_file(const char *src, const char *dst) return 1; } - dst_fd = open(dst, O_WRONLY | O_CREAT | O_TRUNC); + dst_fd = open(dst, O_WRONLY | O_CREAT | O_TRUNC, 0400); if (dst_fd == -1) { ERROR("can't open '%s' for writing", dst); return 1; -- cgit