linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* utrace regressions (was: -mm merge plans for 2.6.21)
@ 2007-02-12 12:51 Alexey Dobriyan
  2007-02-12 21:36 ` Roland McGrath
  0 siblings, 1 reply; 8+ messages in thread
From: Alexey Dobriyan @ 2007-02-12 12:51 UTC (permalink / raw)
  To: akpm, roland; +Cc: linux-kernel, devel

> utrace-utrace-tracehook.patch
> utrace-utrace-tracehook-ia64.patch
> utrace-utrace-tracehook-sparc64.patch
> utrace-utrace-tracehook-s390.patch
> utrace-utrace-regset.patch
> utrace-utrace-regset-ia64.patch
> utrace-utrace-regset-sparc64.patch
> utrace-utrace-regset-s390.patch
> utrace-utrace-core.patch
> utrace-utrace-ptrace-compat.patch
> utrace-utrace-ptrace-compat-ia64.patch
> utrace-utrace-ptrace-compat-sparc64.patch
> utrace-utrace-ptrace-compat-s390.patch

>  utrace just got added to -mm.

We're aware of two regressions compared to mainline if ptrace is utrace:


1) zero holes for PTRACE_PEEKUSR vanished.

  strace(1) when sees unknown syscall, does something like:

	for (i = 0; i < MAX_ARGS; i++)
	  	if (ptrace(PTRACE_PEEKUSR, i * 4, ...) < 0)
			return -1;

  since THREAD_SIZE is 17 on x86 which is less that MAX_ARGS (32 on
  x86), you'll get -EIO(utrace) or 0(ptrace) when i=0.

  No new syscalls stracing for developers.

Proposed patch:

--- a/arch/i386/kernel/ptrace.c
+++ b/arch/i386/kernel/ptrace.c
@@ -728,6 +728,7 @@ EXPORT_SYMBOL_GPL(utrace_i386_native);
 #ifdef CONFIG_PTRACE
 static const struct ptrace_layout_segment i386_uarea[] = {
 	{0, FRAME_SIZE*4, 0, 0},
+	{FRAME_SIZE*4, offsetof(struct user, u_debugreg[0]), -1, 0},
 	{offsetof(struct user, u_debugreg[0]),
 	 offsetof(struct user, u_debugreg[8]), 4, 0},
 	{0, 0, -1, 0}


Looks like x86_64 also needs zero holes added, haven't checked in runtime.

-------------------------------------------------------------------

2. The following proggie renders box unusable in ~10 seconds (but not
   mainline kernel where Ctrl+C will kill process).


#include <stdio.h>
#include <unistd.h>
#include <pthread.h>
#include <sys/ptrace.h>
#include <signal.h>

static void *thread_func(void *arg)
{
	execl("/proc/self/exe", NULL);
	return NULL;
}

int main(int argc, const char *argv[])
{
	pthread_t thread;
	int pid, n;

	if (argv[0] && (pid = fork()))
		for (n = 1; /*n < 1000000*/; ++n) {
			ptrace(PTRACE_ATTACH, pid, NULL, 0);
			ptrace(PTRACE_DETACH, pid, NULL, 0);
			if (!(n % 100000))
				printf("passed: %d\n", n);
		}

	if (pthread_create(&thread, NULL, thread_func, NULL))
		perror("pthread_create");

	while (1)
		pause();
	return 1;
}


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-03-07  9:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-12 12:51 utrace regressions (was: -mm merge plans for 2.6.21) Alexey Dobriyan
2007-02-12 21:36 ` Roland McGrath
2007-02-13 13:05   ` Alexey Dobriyan
2007-02-15 12:09     ` Alexey Dobriyan
2007-02-13 15:35   ` Alexey Dobriyan
2007-02-18  2:35     ` Roland McGrath
2007-02-21 13:37       ` Alexey Dobriyan
2007-03-07  9:10         ` Roland McGrath

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 NNTP newsgroup(s).