mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "tip-bot2 for Ingo Molnar" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	linux-kernel@vger.kernel.org, x86@kernel.org
Subject: [tip: objtool/core] objtool: Use O_CREAT with explicit mode mask
Date: Mon, 17 Mar 2025 11:37:20 -0000	[thread overview]
Message-ID: <174221144059.14745.8349031235521776012.tip-bot2@tip-bot2> (raw)

The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     73070466ed3b5e4620e03c159ee12a570b171d08
Gitweb:        https://git.kernel.org/tip/73070466ed3b5e4620e03c159ee12a570b171d08
Author:        Ingo Molnar <mingo@kernel.org>
AuthorDate:    Mon, 17 Mar 2025 12:21:57 +01:00
Committer:     Ingo Molnar <mingo@kernel.org>
CommitterDate: Mon, 17 Mar 2025 12:24:02 +01:00

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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/objtool/builtin-check.c b/tools/objtool/builtin-check.c
index 39ddca6..5f761f4 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;

                 reply	other threads:[~2025-03-17 11:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=174221144059.14745.8349031235521776012.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®