From: Cyrill Gorcunov <gorcunov@gmail.com>
To: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@elte.hu>,
Thomas Gleixner <tglx@linutronix.de>,
linux-kernel@vger.kernel.org
Subject: Re: [RFC v2 -tip 3/3] x86: ia32_signal: use {get|put}_user_try and catch
Date: Mon, 26 Jan 2009 21:56:48 +0300 [thread overview]
Message-ID: <20090126185648.GD31918@localhost> (raw)
In-Reply-To: <497E0167.10604@ct.jp.nec.com>
[Hiroshi Shimamoto - Mon, Jan 26, 2009 at 10:31:03AM -0800]
| Cyrill Gorcunov wrote:
| > [Hiroshi Shimamoto - Fri, Jan 23, 2009 at 03:50:38PM -0800]
| > | From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
| > |
| > | Impact: use new framework
| > |
| > | Use {get|put}_user_try, catch, and _ex in arch/x86/ia32/ia32_signal.c.
| > |
| > | Note: this patch contains "WARNING: line over 80 characters", because when
| > | introducing new block I insert an indent to avoid mistakes by edit.
| > |
| > | Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
| > | ---
| > | arch/x86/ia32/ia32_signal.c | 365 +++++++++++++++++++++++--------------------
| > | 1 files changed, 195 insertions(+), 170 deletions(-)
| > |
| > | diff --git a/arch/x86/ia32/ia32_signal.c b/arch/x86/ia32/ia32_signal.c
| > | index 9dabd00..dd77ac0 100644
| > | --- a/arch/x86/ia32/ia32_signal.c
| > | +++ b/arch/x86/ia32/ia32_signal.c
| > | @@ -46,78 +46,83 @@ void signal_fault(struct pt_regs *regs, void __user *frame, char *where);
| > |
| > ...
| > | + put_user_try {
| > | + /* If you change siginfo_t structure, please make sure that
| > | + this code is fixed accordingly.
| > | + It should never copy any pad contained in the structure
| > | + to avoid security leaks, but must copy the generic
| > | + 3 ints plus the relevant union member. */
| > | + put_user_ex(from->si_signo, &to->si_signo);
| > | + put_user_ex(from->si_errno, &to->si_errno);
| > | + put_user_ex((short)from->si_code, &to->si_code);
| > | +
| > | + if (from->si_code < 0) {
| > | + put_user_ex(from->si_pid, &to->si_pid);
| > | + put_user_ex(from->si_uid, &to->si_uid);
| > | + put_user_ex(ptr_to_compat(from->si_ptr), &to->si_ptr);
| > | + } else {
| > | + /*
| > | + * First 32bits of unions are always present:
| > | + * si_pid === si_band === si_tid === si_addr(LS half)
| > | + */
| > | + put_user_ex(from->_sifields._pad[0],
| > | + &to->_sifields._pad[0]);
| > | + switch (from->si_code >> 16) {
| > | + case __SI_FAULT >> 16:
| > | + break;
| > | + case __SI_CHLD >> 16:
| > | + put_user_ex(from->si_utime, &to->si_utime);
| > | + put_user_ex(from->si_stime, &to->si_stime);
| > | + put_user_ex(from->si_status, &to->si_status);
| > | + /* FALL THROUGH */
| > | + default:
| >
| > Hi Hiroshi,
|
| Hi Cyrill,
|
| >
| > may I ask why we use default here?
|
| I don't know:) Hm, it looks old code.
| arch/i386/kernel/signal.c in 2.4 has similar code.
|
| I guess this code didn't change when copy_siginfo_to_user() was moved
| from arch/i386/kernel/signal.c to kernel/signal.c.
|
| Should we change this like copy_siginfo_tu_user() in kernel/signal.c?
| Copying si_pid was added in kernel/signal.c.
|
| BTW, it seems same __ST_KILL and default.
Hiroshi, to be fair -- I just don't know what the
right solution would be ;-) I just noticed that
default: here a bit useless since we do 'testing'
the (from->si_code >> 16) after default: anyway.
So choose one /since I'm not really familiar with
process management in kernel/ :)
-- Cyrill --
next prev parent reply other threads:[~2009-01-26 18:57 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-06 3:06 [RFC -tip 0/4] x86: reduce fixup of uaccess Hiroshi Shimamoto
2009-01-06 3:08 ` [RFC -tip 1/4] x86: uaccess: rename __put_user_u64() to __put_user_asm_u64() Hiroshi Shimamoto
2009-01-06 3:08 ` [RFC -tip 2/4] x86: uaccess: introduce new __{get|put}_user exception handling framework Hiroshi Shimamoto
2009-01-06 3:09 ` [RFC -tip 3/4] x86: signal: use __{get|put}_user_ex " Hiroshi Shimamoto
2009-01-06 3:10 ` [RFC -tip 4/4] x86: ia32_signal: " Hiroshi Shimamoto
2009-01-06 10:09 ` [RFC -tip 0/4] x86: reduce fixup of uaccess Ingo Molnar
2009-01-07 9:33 ` H. Peter Anvin
2009-01-08 1:43 ` Hiroshi Shimamoto
2009-01-23 23:48 ` [RFC v2 -tip 0/3] " Hiroshi Shimamoto
2009-01-23 23:49 ` [RFC v2 -tip 1/3] x86: uaccess: introduce try and catch framework Hiroshi Shimamoto
2009-01-23 23:50 ` [RFC v2 -tip 2/3] x86: signal: use {get|put}_user_try and catch Hiroshi Shimamoto
2009-01-23 23:50 ` [RFC v2 -tip 3/3] x86: ia32_signal: " Hiroshi Shimamoto
2009-01-24 7:36 ` Cyrill Gorcunov
2009-01-26 18:31 ` Hiroshi Shimamoto
2009-01-26 18:56 ` Cyrill Gorcunov [this message]
2009-01-24 0:51 ` [RFC v2 -tip 0/3] x86: reduce fixup of uaccess H. Peter Anvin
2009-01-24 4:39 ` H. Peter Anvin
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=20090126185648.GD31918@localhost \
--to=gorcunov@gmail.com \
--cc=h-shimamoto@ct.jp.nec.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--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