linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@openvz.org>
To: akpm@osdl.org, roland@redhat.com
Cc: linux-kernel@vger.kernel.org, devel@openvz.org
Subject: utrace regressions (was: -mm merge plans for 2.6.21)
Date: Mon, 12 Feb 2007 15:51:56 +0300	[thread overview]
Message-ID: <20070212125156.GA6035@localhost.sw.ru> (raw)

> 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;
}


             reply	other threads:[~2007-02-12 12:44 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-12 12:51 Alexey Dobriyan [this message]
2007-02-12 21:36 ` utrace regressions (was: -mm merge plans for 2.6.21) 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070212125156.GA6035@localhost.sw.ru \
    --to=adobriyan@openvz.org \
    --cc=akpm@osdl.org \
    --cc=devel@openvz.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=roland@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).