public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: Christoph Hellwig <hch@lst.de>,
	chris@zankel.net, cooloney@kernel.org, deller@gmx.de,
	geert@linux-m68k.org, gerg@uclinux.org, hskinnemoen@atmel.com,
	jdike@addtoit.com, jesper.nilsson@axis.com, kyle@mcmartin.ca,
	linux@arm.linux.org.uk, ralf@linux-mips.org, rth@twiddle.net,
	starvik@axis.com, takata@linux-m32r.org,
	ysato@users.sourceforge.jp, zippel@linux-m68k.org
Cc: Roland McGrath <roland@redhat.com>,
	linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org
Subject: Fwd: arch/ && tracehook_report_syscall_xxx()
Date: Wed, 29 Apr 2009 21:08:52 +0200	[thread overview]
Message-ID: <20090429190852.GA14515@redhat.com> (raw)
In-Reply-To: <20090427183218.GA31596@lst.de>

On 04/27, Christoph Hellwig wrote:
>
> I've poked a few arch maintainers in the past to separate the enter/exit
> path and usually got the desired changes :)

I'd like to try your method!

So. Dear maintainers of

	alpha
	arm
	avr32
	blackfin
	cris
	h8300
	m32r
	m68k
	m68knommu
	mips
	parisc
	um
	xtensa

. Could you please convert your syscall trace code to use
tracehook_report_syscall_entry/tracehook_report_syscall_exit ?


For example, let's look at more or less typical arch/alpha/kernel/ptrace.c,

	asmlinkage void
	syscall_trace(void)
	{
		if (!test_thread_flag(TIF_SYSCALL_TRACE))
			return;
		if (!(current->ptrace & PT_PTRACED))
			return;
		/* The 0x80 provides a way for the tracing parent to distinguish
		   between a syscall stop and SIGTRAP delivery */
		ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
					 ? 0x80 : 0));

		/*
		 * This isn't the same as continuing with a signal, but it will do
		 * for normal use.  strace only continues with a signal if the
		 * stopping signal is not SIGTRAP.  -brl
		 */
		if (current->exit_code) {
			send_sig(current->exit_code, current, 1);
			current->exit_code = 0;
		}
	}

it would be really nice to turn it into something like

	asmlinkage void
	syscall_trace(int entryexit)
	{
		if (!test_thread_flag(TIF_SYSCALL_TRACE))
			return;

		if (entryexit)
			tracehook_report_syscall_entry(task_pt_regs(current));
		else
			tracehook_report_syscall_exit(task_pt_regs(current), stepping);
	}

Also, tracehook_report_syscall_entry() might want to abort this system
call (please see the comment above this helper), it would be great to
take the returned value into account.


arch/* play with ptrace internals which should be changed soon, not good.

Thanks!

Oleg.


  reply	other threads:[~2009-04-29 19:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-27 18:04 arch/ && tracehook_report_syscall_xxx() Oleg Nesterov
2009-04-27 18:29 ` Roland McGrath
2009-04-27 18:32   ` Christoph Hellwig
2009-04-29 19:08     ` Oleg Nesterov [this message]
2009-04-29 19:17       ` Fwd: " Roland McGrath
2009-04-29 19:30       ` Ingo Molnar
2009-04-29 19:44       ` Christoph Hellwig
2009-04-29 19:53       ` Kyle McMartin
2009-04-27 18:43   ` Oleg Nesterov
2009-04-27 19:24 ` David Howells

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=20090429190852.GA14515@redhat.com \
    --to=oleg@redhat.com \
    --cc=chris@zankel.net \
    --cc=cooloney@kernel.org \
    --cc=deller@gmx.de \
    --cc=geert@linux-m68k.org \
    --cc=gerg@uclinux.org \
    --cc=hch@lst.de \
    --cc=hskinnemoen@atmel.com \
    --cc=jdike@addtoit.com \
    --cc=jesper.nilsson@axis.com \
    --cc=kyle@mcmartin.ca \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=ralf@linux-mips.org \
    --cc=roland@redhat.com \
    --cc=rth@twiddle.net \
    --cc=starvik@axis.com \
    --cc=takata@linux-m32r.org \
    --cc=ysato@users.sourceforge.jp \
    --cc=zippel@linux-m68k.org \
    /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