linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Salter <msalter@redhat.com>
To: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	Mark Salter <msalter@redhat.com>
Subject: [PATCH 2/2] Fix /proc/<pid>/auxv for FDPIC binaries
Date: Tue, 26 Feb 2013 10:09:07 -0500	[thread overview]
Message-ID: <1361891347-20806-2-git-send-email-msalter@redhat.com> (raw)
In-Reply-To: <1361891347-20806-1-git-send-email-msalter@redhat.com>

The FDPIC loader is not storing aux vector info in mm->saved_aux so the aux vectors were
not being exposed through /proc/<pid>/auxv. This patch copies the aux vectors stored on
the user stack into mm->saved_aux so that they may be available through procfs.

Signed-off-by: Mark Salter <msalter@redhat.com>
---
 fs/binfmt_elf_fdpic.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
index af4c9a4..9651918 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -478,7 +478,7 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
 				   struct elf_fdpic_params *interp_params)
 {
 	const struct cred *cred = current_cred();
-	unsigned long sp, csp, nitems;
+	unsigned long sp, csp, nitems, auxv_end;
 	elf_caddr_t __user *argv, *envp;
 	size_t platform_len = 0, len;
 	char *k_platform, *k_base_platform;
@@ -594,6 +594,7 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
 	} while (0)
 
 	nr = 0;
+	auxv_end = csp;
 	csp -= 2 * sizeof(unsigned long);
 	NEW_AUX_ENT(AT_NULL, 0);
 	if (k_platform) {
@@ -645,6 +646,10 @@ static int create_elf_fdpic_tables(struct linux_binprm *bprm,
 #endif
 #undef NEW_AUX_ENT
 
+	if (copy_from_user(current->mm->saved_auxv,
+			   (const char __user *) csp, auxv_end - csp))
+		return -EFAULT;
+
 	/* allocate room for argv[] and envv[] */
 	csp -= (bprm->envc + 1) * sizeof(elf_caddr_t);
 	envp = (elf_caddr_t __user *) csp;
-- 
1.8.1.2

      reply	other threads:[~2013-02-26 15:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-26 15:09 [PATCH 1/2] Fix AT_EXECFN auxv for no-MMU fdpic Mark Salter
2013-02-26 15:09 ` Mark Salter [this message]

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=1361891347-20806-2-git-send-email-msalter@redhat.com \
    --to=msalter@redhat.com \
    --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).