public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: "dsmith at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: systemtap@sourceware.org
Subject: [Bug tapsets/15219] syscall.exp failures on RHEL5, RHEL6, and rawhide
Date: Mon, 04 Mar 2013 17:54:00 -0000	[thread overview]
Message-ID: <bug-15219-6586-f8TpojVCTN@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-15219-6586@http.sourceware.org/bugzilla/>

http://sourceware.org/bugzilla/show_bug.cgi?id=15219

--- Comment #1 from David Smith <dsmith at redhat dot com> 2013-03-04 17:53:58 UTC ---
Here's compat_sys_timer_settime() from kernel/compat.c. Notice it converts the
'struct compat_itimerspec' to a 'struct itimerspec' (which is in kernel
memory), calls 'set_fs(KERENL_DS), then calls the real syscall function,
'sys_timer_settime()'.

====
long compat_sys_timer_settime(timer_t timer_id, int flags,
              struct compat_itimerspec __user *new,
              struct compat_itimerspec __user *old)
{
    long err;
    mm_segment_t oldfs;
    struct itimerspec newts, oldts;

    if (!new)
        return -EINVAL;
    if (get_compat_itimerspec(&newts, new))
        return -EFAULT;
    oldfs = get_fs();
    set_fs(KERNEL_DS);
    err = sys_timer_settime(timer_id, flags,
                (struct itimerspec __user *) &newts,
                (struct itimerspec __user *) &oldts);
    set_fs(oldfs);
    if (!err && old && put_compat_itimerspec(old, &oldts))
        return -EFAULT;
    return err;
}
====

Here's our '_stp_copy_from_user()'. Notice we explicitly call
'set_fs(USER_DS)', which just overrode compat_sys_timer_settime() setting.

====
static unsigned long _stp_copy_from_user(char *dst, const char __user *src,
unsigned long count)
{
    if (count) {
                mm_segment_t _oldfs = get_fs();
                set_fs(USER_DS);
                pagefault_disable();
        if (access_ok(VERIFY_READ, src, count))
            count = __copy_from_user_inatomic(dst, src, count);
        else
            memset(dst, 0, count);
                pagefault_enable();
                set_fs(_oldfs);
    }
    return count;
}
====

I'm thinking we should no longer change the kernel's idea of what memory space
to use in _stp_copy_from_user().

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

  reply	other threads:[~2013-03-04 17:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-01 17:54 [Bug tapsets/15219] New: " dsmith at redhat dot com
2013-03-04 17:54 ` dsmith at redhat dot com [this message]
2013-03-04 18:40 ` [Bug tapsets/15219] " fche at redhat dot com
2013-06-03 13:38 ` dsmith at redhat dot com
2013-06-04 15:14 ` fche at redhat dot com
2013-06-05 17:58 ` dsmith at redhat dot com
2013-06-06 18:03 ` dsmith at redhat dot com
2013-06-11 14:37 ` dsmith at redhat dot com
2013-06-17 16:10 ` dsmith at redhat dot com
2013-08-26 20:44 ` dsmith at redhat dot com
2013-10-08 18:03 ` dsmith at redhat dot com
2013-10-08 18:15 ` dsmith at redhat dot com
2013-10-31 17:24 ` dsmith at redhat dot com
2014-01-07 22:02 ` dsmith at redhat dot com

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=bug-15219-6586-f8TpojVCTN@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=systemtap@sourceware.org \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).