utrace: remove indirections
Subsystems (13)
PATCH 1/1 utrace: remove indirections
Currently generic code calls into tracehook_* which then alls into utrace_* to do the actual work. With utrace as the new singing dancing framework there's little point in that, and readability would be greatly improved by getting rid of this. The few places where tracehook_* was more than a one-liner and used in multiple places in arch code I renamed the call to utrace_*.
Also kill the CONFIG_UTRACE config option, there's very little reason in not having a core debugging mechanisms, and this allows to get rid of another layer of wrapping again.
arch/arm/kernel/ptrace.c +1 -1
@@ -820,7 +820,7 @@ asmlinkage int syscall_trace(int why, st ip = regs->ARM_ip; regs->ARM_ip = why; -tracehook_report_syscall (regs, why); +utrace_report_syscall (regs, why); regs->ARM_ip = ip; }
arch/arm26/kernel/ptrace.c +1 -1
@@ -661,7 +661,7 @@ asmlinkage void syscall_trace(int why, s ip = regs->ARM_ip; regs->ARM_ip = why; -tracehook_report_syscall (regs, why); +utrace_report_syscall (regs, why); regs->ARM_ip = ip; }
arch/frv/kernel/ptrace.c +1 -1
@@ -706,5 +706,5 @@ asmlinkage void do_syscall_trace(int leaelse __frame->__status |=REG__STATUS_SYSC_ENTRY ; -tracehook_report_syscall (regs, leaving); +utrace_report_syscall (regs, leaving); }
arch/i386/kernel/ptrace.c +1 -2
@@ -804,11 +804,10 @@ void do_syscall_trace(struct pt_regs *reaudit_syscall_exit (AUDITSC_RESULT (regs->eax), regs->eax);if (test_thread_flag (TIF_SYSCALL_TRACE )) -tracehook_report_syscall (regs, entryexit); +utrace_report_syscall (regs, entryexit);if (test_thread_flag (TIF_SINGLESTEP ) && entryexit) {send_sigtrap (current, regs,0 );/* XXX */ -tracehook_report_syscall_step (regs); }if (unlikely (current->audit_context) && !entryexit)
arch/i386/kernel/signal.c +1 -1
@@ -543,7 +543,7 @@ handle_signal(unsigned long sig, siginfo* handler too. */ regs->eflags &= ~TF_MASK ; -tracehook_report_handle_signal (sig, ka, oldset, regs); +utrace_report_handle_signal (sig, ka, oldset, regs); }return ret;
arch/ia64/ia32/sys_ia32.c +0 -2
@@ -1869,7 +1869,6 @@ sys32_ptrace (int request, pid_t pid, un }#endif -#ifdef CONFIG_UTRACE typedef struct utrace_get { void *kbuf; void __user *ubuf;
@@ -2339,7 +2338,6 @@ const struct utrace_regset_view utrace_i .regsets = ia32_regsets, .n = ARRAY_SIZE(ia32_regsets) };EXPORT_SYMBOL_GPL (utrace_ia32_view); -#endif #ifdef CONFIG_PTRACE /*
arch/ia64/kernel/ptrace.c +2 -8
@@ -726,7 +726,7 @@ syscall_trace_enter (long arg0, long arg struct pt_regs regs) {if (test_thread_flag (TIF_SYSCALL_TRACE )) -tracehook_report_syscall (®s,0 ); +utrace_report_syscall (®s,0 );if (unlikely (current->audit_context)) {long syscall;
@@ -762,17 +762,14 @@ syscall_trace_leave (long arg0, long arg }if (test_thread_flag (TIF_SYSCALL_TRACE )) -tracehook_report_syscall (®s,1 ); +utrace_report_syscall (®s,1 );if (test_thread_flag (TIF_SINGLESTEP )) {force_sig (SIGTRAP , current);/* XXX */ -tracehook_report_syscall_step (®s); } } -#ifdef CONFIG_UTRACE -/* Utrace implementation starts here */ typedef struct utrace_get {
@@ -1552,9 +1549,6 @@ const struct utrace_regset_view utrace_i };EXPORT_SYMBOL_GPL (utrace_ia64_native); -#endif /* CONFIG_UTRACE */ - -#ifdef CONFIG_PTRACE #define WORD (member, num) \
arch/ia64/kernel/signal.c +1 -1
@@ -472,7 +472,7 @@ handle_signal (unsigned long sig, structrecalc_sigpending ();spin_unlock_irq (¤t->sighand->siglock); -tracehook_report_handle_signal (sig, ka, oldset, &scr->pt); +utrace_report_handle_signal (sig, ka, oldset, &scr->pt);return 1 ; }
arch/mips/kernel/ptrace.c +1 -1
@@ -488,7 +488,7 @@ asmlinkage void do_syscall_trace(struct regs->regs[2]);if (test_thread_flag (TIF_SYSCALL_TRACE )) -tracehook_report_syscall (regs, entryexit); +utrace_report_syscall (regs, entryexit);if (unlikely (current->audit_context) && !entryexit) audit_syscall_entry(audit_arch(), regs->regs[2],
arch/powerpc/kernel/ptrace.c +2 -3
@@ -710,7 +710,7 @@ void do_syscall_trace_enter(struct pt_resecure_computing (regs->gpr[0 ]);if (test_thread_flag (TIF_SYSCALL_TRACE )) -tracehook_report_syscall (regs,0 ); +utrace_report_syscall (regs,0 );if (unlikely (current->audit_context)) {#ifdef CONFIG_PPC64
@@ -737,10 +737,9 @@ void do_syscall_trace_leave(struct pt_re regs->result);if (test_thread_flag (TIF_SYSCALL_TRACE )) -tracehook_report_syscall (regs,1 ); +utrace_report_syscall (regs,1 );if (test_thread_flag (TIF_SINGLESTEP )) {force_sig (SIGTRAP , current);/* XXX */ -tracehook_report_syscall_step (regs); } }
arch/powerpc/kernel/signal_32.c +1 -1
@@ -1280,7 +1280,7 @@ no_signal:if (test_thread_flag (TIF_RESTORE_SIGMASK ))clear_thread_flag (TIF_RESTORE_SIGMASK ); -tracehook_report_handle_signal (signr, &ka, oldset, regs); +utrace_report_handle_signal (signr, &ka, oldset, regs); }return ret;
arch/powerpc/kernel/signal_64.c +1 -1
@@ -461,7 +461,7 @@ static int handle_signal(unsigned long srecalc_sigpending ();spin_unlock_irq (¤t->sighand->siglock); -tracehook_report_handle_signal (sig, ka, oldset, regs); +utrace_report_handle_signal (sig, ka, oldset, regs); }return ret;
arch/s390/kernel/compat_signal.c +1 -1
@@ -581,7 +581,7 @@ handle_signal32(unsigned long sig, strucrecalc_sigpending ();spin_unlock_irq (¤t->sighand->siglock); -tracehook_report_handle_signal (sig, ka, oldset, regs); +utrace_report_handle_signal (sig, ka, oldset, regs); }return ret;
arch/s390/kernel/ptrace.c +1 -1
@@ -726,7 +726,7 @@ syscall_trace(struct pt_regs *regs, intaudit_syscall_exit (AUDITSC_RESULT (regs->gprs[2 ]), regs->gprs[2 ]);if (test_thread_flag (TIF_SYSCALL_TRACE )) { -tracehook_report_syscall (regs, entryexit); +utrace_report_syscall (regs, entryexit);/* * If the debugger has set an invalid system call number,
arch/s390/kernel/signal.c +1 -1
@@ -397,7 +397,7 @@ handle_signal(unsigned long sig, structrecalc_sigpending ();spin_unlock_irq (¤t->sighand->siglock); -tracehook_report_handle_signal (sig, ka, oldset, regs); +utrace_report_handle_signal (sig, ka, oldset, regs); }return ret;
arch/s390/kernel/traps.c +2 -2
@@ -360,7 +360,7 @@ void __kprobes do_single_step(struct pt_ SIGTRAP) == NOTIFY_STOP){return ; } -if (tracehook_consider_fatal_signal (current,SIGTRAP )) +if (utrace_consider_fatal_signal (current,SIGTRAP ))force_sig (SIGTRAP , current); }
@@ -461,7 +461,7 @@ static void illegal_op(struct pt_regs *if (get_user (*((__u16 *) opcode), (__u16 __user *) location))return ;if (*((__u16 *) opcode) ==S390_BREAKPOINT_U16 ) { -if (tracehook_consider_fatal_signal (current,SIGTRAP )) +if (utrace_consider_fatal_signal (current,SIGTRAP ))force_sig (SIGTRAP , current);else signal =SIGILL ;
arch/sparc64/kernel/ptrace.c +1 -1
@@ -789,7 +789,7 @@ asmlinkage void syscall_trace(struct pt_ }if (test_thread_flag (TIF_SYSCALL_TRACE )) -tracehook_report_syscall (regs, syscall_exit_p); +utrace_report_syscall (regs, syscall_exit_p);if (unlikely (current->audit_context) && !syscall_exit_p) audit_syscall_entry((test_thread_flag(TIF_32BIT) ?
arch/sparc64/kernel/signal.c +1 -1
@@ -492,7 +492,7 @@ static inline void handle_signal(unsignesigaddset (¤t->blocked,signr);recalc_sigpending ();spin_unlock_irq (¤t->sighand->siglock); -tracehook_report_handle_signal (signr, ka, oldset, regs); +utrace_report_handle_signal (signr, ka, oldset, regs); } static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs,
arch/sparc64/kernel/signal32.c +1 -1
@@ -1238,7 +1238,7 @@ static inline void handle_signal32(unsigsigaddset (¤t->blocked,signr);recalc_sigpending ();spin_unlock_irq (¤t->sighand->siglock); -tracehook_report_handle_signal (signr, ka, oldset, regs); +utrace_report_handle_signal (signr, ka, oldset, regs); } static inline void syscall_restart32(unsigned long orig_i0, struct pt_regs *regs,
arch/um/kernel/ptrace.c +2 -4
@@ -52,12 +52,10 @@ void do_syscall_trace(struct pt_regs *re UPT_SYSCALL_RET(®s->regs));if (test_thread_flag (TIF_SYSCALL_TRACE )) -tracehook_report_syscall (regs, entryexit); +utrace_report_syscall (regs, entryexit); -if (test_thread_flag (TIF_SINGLESTEP ) && entryexit) { +if (test_thread_flag (TIF_SINGLESTEP ) && entryexit)send_sigtrap (current, regs,0 );/* XXX */ -tracehook_report_syscall_step (regs); - }if (unlikely (current->audit_context) && !entryexit) audit_syscall_entry(HOST_AUDIT_ARCH,
arch/um/kernel/signal.c +1 -1
@@ -95,7 +95,7 @@ static int handle_signal(struct pt_regsrecalc_sigpending ();spin_unlock_irq (¤t->sighand->siglock); -tracehook_report_handle_signal (signr, ka, oldset, regs); +utrace_report_handle_signal (signr, ka, oldset, regs); }return err;
arch/x86_64/kernel/ptrace.c +3 -5
@@ -758,7 +758,7 @@ asmlinkage void syscall_trace_enter(strusecure_computing (regs->orig_rax);if (test_thread_flag (TIF_SYSCALL_TRACE )) -tracehook_report_syscall (regs,0 ); +utrace_report_syscall (regs,0 );if (unlikely (current->audit_context)) {if (test_thread_flag (TIF_IA32 )) {
@@ -781,10 +781,8 @@ asmlinkage void syscall_trace_leave(struaudit_syscall_exit (AUDITSC_RESULT (regs->rax), regs->rax);if (test_thread_flag (TIF_SYSCALL_TRACE )) -tracehook_report_syscall (regs,1 ); +utrace_report_syscall (regs,1 ); -if (test_thread_flag (TIF_SINGLESTEP )) { +if (test_thread_flag (TIF_SINGLESTEP ))force_sig (SIGTRAP , current);/* XXX */ -tracehook_report_syscall_step (regs); - } }
arch/x86_64/kernel/signal.c +1 -1
@@ -380,7 +380,7 @@ handle_signal(unsigned long sig, siginfo* handler too. */ regs->eflags &= ~TF_MASK ; -tracehook_report_handle_signal (sig, ka, oldset, regs); +utrace_report_handle_signal (sig, ka, oldset, regs); }return ret;
arch/x86_64/mm/fault.c +1 -1
@@ -225,7 +225,7 @@ int unhandled_signal(struct task_struct {if (is_init (tsk))return 1 ; -if (tracehook_consider_fatal_signal (tsk, sig)) +if (utrace_consider_fatal_signal (tsk, sig))return 0 ;return (tsk->sighand->action[sig-1 ].sa.sa_handler ==SIG_IGN ) || (tsk->sighand->action[sig-1 ].sa.sa_handler ==SIG_DFL );
fs/exec.c +7 -2
@@ -953,7 +953,11 @@ EXPORT_SYMBOL(prepare_binprm);static int unsafe_exec (struct task_struct *p) { -int unsafe =tracehook_unsafe_exec (p); +int unsafe =0 ; + +if (p->utrace_flags) + unsafe =utrace_unsafe_exec (p); +if (atomic_read (&p->fs->count) >1 ||atomic_read (&p->files->count) >1 ||atomic_read (&p->sighand->count) >1 )
@@ -1078,7 +1082,8 @@ int search_binary_handler(struct linux_b bprm->file =NULL ; current->did_exec =1 ;proc_exec_connector (current); -tracehook_report_exec (bprm, regs); +if (current->utrace_flags &UTRACE_EVENT (EXEC )) +utrace_report_exec (bprm, regs);return retval; }read_lock (&binfmt_lock);
fs/proc/array.c +1 -1
@@ -166,7 +166,7 @@ static inline char * task_state(struct tstruct fdtable *fdt =NULL ;rcu_read_lock (); - tracer =tracehook_tracer_task (p); + tracer = p->utrace_flags ?utrace_tracer_task (p) :NULL ; tracer_pid = tracer ==NULL ?0 : tracer->pid; buffer += sprintf(buffer,
fs/proc/base.c +18 -6
@@ -539,6 +539,20 @@ static const struct file_operations proc .read = proc_info_read, }; +/* +* Return nonzero if the current task should be allowed to use +* access_process_vm on the given task. +*/ +static int allow_access_process_vm (struct task_struct *tsk) +{ +if (tsk == current) +return 1 ; +if (tsk->utrace_flags) +return utrace_allow_access_process_vm (tsk); +return 0 ; +} + +static int mem_open (struct inode * inode,struct file * file) { file->private_data = (void *)((long )current->self_exec_id);
@@ -557,8 +571,7 @@ static ssize_t mem_read(struct file * fiif (!task) goto out_no_task; -if (!tracehook_allow_access_process_vm (task) - || !ptrace_may_attach (task)) +if (!allow_access_process_vm (task) || !ptrace_may_attach (task)) goto out; ret = -ENOMEM ;
@@ -584,8 +597,8 @@ static ssize_t mem_read(struct file * fi this_len = (count >PAGE_SIZE ) ?PAGE_SIZE : count; retval =access_process_vm (task, src, page, this_len,0 ); -if (!retval || !tracehook_allow_access_process_vm (task) - || !ptrace_may_attach (task)) { +if (!retval || !allow_access_process_vm (task) || + !ptrace_may_attach (task)) {if (!ret) ret = -EIO ;break ;
@@ -629,8 +642,7 @@ static ssize_t mem_write(struct file * fif (!task) goto out_no_task; -if (!tracehook_allow_access_process_vm (task) - || !ptrace_may_attach (task)) +if (!allow_access_process_vm (task) || !ptrace_may_attach (task)) goto out; copied = -ENOMEM ;
include/linux/sched.h +0 -2
@@ -941,10 +941,8 @@ struct task_struct {struct audit_context *audit_context;seccomp_t seccomp; -#ifdef CONFIG_UTRACE struct utrace *utrace;unsigned long utrace_flags; -#endif /* Thread group tracking */ u32 parent_exec_id;
include/linux/tracehook.h +2 -352
369 lines not on this page · raw message
include/linux/utrace.h +26 -103
162 lines not on this page · raw message
kernel/Makefile +1 -2
@@ -8,7 +8,7 @@ obj-y = sched.o fork.o exec_domain.o signal.o sys.o kmod.o workqueue.o pid.o \ rcupdate.o extable.o params.o posix-timers.o \ kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o mutex.o \ - hrtimer.o rwsem.o latency.o nsproxy.o srcu.o + hrtimer.o rwsem.o latency.o nsproxy.o srcu.o utrace.o obj-$(CONFIG_STACKTRACE) += stacktrace.o obj-y += time/
@@ -51,7 +51,6 @@ obj-$(CONFIG_SYSCTL) += utsname_sysctl.o obj-$(CONFIG_UTS_NS) += utsname.o obj-$(CONFIG_TASK_DELAY_ACCT) += delayacct.o obj-$(CONFIG_TASKSTATS) += taskstats.o tsacct.o -obj-$(CONFIG_UTRACE) += utrace.o obj-$(CONFIG_PTRACE) += ptrace.o ifneq ($(CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER),y)
kernel/exit.c +23 -20
109 lines not on this page · raw message
kernel/fork.c +11 -7
@@ -1241,7 +1241,8 @@ static struct task_struct *copy_process(if (likely (p->pid)) {add_parent (p); -tracehook_init_task (p); + p->utrace_flags =0 ; + p->utrace =NULL ;if (thread_group_leader (p)) { p->signal->tty = current->signal->tty;
@@ -1362,8 +1363,9 @@ long do_fork(unsigned long clone_flags,init_completion (&vfork); } -if (likely (is_user)) -tracehook_report_clone (clone_flags, p); +if (likely (is_user) && + (current->utrace_flags &UTRACE_EVENT (CLONE ))) +utrace_report_clone (clone_flags, p); p->flags &= ~PF_STARTING ;
@@ -1378,13 +1380,15 @@ long do_fork(unsigned long clone_flags,else wake_up_new_task (p, clone_flags); -if (likely (is_user)) -tracehook_report_clone_complete (clone_flags, nr, p); +if (likely (is_user) && + (current->utrace_flags &UTRACE_ACTION_QUIESCE )) +utrace_quiescent (current,NULL );if (clone_flags &CLONE_VFORK ) {wait_for_completion (&vfork); -if (likely (is_user)) -tracehook_report_vfork_done (p, nr); +if (likely (is_user) && + (current->utrace_flags &UTRACE_EVENT (VFORK_DONE ))) +utrace_report_vfork_done (nr); } }else {free_pid (pid);
kernel/signal.c +15 -11
@@ -178,7 +178,7 @@ static int sig_ignored(struct task_strucreturn 0 ;/* It's ignored, we can short-circuit unless a debugger wants it. */ -return !tracehook_consider_ignored_signal (t, sig, handler); +return !(t->utrace_flags &UTRACE_EVENT (SIGNAL_IGN )); }/*
@@ -219,7 +219,7 @@ fastcall void recalc_sigpending_tsk(stru (freezing(t)) || PENDING(&t->pending, &t->blocked) || PENDING(&t->signal->shared_pending, &t->blocked) || - tracehook_induce_sigpending(t)) + unlikely(t->utrace_flags & UTRACE_ACTION_QUIESCE))set_tsk_thread_flag (t,TIF_SIGPENDING ); elseclear_tsk_thread_flag (t ,TIF_SIGPENDING );
@@ -927,7 +927,7 @@ __group_complete_signal(int sig, struct*/ if (sig_fatal (p, sig) && !(p->signal->flags &SIGNAL_GROUP_EXIT ) && !sigismember (&t->real_blocked, sig) && - (sig ==SIGKILL || !tracehook_consider_fatal_signal (t, sig))) { + (sig ==SIGKILL || !utrace_consider_fatal_signal (t, sig))) {/* * This signal will be fatal to the whole group. */
@@ -1570,7 +1570,7 @@ void do_notify_parent_cldstop(struct tas/* * Tracing can decide that we should not do the normal notification. */ -if (tracehook_notify_cldstop (tsk, &info)) +if (tsk->utrace_flags &UTRACE_ACTION_NOREAP )return ; tsk = tsk->group_leader;
@@ -1591,12 +1591,12 @@ void do_notify_parent_cldstop(struct tasstatic void finish_stop (int stop_count) { -/* -* If there are no other threads in the group, or if there is -* a group stop in progress and we are the last to stop, -* report to the parent. When ptraced, every thread reports itself. -*/ -if (!tracehook_finish_stop (stop_count <=0 ) && stop_count <=0 ) { +int skip_notify =0 ; + +if (current->utrace_flags &UTRACE_EVENT (JCTL )) + skip_notify =utrace_report_jctl (CLD_STOPPED ); + +if (!skip_notify && stop_count <=0 ) {read_lock (&tasklist_lock);do_notify_parent_cldstop (current,CLD_STOPPED );read_unlock (&tasklist_lock);
@@ -1728,7 +1728,11 @@ relock:* The return value in signr determines the default action, * but info->si_signo is the signal number we will report. */ - signr =tracehook_get_signal (current, regs, info, return_ka); +if (unlikely (current->utrace_flags)) + signr =utrace_get_signal (current, regs, + info, return_ka); +else + signr =0 ;if (unlikely (signr <0 )) goto relock;if (unlikely (signr !=0 ))
kernel/utrace.c +1 -1
@@ -1464,7 +1464,7 @@ utrace_report_exec(struct linux_binprm ** Called iff UTRACE_EVENT(SYSCALL_{ENTRY,EXIT}) flag is set. */ void -utrace_report_syscall (struct pt_regs *regs,int is_exit) +__utrace_report_syscall (struct pt_regs *regs,int is_exit) {struct task_struct *tsk = current;struct utrace *utrace = tsk->utrace;
security/selinux/hooks.c +3 -2
@@ -1849,7 +1849,8 @@ static void selinux_bprm_apply_creds(strstruct task_struct *t;rcu_read_lock (); - t =tracehook_tracer_task (current); + t = current->utrace_flags ? +utrace_tracer_task (current) :NULL ;if (unlikely (t ==NULL ))rcu_read_unlock ();else {
@@ -4602,7 +4603,7 @@ static int selinux_setprocattr(struct taOtherwise, leave SID unchanged and fail. */ task_lock (p);rcu_read_lock (); - tracer =tracehook_tracer_task (p); + tracer = p->utrace_flags ?utrace_tracer_task (p) :NULL ;if (tracer !=NULL ) {struct task_security_struct *ptsec = tracer->security;u32 ptsid = ptsec->sid;
init/Kconfig +1 -15
@@ -597,24 +597,10 @@ endmenu menu "Process debugging support" -config UTRACE - bool "Infrastructure for tracing and debugging user processes" - default y - help - Enable the utrace process tracing interface. - This is an internal kernel interface to track events in user - threads, extract and change user thread state. This interface - is exported to kernel modules, and is also used to implement ptrace. - If you disable this, no facilities for debugging user processes - will be available, nor the facilities used by UML and other - applications. Unless you are making a specially stripped-down - kernel and are very sure you don't need these facilitiies, - say Y. - config PTRACE bool "Legacy ptrace system call interface" default y - depends on UTRACE && PROC_FS + depends on PROC_FS help Enable the ptrace system call. This is traditionally used by debuggers like GDB,
I am not in favor of this change.
Quoted 6 lines · Previously you
This shows very nicely why the tracehooks vs utrace abstraction is utter madness. Every tracehook 'abstraction' just conatains an ifdef block. Just kill
CONFIG_UTRACEas there is no point in making this functionality conditional an opencode the utrace functionality at the callers (or add autrace_helper for the few cases where it makes sense)
Since then I have gotten rid of the #ifdef's there so it is easier on the eyes. But that is not the crux of the issue.
Quoted 6 lines
Currently generic code calls into tracehook_* which then alls into utrace_* to do the actual work. With utrace as the new singing dancing framework there's little point in that, and readability would be greatly improved by getting rid of this. The few places where tracehook_* was more than a one-liner and used in multiple places in arch code I renamed the call to utrace_*.
I've never meant to claim that tracehook is, or should be, an abstraction layer in the sense of multiplexing across different implementations simultaneously. It's always been intended to compile away completely. The purpose of the tracehook layer is to be "abstract" in the sense that it is all that any other kernel code should need to know about the tracing infrastructure. I believe it helps readability, not of tracehook.h, but of the rest of the kernel, and maintainability too.
The first phase of my work, and an arduous one, was to untangle and document all the interwinings of the old ptrace implementation with core code and the implicit assumptions between them. utrace-tracehook.patch is the product of this work. Noone should ever have to deal with that again. Now, when someone is modifying kernel code and stumbles across a tracehook_* call, there is a single obvious place to go looking for what that's about. Each call's documentation in tracehook.h gives explicit details about the expectations of the call, including locking conditions and so forth. Someone modifying those documented expectations, e.g. by changing the locking calls in the surrounding core code, knows that this tracehook call has to be updated to resolve the conflict, and will ask around for the right people to update the tracing infrastructure to match the new core code. All the while, this poor kernel hacker was never required to think about utrace and what its implementation might need. (People who don't care what utrace is, shouldn't have to find out. People who didn't care what ptrace was, knew they were supposed to be afraid.)
Certainly the benefits of simple entry points from core code whose expectations of their callers are thoroughly documented can be retained with everything named utrace_* and tracehook.h removed. In either event, keeping all the entry points clean and their documentation complete and correct requires continuous diligent maintenance effort. Nonetheless, I do believe the separation helps. Those only interested in what they must avoid breaking incidentally have something simple to contend with in tracehook.h, rather than feeling obliged to digest utrace.txt and utrace.h to get up to speed. It may turn out that utrace is no good, or winds up being drastically different (at the least, maybe I'll think of a decent name for something, for a change). In any event, the set of tracehook entry points is unlikely to change very much, and new work won't need to touch core code all over the kernel to change the tracing infrastructure completely.
Quoted 3 lines
Also kill the
CONFIG_UTRACEconfig option, there's very little reason in not having a core debugging mechanisms, and this allows to get rid of another layer of wrapping again.
I spend most of my time debugging, so a configuration with fewer debugging facilities rather than more is somewhat hypothetical to me personally too. But I don't buy the rationale for not making this configurable. CONFIG_PROC_FS can be turned off, and I dare say /proc is used by more people more often, for what they would broadly term debugging, than is ptrace. If someone builds a special-purpose configuration for a fixed installation that has no way to attach any kind of debugger, then why should they have to compile in more dead code? Moreover, it's a good test that the interfaces between core code and the tracing infrastructure remain simple and clean that you can build a working kernel without it.
Thanks,
Roland