From: Russell King <rmk@arm.linux.org.uk>
To: Roland McGrath <roland@redhat.com>
Cc: linux-arch@vger.kernel.org, utrace-devel@redhat.com,
linux-kernel@vger.kernel.org
Subject: Re: CONFIG_HAVE_ARCH_TRACEHOOK and you
Date: Fri, 12 Sep 2008 14:40:11 +0100 [thread overview]
Message-ID: <20080912134011.GA7385@flint.arm.linux.org.uk> (raw)
ptrace_report_syscall
---------------------
What's the purpose of the PT_PTRACED check in there? The current code
is setup such that you can only start tracing syscalls if the
__ptrace_may_access test succeeds, which will only succeed if PT_PTRACED
is already set. TIF_SYSCALL_TRACE will be cleared before PT_PTRACED is
cleared when stopping ptracing. So, TIF_SYSCALL_TRACE can only ever be
set if PT_PTRACED is already set, and hopefully arch code never tries
to call the syscall tracing hooks if TIF_SYSCALL_TRACE isn't set. That
all means that the PT_PTRACED test seems redundant.
Also, shouldn't ptrace_report_syscall() be in linux/ptrace.h, since it's
just the guts of the existing syscall tracing hook irrespective of the
tracehook stuff?
syscall
-------
* syscall_get_arguments - extract system call parameter values
* @task: task of interest, must be blocked
* @regs: task_pt_regs() of @task
* @i: argument index [0,5]
* @n: number of arguments; n+i must be [1,6].
* @args: array filled with argument values
This is all very well, but adds a lot of complexity for architectures
which isn't currently required. This is fine if you have a sane ABI
where you can just pick the arguments straight out of the registers one
by one.
However, with ARM EABI, we have the situation where, for a syscall such
as:
long sys_foo(int a, long long b, long long c, int d);
the register allocation ends up as:
a => r0
b => r2, r3
c => r4, r5
d => r6
whereas:
long sys_foo(long long a, long long b, int c, int d);
the register allocation ends up as:
a => r0, r1
b => r2, r3
c => r4
d => r5
So, in order to know which register argument N is in, you need to know
all the types of the arguments which come before it. That means
creating and maintaining a table of syscall arguments which sounds
really sucky.
I can think of why you want these interfaces - because you see it as
necessary for things like strace. However, strace needs to know the
type information for each syscall argument in any case, so by putting
the requirement for arg N access into the kernel, you're causing that
type information to be placed not only in strace but also into the
kernel.
It also means that you can't randomly change the syscall number, since
changing the syscall number between those two examples means you need
to reshuffle the registers to make the arguments fit.
To me, this looks like a source of a large can of worms. Is this really
necessary, or can we keep this functionality pushed to where it belongs -
in the very few userspace applications which require it?
I think the rest of syscall.h shouldn't be that much of a problem for ARM.
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of:
next reply other threads:[~2008-09-12 13:40 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-12 13:40 Russell King [this message]
2008-09-12 13:40 ` CONFIG_HAVE_ARCH_TRACEHOOK and you Russell King
2008-09-12 23:57 ` Roland McGrath
2008-09-12 23:57 ` Roland McGrath
-- strict thread matches above, loose matches on Subject: below --
2008-09-12 2:57 Roland McGrath
2008-09-12 2:57 ` Roland McGrath
2008-09-12 8:23 ` Christoph Hellwig
2008-09-12 13:05 ` Paul Mundt
2008-09-15 20:38 ` Roland McGrath
2008-09-12 13:13 ` Russell King
2008-09-12 21:57 ` David Miller
2008-09-12 22:31 ` Roland McGrath
2008-09-12 22:31 ` Roland McGrath
2008-09-12 22:37 ` David Miller
2008-09-12 22:39 ` Roland McGrath
2008-09-12 22:39 ` Roland McGrath
2008-09-12 22:40 ` David Miller
2008-09-12 22:45 ` Roland McGrath
2008-09-12 22:45 ` 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=20080912134011.GA7385@flint.arm.linux.org.uk \
--to=rmk@arm.linux.org.uk \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=roland@redhat.com \
--cc=utrace-devel@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