linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
To: Alexander Viro <viro@zeniv.linux.org.uk>,
	Christian Brauner <brauner@kernel.org>
Cc: vsementsov@yandex-team.ru, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] fs/coredump: open coredump file in O_WRONLY instead of O_RDWR
Date: Thu, 20 Apr 2023 15:04:09 +0300	[thread overview]
Message-ID: <20230420120409.602576-1-vsementsov@yandex-team.ru> (raw)

This makes it possible to make stricter apparmor profile and don't
allow the program to read any coredump in the system.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
---
 fs/coredump.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/coredump.c b/fs/coredump.c
index 5df1e6e1eb2b..8f263a389175 100644
--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -646,7 +646,7 @@ void do_coredump(const kernel_siginfo_t *siginfo)
 	} else {
 		struct mnt_idmap *idmap;
 		struct inode *inode;
-		int open_flags = O_CREAT | O_RDWR | O_NOFOLLOW |
+		int open_flags = O_CREAT | O_WRONLY | O_NOFOLLOW |
 				 O_LARGEFILE | O_EXCL;
 
 		if (cprm.limit < binfmt->min_coredump)
-- 
2.34.1


             reply	other threads:[~2023-04-20 12:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-20 12:04 Vladimir Sementsov-Ogievskiy [this message]
2023-05-10 15:15 ` [PATCH] fs/coredump: open coredump file in O_WRONLY instead of O_RDWR Vladimir Sementsov-Ogievskiy
2023-05-15 17:55   ` Christian Brauner
2023-05-15 18:50     ` Linus Torvalds
2023-05-15 19:13       ` Linus Torvalds
2023-05-16  8:05         ` Vladimir Sementsov-Ogievskiy
2023-05-16 13:46         ` Christian Brauner
2023-05-16 13:47           ` Christian Brauner

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=20230420120409.602576-1-vsementsov@yandex-team.ru \
    --to=vsementsov@yandex-team.ru \
    --cc=brauner@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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;
as well as URLs for NNTP newsgroup(s).