]> sourceware.org Git - systemtap.git/commit
PR14364, PR14630: Use set_fs and pagefault_disable/enable around more accesses
authorFrank Ch. Eigler <fche@redhat.com>
Fri, 28 Sep 2012 19:35:18 +0000 (15:35 -0400)
committerFrank Ch. Eigler <fche@redhat.com>
Fri, 28 Sep 2012 21:37:23 +0000 (17:37 -0400)
commit8fee9cc5af3ea902b7628eaa346598d92af5dc58
treea9ea0f24db69c4ac5739c1d96828716b1313d334
parenteaa9a233394c4afe62b5d0e9fdc4143972690a15
PR14364, PR14630: Use set_fs and pagefault_disable/enable around more accesses

It turns out there are a bunch of conceptually overlapping
functions/macros throughout the runtime, each of which attempts to
dereference untrustworthy kernel- or user-space pointers, in slightly
different ways.

When deliberately invoked with bad pointer values, some lockdep
kernels (e.g. 2.6.32-279.9.1.el6.x86_64.debug) would emit errors about
page-fault handling paths being triggered in inappropriate contexts
for some of these lookup functions.  It turns out a more robust
control of address space checking and fault suppression is necessary.

* runtime/linux/autoconf-pagefault_disable.c: New test.
* buildrun.cxx (compile_pass): Run it.
* runtime/linux/copy.c (_stp_read_address): Add pagefault_{disable,enable}.
  Note duplication with loc2c-runtime.h
  (_stp_strncpy_from_user): Add set_fs & pagefault_{disable,enable}.
  Note duplication with loc2c-runtime.h
* runtime/stp_string.h (__stp_get_user): Wrap in pagefault_{disable,enable}.
  Note duplication with loc2c-runtime.h
* tapset/uconversions.stp (__STP_GET_USER): Instead of __stp_get_user,
  zap duplication with loc2c-runtime.h and just call loc2c-runtime.h.
* runtime/loc2c-runtime.h (STAPCONF_PAGEFAULT_DISABLE): Add dummy
  macros for pre-rhel5 kernels.
  (_stp_deref, _stp_store_deref): Revamped arch-specific macros, setting
  segments and disabling pagefaults.
  (uderef,ustore_deref,kderef,kstore_deref): Revamped macros to call the
  above.  These should become the standard throughout the runtime/tapset.
buildrun.cxx
runtime/linux/autoconf-pagefault_disable.c [new file with mode: 0644]
runtime/linux/copy.c
runtime/loc2c-runtime.h
runtime/stp_string.h
tapset/uconversions.stp
This page took 0.029089 seconds and 5 git commands to generate.