public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
From: "gmoreira at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: systemtap@sourceware.org
Subject: [Bug runtime/22847] ARM OABI syscall tracing issues
Date: Thu, 22 Feb 2018 00:04:00 -0000	[thread overview]
Message-ID: <bug-22847-6586-o2DqLEfm1e@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-22847-6586@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=22847

--- Comment #13 from Gustavo Moreira <gmoreira at gmail dot com> ---
(In reply to David Smith from comment #12)
> (In reply to Gustavo Moreira from comment #11)
> > (In reply to David Smith from comment #10)
> > > I wonder if we've got to handle both ABIs at once (more like a 32-bit ia32
> > > executable on a x86_64 kernel). Is CONFIG_OABI_COMPAT defined in your config
> > > file?
> > 
> > exactly, CONFIG_OABI_COMPAT=y. I think so, because when that is enabled the
> > kernel is able to execute both sort of ABI binaries.
> 
> OK, that makes more sense - I should have realized that earlier. Try the
> following patch (which tries to use the kernel's syscall_get_nr()) with
> *both* ABIs and see what syscall numbers you get:
> 
> ====
> diff --git a/runtime/syscall.h b/runtime/syscall.h
> index 5ed019869..2b551f16f 100644
> --- a/runtime/syscall.h
> +++ b/runtime/syscall.h
> @@ -169,7 +169,11 @@
>  static inline long
>  _stp_syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
>  {
> +#ifdef CONFIG_OABI_COMPAT
> +	return syscall_get_nr(task, regs);
> +#else
>  	return regs->ARM_r7;
> +#endif
>  }
>  
>  #elif defined(__mips__)
> ====

I've just realised that the ARM machine also had systemtap-runtime and
systemtap-common 3.1-2 deb packages installed in /usr/share/systemtap, apart
from the /usr/local/share/systemtap installed from the systemtap-3.2 sources,
sorry by that.
Anyway, I'm back on the right track.

Without that patch, the results are
EABI:
 SyS_connect - 283
OABI:
 SyS_connect - 32916

With that patch:
EABI:
 SyS_connect - 0
OABI:
 SyS_connect - 0

So, that patch isn't working, it's always executing syscall_get_nr() which
seems to also return 0 always as the comment just above that code explains:

/* The syscall_get_nr() function on 3.17.1-302.fc21.armv7hl always
 * returns 0 (since it was designed to be used with ftrace syscall
 * tracing, not called from any context). So, let's use our function
 * instead. */

So, the first issue we have is that we are not correctly identifying the
appropriate constant to detect when it's in OABI compatibility mode.

I've tried all the following combinations but all of them are being executed in
both cases:
#if defined(__thumb__) || defined(__ARM_EABI__)
#if defined(CONFIG_OABI_COMPAT)
#if !defined(CONFIG_AEABI) || defined(CONFIG_OABI_COMPAT)
#if defined(__ARM_EABI__)

It should be a more dynamic way to detect that, I mean instead of using
preprocessor directives. Trying to see how the kernel differentiates those
modes, any thought?

On the other hand, once we can detect that we need to extract the syscall
number from the instruction itself. I have some ideas, trying to test if it
would work.

Anyway, having this done, what else you think it would be needed? Is that the
reason why the probe aliases are not catching for instance the sys_connect
trace point?

-- 
You are receiving this mail because:
You are the assignee for the bug.

  parent reply	other threads:[~2018-02-22  0:04 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-22847-6586@http.sourceware.org/bugzilla/>
2018-02-15  6:01 ` mysecondaccountabc at gmail dot com
2018-02-15  6:09 ` mysecondaccountabc at gmail dot com
2018-02-15 15:45 ` dsmith at redhat dot com
2018-02-15 16:08 ` dsmith at redhat dot com
2018-02-16  4:06 ` mysecondaccountabc at gmail dot com
2018-02-19  6:55 ` mysecondaccountabc at gmail dot com
2018-02-19  7:02 ` mysecondaccountabc at gmail dot com
2018-02-19 14:31 ` dsmith at redhat dot com
2018-02-19 22:42 ` mysecondaccountabc at gmail dot com
2018-02-19 22:53 ` dsmith at redhat dot com
2018-02-20  1:05 ` mysecondaccountabc at gmail dot com
2018-02-20 16:03 ` dsmith at redhat dot com
2018-02-22  0:04 ` gmoreira at gmail dot com [this message]
2018-02-22 16:58 ` dsmith at redhat dot com
2018-04-18  6:50 ` gmoreira at gmail dot com
2018-04-18  6:52 ` gmoreira at gmail dot com
2018-04-18  7:05 ` gmoreira at gmail dot com
2018-04-18  7:26 ` gmoreira at gmail dot com
2018-04-30 17:16 ` dsmith at redhat dot com
2018-05-01  2:46 ` gmoreira at gmail dot com
2018-05-01 15:11 ` dsmith at redhat dot com
2023-10-06 15:55 ` wcohen at redhat dot com

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=bug-22847-6586-o2DqLEfm1e@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=systemtap@sourceware.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).