From: Catalin Marinas <catalin.marinas@arm.com>
To: Chris Metcalf <cmetcalf@ezchip.com>
Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org,
ralf@linux-mips.org, benh@kernel.crashing.org, deller@gmx.de,
"dingtianhong@huawei.com" <dingtianhong@huawei.com>,
heiko.carstens@de.ibm.com, jejb@parisc-linux.org,
Will Deacon <Will.Deacon@arm.com>,
"lizefan@huawei.com" <lizefan@huawei.com>,
Bamvor Jian Zhang <bamvor.zhangjian@huawei.com>,
mpe@ellerman.id.au, hpa@zytor.com, schwidefsky@de.ibm.com,
paulus@samba.org, tglx@linutronix.de, mingo@redhat.com,
davem@davemloft.net,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] tile: use si_int instead of si_ptr for compat_siginfo
Date: Mon, 23 Mar 2015 12:02:54 +0000 [thread overview]
Message-ID: <20150323120253.GA12757@e104818-lin.cambridge.arm.com> (raw)
In-Reply-To: <201503161908.t2GJ8fs5021877@farm-0002.internal.tilera.com>
On Mon, Mar 16, 2015 at 03:04:05PM -0400, Chris Metcalf wrote:
> To be compatible with the generic get_compat_sigevent(), the
> copy_siginfo_to_user32() and thus copy_siginfo_from_user32()
> have to use si_int instead of si_ptr. Using si_ptr means that
> for the case of ILP32 compat code running in big-endian mode,
> we would end up copying the high 32 bits of the pointer value
> into si_int instead of the desired low 32 bits.
>
> Signed-off-by: Chris Metcalf <cmetcalf@ezchip.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> ---
> arch/tile/kernel/compat_signal.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/arch/tile/kernel/compat_signal.c b/arch/tile/kernel/compat_signal.c
> index 8c5abf2e4794..bca13054afb4 100644
> --- a/arch/tile/kernel/compat_signal.c
> +++ b/arch/tile/kernel/compat_signal.c
> @@ -68,7 +68,7 @@ int copy_siginfo_to_user32(struct compat_siginfo __user *to, const siginfo_t *fr
> if (from->si_code < 0) {
> err |= __put_user(from->si_pid, &to->si_pid);
> err |= __put_user(from->si_uid, &to->si_uid);
> - err |= __put_user(ptr_to_compat(from->si_ptr), &to->si_ptr);
> + err |= __put_user(from->si_int, &to->si_int);
> } else {
> /*
> * First 32bits of unions are always present:
> @@ -93,8 +93,7 @@ int copy_siginfo_to_user32(struct compat_siginfo __user *to, const siginfo_t *fr
> break;
> case __SI_TIMER >> 16:
> err |= __put_user(from->si_overrun, &to->si_overrun);
> - err |= __put_user(ptr_to_compat(from->si_ptr),
> - &to->si_ptr);
> + err |= __put_user(from->si_int, &to->si_int);
> break;
It's usually the __SI_TIMER and __SI_MESGQ cases that matters here (the
latter already handled). I'm not entirely sure about the si_code < 0
change.
> /* This is not generated by the kernel as of now. */
> case __SI_RT >> 16:
> @@ -110,7 +109,6 @@ int copy_siginfo_to_user32(struct compat_siginfo __user *to, const siginfo_t *fr
> int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo __user *from)
> {
> int err;
> - u32 ptr32;
>
> if (!access_ok(VERIFY_READ, from, sizeof(struct compat_siginfo)))
> return -EFAULT;
> @@ -121,8 +119,7 @@ int copy_siginfo_from_user32(siginfo_t *to, struct compat_siginfo __user *from)
>
> err |= __get_user(to->si_pid, &from->si_pid);
> err |= __get_user(to->si_uid, &from->si_uid);
> - err |= __get_user(ptr32, &from->si_ptr);
> - to->si_ptr = compat_ptr(ptr32);
> + err |= __get_user(to->si_int, &from->si_int);
We have a memset(to, 0, sizeof(*to)) on arm64 in this function but I
can't see it on tile. Some members or even half of si_ptr would be left
uninitialised.
--
Catalin
next prev parent reply other threads:[~2015-03-23 12:03 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1423563011-12377-1-git-send-email-bamvor.zhangjian@huawei.com>
2015-02-10 12:27 ` [PATCH] compat: Fix endian issue in union sigval Catalin Marinas
2015-02-10 12:27 ` Catalin Marinas
2015-02-11 11:22 ` Bamvor Jian Zhang
2015-02-11 15:40 ` Catalin Marinas
2015-02-11 15:40 ` Catalin Marinas
2015-02-13 8:00 ` Bamvor Jian Zhang
2015-02-13 10:44 ` Catalin Marinas
2015-02-13 21:56 ` Chris Metcalf
2015-02-13 21:56 ` Chris Metcalf
2015-02-14 11:22 ` Catalin Marinas
2015-02-14 11:22 ` Catalin Marinas
2015-02-17 6:42 ` Bamvor Jian Zhang
2015-02-17 6:42 ` Bamvor Jian Zhang
2015-02-21 4:05 ` Chris Metcalf
2015-02-21 4:05 ` Chris Metcalf
2015-02-24 21:54 ` Chris Metcalf
2015-02-24 21:54 ` Chris Metcalf
2015-02-25 10:37 ` Catalin Marinas
2015-03-16 19:04 ` [PATCH] tile: use si_int instead of si_ptr for compat_siginfo Chris Metcalf
2015-03-16 19:04 ` Chris Metcalf
2015-03-23 12:02 ` Catalin Marinas [this message]
2015-03-24 20:51 ` Chris Metcalf
2015-03-24 20:51 ` Chris Metcalf
2015-04-17 16:56 ` Chris Metcalf
2015-04-17 16:56 ` Chris Metcalf
2015-02-17 7:15 ` [PATCH] compat: Fix endian issue in union sigval Bamvor Jian Zhang
2015-02-17 7:15 ` Bamvor Jian Zhang
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=20150323120253.GA12757@e104818-lin.cambridge.arm.com \
--to=catalin.marinas@arm.com \
--cc=Will.Deacon@arm.com \
--cc=bamvor.zhangjian@huawei.com \
--cc=benh@kernel.crashing.org \
--cc=cmetcalf@ezchip.com \
--cc=davem@davemloft.net \
--cc=deller@gmx.de \
--cc=dingtianhong@huawei.com \
--cc=heiko.carstens@de.ibm.com \
--cc=hpa@zytor.com \
--cc=jejb@parisc-linux.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=mingo@redhat.com \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.org \
--cc=ralf@linux-mips.org \
--cc=schwidefsky@de.ibm.com \
--cc=tglx@linutronix.de \
/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).