From: Christoph Hellwig <hch@lst.de>
To: Andrew Morton <akpm@linux-foundation.org>,
Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Jeremy Kerr <jk@ozlabs.org>, Arnd Bergmann <arnd@arndb.de>,
linuxppc-dev@lists.ozlabs.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 2/6] binfmt_elf: open code copy_siginfo_to_user to kernelspace buffer
Date: Mon, 6 Apr 2020 14:03:08 +0200 [thread overview]
Message-ID: <20200406120312.1150405-3-hch@lst.de> (raw)
In-Reply-To: <20200406120312.1150405-1-hch@lst.de>
Instead of messing with the address limit just open code the trivial
memcpy + memset logic.
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/binfmt_elf.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
index f4713ea76e82..d744ce9a4b52 100644
--- a/fs/binfmt_elf.c
+++ b/fs/binfmt_elf.c
@@ -1556,10 +1556,9 @@ static void fill_auxv_note(struct memelfnote *note, struct mm_struct *mm)
static void fill_siginfo_note(struct memelfnote *note, user_siginfo_t *csigdata,
const kernel_siginfo_t *siginfo)
{
- mm_segment_t old_fs = get_fs();
- set_fs(KERNEL_DS);
- copy_siginfo_to_user((user_siginfo_t __user *) csigdata, siginfo);
- set_fs(old_fs);
+ memcpy(csigdata, siginfo, sizeof(struct kernel_siginfo));
+ memset((char *)csigdata + sizeof(struct kernel_siginfo), 0,
+ SI_EXPANSION_SIZE);
fill_note(note, "CORE", NT_SIGINFO, sizeof(*csigdata), csigdata);
}
--
2.25.1
next prev parent reply other threads:[~2020-04-06 12:03 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-06 12:03 remove set_fs calls from the exec and coredump code Christoph Hellwig
2020-04-06 12:03 ` [PATCH 1/6] powerpc/spufs: simplify spufs core dumping Christoph Hellwig
2020-04-06 13:12 ` Arnd Bergmann
2020-04-07 0:01 ` Jeremy Kerr
2020-04-06 12:03 ` Christoph Hellwig [this message]
2020-04-06 13:01 ` [PATCH 2/6] binfmt_elf: open code copy_siginfo_to_user to kernelspace buffer Arnd Bergmann
2020-04-06 13:04 ` Christoph Hellwig
2020-04-06 12:03 ` [PATCH 3/6] binfmt_elf: remove the set_fs(KERNEL_DS) in elf_core_dump Christoph Hellwig
2020-04-06 13:02 ` Al Viro
2020-04-06 13:03 ` Christoph Hellwig
2020-04-06 12:03 ` [PATCH 4/6] binfmt_elf_fdpic: remove the set_fs(KERNEL_DS) in elf_fdpic_core_dump Christoph Hellwig
2020-04-06 12:03 ` [PATCH 5/6] exec: simplify the copy_strings_kernel calling convention Christoph Hellwig
2020-04-06 12:03 ` [PATCH 6/6] exec: open code copy_string_kernel Christoph Hellwig
2020-04-06 12:10 ` Matthew Wilcox
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=20200406120312.1150405-3-hch@lst.de \
--to=hch@lst.de \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=jk@ozlabs.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.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
all inboxes | Powered by JetHome®