rpms/kernel/devel linux-2.6-utrace.patch, 1.67, 1.68 kernel.spec, 1.510, 1.511 linux-2.6-utrace-core.patch, 1.14, NONE linux-2.6-utrace-ptrace-compat-avr32.patch, 1.5, NONE linux-2.6-utrace-ptrace-compat-ia64.patch, 1.5, NONE linux-2.6-utrace-ptrace-compat-s390.patch, 1.3, NONE linux-2.6-utrace-ptrace-compat-sparc64.patch, 1.2, NONE linux-2.6-utrace-ptrace-compat.patch, 1.12, NONE linux-2.6-utrace-regset-avr32.patch, 1.5, NONE linux-2.6-utrace-regset-ia64.patch, 1.5, NONE linux-2.6-utrace-regset-s390.patch, 1.4, NONE linux-2.6-utrace-regset-sparc64.patch, 1.3, NONE linux-2.6-utrace-regset.patch, 1.10, NONE linux-2.6-utrace-tracehook-avr32.patch, 1.5, NONE linux-2.6-utrace-tracehook-ia64.patch, 1.5, NONE linux-2.6-utrace-tracehook-s390.patch, 1.4, NONE linux-2.6-utrace-tracehook-sparc64.patch, 1.2, NONE linux-2.6-utrace-tracehook-um.patch, 1.4, NONE linux-2.6-utrace-tracehook.patch, 1.23, NONE
Roland McGrath (roland)
fedora-extras-commits at redhat.com
Wed Mar 19 20:04:22 UTC 2008
Author: roland
Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv13060
Modified Files:
kernel.spec
Added Files:
linux-2.6-utrace.patch
Removed Files:
linux-2.6-utrace-core.patch
linux-2.6-utrace-ptrace-compat-avr32.patch
linux-2.6-utrace-ptrace-compat-ia64.patch
linux-2.6-utrace-ptrace-compat-s390.patch
linux-2.6-utrace-ptrace-compat-sparc64.patch
linux-2.6-utrace-ptrace-compat.patch
linux-2.6-utrace-regset-avr32.patch
linux-2.6-utrace-regset-ia64.patch
linux-2.6-utrace-regset-s390.patch
linux-2.6-utrace-regset-sparc64.patch
linux-2.6-utrace-regset.patch
linux-2.6-utrace-tracehook-avr32.patch
linux-2.6-utrace-tracehook-ia64.patch
linux-2.6-utrace-tracehook-s390.patch
linux-2.6-utrace-tracehook-sparc64.patch
linux-2.6-utrace-tracehook-um.patch
linux-2.6-utrace-tracehook.patch
Log Message:
utrace is back, rebased
linux-2.6-utrace.patch:
View full diff with command:
/usr/bin/cvs -f diff -kk -u -N -r 1.67 -r 1.68 linux-2.6-utrace.patch
Index: linux-2.6-utrace.patch
===================================================================
RCS file: linux-2.6-utrace.patch
diff -N linux-2.6-utrace.patch
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ linux-2.6-utrace.patch 19 Mar 2008 20:03:50 -0000 1.68
@@ -0,0 +1,9017 @@
+diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile
+index 300e170..7cf3afc 100644
+--- a/Documentation/DocBook/Makefile
++++ b/Documentation/DocBook/Makefile
+@@ -7,7 +7,7 @@
+ # list of DOCBOOKS.
+
+ DOCBOOKS := wanbook.xml z8530book.xml mcabook.xml videobook.xml \
+- kernel-hacking.xml kernel-locking.xml deviceiobook.xml \
++ kernel-hacking.xml kernel-locking.xml deviceiobook.xml utrace.xml \
+ procfs-guide.xml writing_usb_driver.xml networking.xml \
+ kernel-api.xml filesystems.xml lsm.xml usb.xml \
+ gadget.xml libata.xml mtdnand.xml librs.xml rapidio.xml \
+diff --git a/Documentation/DocBook/utrace.tmpl b/Documentation/DocBook/utrace.tmpl
+new file mode 100644
+index ...00213c2 100644
+--- /dev/null
++++ b/Documentation/DocBook/utrace.tmpl
+@@ -0,0 +1,23 @@
++<?xml version="1.0" encoding="UTF-8"?>
++<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
++ "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []>
++
++<book id="utrace">
++ <bookinfo>
++ <title>The utrace User Debugging Infrastructure</title>
++ </bookinfo>
++
++<toc></toc>
++
++<chapter><title>The utrace core API</title>
++!Iinclude/linux/utrace.h
++!Ekernel/utrace.c
++ </chapter>
++
++<chapter><title>Machine state access via utrace</title>
++!Finclude/linux/tracehook.h struct utrace_regset
++!Finclude/linux/tracehook.h struct utrace_regset_view
++!Finclude/linux/tracehook.h utrace_native_view
++ </chapter>
++
++</book>
+diff --git a/Documentation/utrace.txt b/Documentation/utrace.txt
+new file mode 100644
+index ...4d24c33 100644
+--- /dev/null
++++ b/Documentation/utrace.txt
+@@ -0,0 +1,579 @@
++DRAFT DRAFT DRAFT WORK IN PROGRESS DRAFT DRAFT DRAFT
++
++This is work in progress and likely to change.
++
++
++ Roland McGrath <roland at redhat.com>
++
++---
++
++ User Debugging Data & Event Rendezvous
++ ---- --------- ---- - ----- ----------
++
++See linux/utrace.h for all the declarations used here.
++See also linux/tracehook.h for the utrace_regset declarations.
++
++The UTRACE is infrastructure code for tracing and controlling user
++threads. This is the foundation for writing tracing engines, which
++can be loadable kernel modules. The UTRACE interfaces provide three
++basic facilities:
++
++* Thread event reporting
++
++ Tracing engines can request callbacks for events of interest in
++ the thread: signals, system calls, exit, exec, clone, etc.
++
++* Core thread control
++
++ Tracing engines can prevent a thread from running (keeping it in
++ TASK_TRACED state), or make it single-step or block-step (when
++ hardware supports it). Engines can cause a thread to abort system
++ calls, they change the behaviors of signals, and they can inject
++ signal-style actions at will.
++
++* Thread machine state access
++
++ Tracing engines can read and write a thread's registers and
++ similar per-thread CPU state.
++
++
++ Tracing engines
++ ------- -------
++
++The basic actors in UTRACE are the thread and the tracing engine.
++A tracing engine is some body of code that calls into the utrace_*
++interfaces, represented by a struct utrace_engine_ops. (Usually it's a
++kernel module, though the legacy ptrace support is a tracing engine
++that is not in a kernel module.) The UTRACE interface operates on
++individual threads (struct task_struct). If an engine wants to
++treat several threads as a group, that is up to its higher-level
++code. Using the UTRACE starts out by attaching an engine to a thread.
++
++ struct utrace_attached_engine *
++ utrace_attach(struct task_struct *target, int flags,
++ const struct utrace_engine_ops *ops, void *data);
++
++Calling utrace_attach is what sets up a tracing engine to trace a
++thread. Use UTRACE_ATTACH_CREATE in flags, and pass your engine's ops.
++Check the return value with IS_ERR. If successful, it returns a
++struct pointer that is the handle used in all other utrace_* calls.
++The data argument is stored in the utrace_attached_engine structure,
++for your code to use however it wants.
++
++ int utrace_detach(struct task_struct *target,
++ struct utrace_attached_engine *engine);
++
++The utrace_detach call removes an engine from a thread.
++No more callbacks will be made after this returns success.
++
++
++An attached engine does nothing by default.
++An engine makes something happen by setting its flags.
++
++ int utrace_set_flags(struct task_struct *target,
++ struct utrace_attached_engine *engine,
++ unsigned long flags);
++
++The synchronization issues related to these two calls
++are discussed further below in "Teardown Races".
++
++
++ Action Flags
++ ------ -----
++
++There are two kinds of flags that an attached engine can set: event
++flags, and action flags. Event flags register interest in particular
++events; when an event happens and an engine has the right event flag
++set, it gets a callback. Action flags change the normal behavior of
++the thread. The action flags available are:
++
++ UTRACE_ACTION_QUIESCE
++
++ The thread will stay quiescent (see below). As long as
++ any engine asserts the QUIESCE action flag, the thread
++ will not resume running in user mode. (Usually it will
++ be in TASK_TRACED state.) Nothing will wake the thread
++ up except for SIGKILL (and implicit SIGKILLs such as a
++ core dump in another thread sharing the same address
++ space, or a group exit, fatal signal, or exec in another
++ thread in the same thread group).
++
++ UTRACE_ACTION_SINGLESTEP
++
++ When the thread runs, it will run one instruction and
++ then trap. (Exiting a system call or entering a signal
++ handler is considered "an instruction" for this.) This
++ is available on most machines. This can be used only if
++ ARCH_HAS_SINGLE_STEP is #define'd by <asm/tracehook.h>
++ and evaluates to nonzero.
++
++ UTRACE_ACTION_BLOCKSTEP
++
++ When the thread runs, it will run until the next branch
++ taken, and then trap. (Exiting a system call or
++ entering a signal handler is considered taking a branch
++ for this.) When the SINGLESTEP flag is set, BLOCKSTEP
++ has no effect. This is only available on some machines.
++ This can be used only if ARCH_HAS_BLOCK_STEP is
++ #define'd by <asm/tracehook.h> and evaluates to nonzero.
++
++ UTRACE_ACTION_NOREAP
++
++ When the thread exits or stops for job control, its
++ parent process will not receive a SIGCHLD and the
++ parent's wait calls will not wake up or report the child
++ as dead. Even a self-reaping thread will remain a
++ zombie. Note that this cannot prevent the reaping done
++ when an exec is done by another thread in the same
++ thread group; in that event, a REAP event (and callback
++ if requested) will happen regardless of this flag.
++ A well-behaved tracing engine does not want to interfere
++ with the parent's normal notifications. This is
++ provided mainly for the ptrace compatibility code to
++ implement the traditional behavior.
++
++Event flags are specified using the macro UTRACE_EVENT(TYPE).
++Each event type is associated with a report_* callback in struct
++utrace_engine_ops. A tracing engine can leave unused callbacks NULL.
++The only callbacks required are those used by the event flags it sets.
++
++Many engines can be attached to each thread. When a thread has an
++event, each engine gets a report_* callback if it has set the event flag
++for that event type. Engines are called in the order they attached.
++
++Each callback takes arguments giving the details of the particular
++event. The first two arguments two every callback are the struct
[...8624 lines suppressed...]
++ current);
++ if (ret)
++ break;
++ }
++ }
++ }
++ rcu_read_unlock();
++
++ return ret;
++}
++
++/*
++ * Called on the current task to return LSM_UNSAFE_* bits implied by tracing.
++ * Called with task_lock() held.
++ */
++int
++utrace_unsafe_exec(struct task_struct *tsk)
++{
++ struct utrace *utrace = tsk->utrace;
++ struct list_head *pos, *next;
++ struct utrace_attached_engine *engine;
++ const struct utrace_engine_ops *ops;
++ int unsafe = 0;
++
++ /* XXX must change for sharing */
++ list_for_each_safe_rcu(pos, next, &utrace->engines) {
++ engine = list_entry(pos, struct utrace_attached_engine, entry);
++ ops = rcu_dereference(engine->ops);
++ if (ops->unsafe_exec)
++ unsafe |= (*ops->unsafe_exec)(engine, tsk);
++ }
++
++ return unsafe;
++}
+diff --git a/mm/nommu.c b/mm/nommu.c
+index 5d8ae08..515beac 100644
+--- a/mm/nommu.c
++++ b/mm/nommu.c
+@@ -22,7 +22,7 @@
+ #include <linux/pagemap.h>
+ #include <linux/slab.h>
+ #include <linux/vmalloc.h>
+-#include <linux/ptrace.h>
++#include <linux/tracehook.h>
+ #include <linux/blkdev.h>
+ #include <linux/backing-dev.h>
+ #include <linux/mount.h>
+@@ -734,7 +734,7 @@ static unsigned long determine_vm_flags(
+ * it's being traced - otherwise breakpoints set in it may interfere
+ * with another untraced process
+ */
+- if ((flags & MAP_PRIVATE) && (current->ptrace & PT_PTRACED))
++ if ((flags & MAP_PRIVATE) && tracehook_expect_breakpoints(current))
+ vm_flags &= ~VM_MAYSHARE;
+
+ return vm_flags;
+diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
+index 41a049f..44b756b 100644
+--- a/security/selinux/hooks.c
++++ b/security/selinux/hooks.c
+@@ -24,7 +24,7 @@
+
+ #include <linux/init.h>
+ #include <linux/kernel.h>
+-#include <linux/ptrace.h>
++#include <linux/tracehook.h>
+ #include <linux/errno.h>
+ #include <linux/sched.h>
+ #include <linux/security.h>
+@@ -162,7 +162,7 @@ static int task_alloc_security(struct ta
+ return -ENOMEM;
+
+ tsec->task = task;
+- tsec->osid = tsec->sid = tsec->ptrace_sid = SECINITSID_UNLABELED;
++ tsec->osid = tsec->sid = SECINITSID_UNLABELED;
+ task->security = tsec;
+
+ return 0;
+@@ -1638,19 +1638,13 @@ static inline u32 file_to_av(struct file
+
+ static int selinux_ptrace(struct task_struct *parent, struct task_struct *child)
+ {
+- struct task_security_struct *psec = parent->security;
+- struct task_security_struct *csec = child->security;
+ int rc;
+
+ rc = secondary_ops->ptrace(parent,child);
+ if (rc)
+ return rc;
+
+- rc = task_has_perm(parent, child, PROCESS__PTRACE);
+- /* Save the SID of the tracing process for later use in apply_creds. */
+- if (!(child->ptrace & PT_PTRACED) && !rc)
+- csec->ptrace_sid = psec->sid;
+- return rc;
++ return task_has_perm(parent, child, PROCESS__PTRACE);
+ }
+
+ static int selinux_capget(struct task_struct *target, kernel_cap_t *effective,
+@@ -2119,12 +2113,25 @@ static void selinux_bprm_apply_creds(str
+ /* Check for ptracing, and update the task SID if ok.
+ Otherwise, leave SID unchanged and kill. */
+ if (unsafe & (LSM_UNSAFE_PTRACE | LSM_UNSAFE_PTRACE_CAP)) {
+- rc = avc_has_perm(tsec->ptrace_sid, sid,
+- SECCLASS_PROCESS, PROCESS__PTRACE,
+- NULL);
+- if (rc) {
+- bsec->unsafe = 1;
+- return;
++ struct task_struct *tracer;
++ struct task_security_struct *sec;
++ u32 ptsid = 0;
++
++ rcu_read_lock();
++ tracer = tracehook_tracer_task(current);
++ if (likely(tracer != NULL)) {
++ sec = tracer->security;
++ ptsid = sec->sid;
++ }
++ rcu_read_unlock();
++
++ if (ptsid != 0) {
++ rc = avc_has_perm(ptsid, sid, SECCLASS_PROCESS,
++ PROCESS__PTRACE, NULL);
++ if (rc) {
++ bsec->unsafe = 1;
++ return;
++ }
+ }
+ }
+ tsec->sid = sid;
+@@ -2207,7 +2214,7 @@ static void selinux_bprm_post_apply_cred
+
+ /* Wake up the parent if it is waiting so that it can
+ recheck wait permission to the new task SID. */
+- wake_up_interruptible(¤t->parent->signal->wait_chldexit);
++ wake_up_interruptible(¤t->real_parent->signal->wait_chldexit);
+ }
+
+ /* superblock security operations */
+@@ -3080,11 +3087,6 @@ static int selinux_task_alloc_security(s
+ tsec2->keycreate_sid = tsec1->keycreate_sid;
+ tsec2->sockcreate_sid = tsec1->sockcreate_sid;
+
+- /* Retain ptracer SID across fork, if any.
+- This will be reset by the ptrace hook upon any
+- subsequent ptrace_attach operations. */
+- tsec2->ptrace_sid = tsec1->ptrace_sid;
+-
+ return 0;
+ }
+
+@@ -5050,6 +5052,7 @@ static int selinux_setprocattr(struct ta
+ char *name, void *value, size_t size)
+ {
+ struct task_security_struct *tsec;
++ struct task_struct *tracer;
+ u32 sid = 0;
+ int error;
+ char *str = value;
+@@ -5138,18 +5141,24 @@ static int selinux_setprocattr(struct ta
+ /* Check for ptracing, and update the task SID if ok.
+ Otherwise, leave SID unchanged and fail. */
+ task_lock(p);
+- if (p->ptrace & PT_PTRACED) {
+- error = avc_has_perm_noaudit(tsec->ptrace_sid, sid,
++ rcu_read_lock();
++ tracer = tracehook_tracer_task(p);
++ if (tracer != NULL) {
++ struct task_security_struct *ptsec = tracer->security;
++ u32 ptsid = ptsec->sid;
++ rcu_read_unlock();
++ error = avc_has_perm_noaudit(ptsid, sid,
+ SECCLASS_PROCESS,
+ PROCESS__PTRACE, 0, &avd);
+ if (!error)
+ tsec->sid = sid;
+ task_unlock(p);
+- avc_audit(tsec->ptrace_sid, sid, SECCLASS_PROCESS,
++ avc_audit(ptsid, sid, SECCLASS_PROCESS,
+ PROCESS__PTRACE, &avd, error, NULL);
+ if (error)
+ return error;
+ } else {
++ rcu_read_unlock();
+ tsec->sid = sid;
+ task_unlock(p);
+ }
+diff --git a/security/selinux/include/objsec.h b/security/selinux/include/objsec.h
+index c6c2bb4..1db31c2 100644
+--- a/security/selinux/include/objsec.h
++++ b/security/selinux/include/objsec.h
+@@ -35,7 +35,6 @@ struct task_security_struct {
+ u32 create_sid; /* fscreate SID */
+ u32 keycreate_sid; /* keycreate SID */
+ u32 sockcreate_sid; /* fscreate SID */
+- u32 ptrace_sid; /* SID of ptrace parent */
+ };
+
+ struct inode_security_struct {
Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/kernel.spec,v
retrieving revision 1.510
retrieving revision 1.511
diff -u -r1.510 -r1.511
--- kernel.spec 19 Mar 2008 19:24:55 -0000 1.510
+++ kernel.spec 19 Mar 2008 20:03:50 -0000 1.511
@@ -558,23 +558,7 @@
Patch10: linux-2.6-hotfixes.patch
-Patch21: linux-2.6-utrace-tracehook.patch
-Patch22: linux-2.6-utrace-tracehook-ia64.patch
-Patch23: linux-2.6-utrace-tracehook-sparc64.patch
-Patch24: linux-2.6-utrace-tracehook-s390.patch
-Patch25: linux-2.6-utrace-tracehook-um.patch
-Patch26: linux-2.6-utrace-tracehook-avr32.patch
-Patch27: linux-2.6-utrace-regset.patch
-Patch28: linux-2.6-utrace-regset-ia64.patch
-Patch29: linux-2.6-utrace-regset-sparc64.patch
-Patch30: linux-2.6-utrace-regset-s390.patch
-Patch31: linux-2.6-utrace-regset-avr32.patch
-Patch32: linux-2.6-utrace-core.patch
-Patch33: linux-2.6-utrace-ptrace-compat.patch
-Patch34: linux-2.6-utrace-ptrace-compat-ia64.patch
-Patch35: linux-2.6-utrace-ptrace-compat-sparc64.patch
-Patch36: linux-2.6-utrace-ptrace-compat-s390.patch
-Patch37: linux-2.6-utrace-ptrace-compat-avr32.patch
+Patch21: linux-2.6-current-utrace.patch
Patch41: linux-2.6-sysrq-c.patch
Patch42: linux-2.6-x86-tune-generic.patch
@@ -980,29 +964,7 @@
# Roland's utrace ptrace replacement.
# Main patch includes i386, x86_64, powerpc.
-#ApplyPatch linux-2.6-utrace-tracehook.patch
-# Additional arch work by other contributors.
-#ApplyPatch linux-2.6-utrace-tracehook-ia64.patch
-#ApplyPatch linux-2.6-utrace-tracehook-sparc64.patch
-#ApplyPatch linux-2.6-utrace-tracehook-s390.patch
-#ApplyPatch linux-2.6-utrace-tracehook-um.patch
-#ApplyPatch linux-2.6-utrace-tracehook-avr32.patch
-# Main patch includes i386, x86_64, powerpc.
-#ApplyPatch linux-2.6-utrace-regset.patch
-# Additional arch work by other contributors.
-#ApplyPatch linux-2.6-utrace-regset-ia64.patch
-#ApplyPatch linux-2.6-utrace-regset-sparc64.patch
-#ApplyPatch linux-2.6-utrace-regset-s390.patch
-#ApplyPatch linux-2.6-utrace-regset-avr32.patch
-# Core patch has no machine dependencies.
-#ApplyPatch linux-2.6-utrace-core.patch
-# Main patch includes i386, x86_64, powerpc.
-#ApplyPatch linux-2.6-utrace-ptrace-compat.patch
-# Additional arch work by other contributors.
-#ApplyPatch linux-2.6-utrace-ptrace-compat-ia64.patch
-#ApplyPatch linux-2.6-utrace-ptrace-compat-sparc64.patch
-#ApplyPatch linux-2.6-utrace-ptrace-compat-s390.patch
-#ApplyPatch linux-2.6-utrace-ptrace-compat-avr32.patch
+ApplyPatch linux-2.6-utrace.patch
# enable sysrq-c on all kernels, not only kexec
ApplyPatch linux-2.6-sysrq-c.patch
@@ -1752,6 +1714,9 @@
%kernel_variant_files -a /%{image_install_path}/xen*-%{KVERREL} -e /etc/ld.so.conf.d/kernelcap-%{KVERREL}.conf %{with_xen} xen
%changelog
+* Wed Mar 19 2008 Roland McGrath <roland at redhat.com>
+- utrace is back, rebased
+
* Wed Mar 19 2008 Dave Jones <davej at redhat.com>
- 2.6.25-rc6-git3
--- linux-2.6-utrace-core.patch DELETED ---
--- linux-2.6-utrace-ptrace-compat-avr32.patch DELETED ---
--- linux-2.6-utrace-ptrace-compat-ia64.patch DELETED ---
--- linux-2.6-utrace-ptrace-compat-s390.patch DELETED ---
--- linux-2.6-utrace-ptrace-compat-sparc64.patch DELETED ---
--- linux-2.6-utrace-ptrace-compat.patch DELETED ---
--- linux-2.6-utrace-regset-avr32.patch DELETED ---
--- linux-2.6-utrace-regset-ia64.patch DELETED ---
--- linux-2.6-utrace-regset-s390.patch DELETED ---
--- linux-2.6-utrace-regset-sparc64.patch DELETED ---
--- linux-2.6-utrace-regset.patch DELETED ---
--- linux-2.6-utrace-tracehook-avr32.patch DELETED ---
--- linux-2.6-utrace-tracehook-ia64.patch DELETED ---
--- linux-2.6-utrace-tracehook-s390.patch DELETED ---
--- linux-2.6-utrace-tracehook-sparc64.patch DELETED ---
--- linux-2.6-utrace-tracehook-um.patch DELETED ---
--- linux-2.6-utrace-tracehook.patch DELETED ---
More information about the fedora-extras-commits
mailing list