LWN.net Logo

ptrace: kill most tracehooks

From:  Tejun Heo <tj@kernel.org>
To:  linux-kernel@vger.kernel.org, oleg@redhat.com
Subject:  [PATCHSET] ptrace: kill most tracehooks
Date:  Fri, 17 Jun 2011 16:50:33 +0200
Message-ID:  <1308322240-8247-1-git-send-email-tj@kernel.org>
Cc:  akpm@linux-foundation.org, torvalds@linux-foundation.org, hch@infradead.org
Archive-link:  Article, Thread

Hello,

At this point, tracehooks aren't useful to mainline kernel and mostly
just add an extra layer of obfuscation.  Although they have comments,
without actual in-kernel users, it is difficult to tell what are their
assumptions and they're actually trying to achieve.  To mainline
kernel, they just aren't worth keeping around.

This patchset kills most tracehooks which aren't used from arch codes.
The remaining ones will be dealt with with future changes.

 0001-ptrace-kill-task_ptrace.patch
 0002-ptrace-introduce-ptrace_event_enabled-and-simplify-p.patch
 0003-ptrace-move-SIGTRAP-on-exec-2-logic-to-ptrace_event.patch
 0004-ptrace-kill-trivial-tracehooks.patch
 0005-ptrace-kill-clone-exec-tracehooks.patch
 0006-ptrace-kill-detah-tracehooks.patch
 0007-ptrace-s-tracehook_tracer_task-ptrace_parent.patch

Most conversions are straightforward.  The only tricky one is 0006
which reimplements the decision logic.

This patch is on top of Oleg's ptrace branch[1] - 544b2c91a9 (ptrace:
implement PTRACE_LISTEN), and available in the following git branch.

 git://git.kernel.org/pub/scm/linux/kernel/git/tj/misc.git review-tracehook

diffstat follows.

 arch/s390/kernel/traps.c   |    4 
 fs/exec.c                  |    9 -
 fs/proc/array.c            |    2 
 fs/proc/base.c             |    2 
 include/linux/ptrace.h     |   71 ++++++---
 include/linux/tracehook.h  |  333 ---------------------------------------------
 kernel/exit.c              |   43 +++--
 kernel/fork.c              |   43 ++++-
 kernel/signal.c            |   22 +-
 mm/nommu.c                 |    3 
 mm/oom_kill.c              |    3 
 security/apparmor/domain.c |    2 
 security/selinux/hooks.c   |    4 
 13 files changed, 136 insertions(+), 405 deletions(-)

--
tejun

[1] git://git.kernel.org/pub/scm/linux/kernel/git/oleg/misc.git ptrace
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Copyright © 2011, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds