]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
objtool: Use O_CREAT with explicit mode mask
authorIngo Molnar <mingo@kernel.org>
Mon, 17 Mar 2025 11:21:57 +0000 (12:21 +0100)
committerIngo Molnar <mingo@kernel.org>
Mon, 17 Mar 2025 11:24:02 +0000 (12:24 +0100)
commit73070466ed3b5e4620e03c159ee12a570b171d08
tree4d505cf3a1ac100444a5119b53eadef3703c1457
parent36799069b48198e5ce92d99310060c4aecb4b3e3
objtool: Use O_CREAT with explicit mode mask

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 <mingo@kernel.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org
tools/objtool/builtin-check.c