mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Tobias Klauser <tklauser@distanz.ch>,
	Chung-Ling Tang <cltang@codesourcery.com>,
	Walter Goossens <waltergoossens@home.nl>,
	Ley Foon Tan <lftan@altera.com>,
	linux-arch@vger.kernel.org,
	"nios2-dev@lists.rocketboards.org"
	<nios2-dev@lists.rocketboards.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: nios2: is the ptrace ABI correct?
Date: Wed, 25 Feb 2015 08:33:16 -0300	[thread overview]
Message-ID: <54EDB2FC.4050901@vanguardiasur.com.ar> (raw)
In-Reply-To: <10088870.tldQegtTla@wuerfel>



On 02/24/2015 04:25 PM, Arnd Bergmann wrote:
> On Tuesday 24 February 2015 12:28:41 Ezequiel Garcia wrote:
>>
>> Gah, no, you are right. I got confused.
>>
>> So it would be OK to avoid remove pt_regs from the uapi headers?
>> How does this affect the signal handling nios2 implementation?
>>
> 
> We have a number of architectures that don't provide this structure:
> 
> $ git grep -L pt_regs arch/*/include/uapi/asm/ptrace.h
> arch/frv/include/uapi/asm/ptrace.h
> arch/metag/include/uapi/asm/ptrace.h
> arch/openrisc/include/uapi/asm/ptrace.h
> arch/s390/include/uapi/asm/ptrace.h
> 
> so I'd assume it's ok in general not to have it. However, on
> nios2, struct pt_regs is embedded inside of struct sigcontext.
> If I read the code in arch/nios2/kernel/signal.c correctly,
> this is actually a bug and you should use a different structure
> there too, because pt_regs does not match the layout of the
> stack either. This means that the (rare) user programs that
> would know about the architecture to modify signal stacks
> are currently broken.
> 

/me is more confused now

In arch/nios2/include/asm/ucontext.h

struct ucontext {
        unsigned long     uc_flags;
        struct ucontext  *uc_link;
        stack_t           uc_stack;
        struct mcontext   uc_mcontext;
        sigset_t          uc_sigmask;
};

And in include/uapi/asm-generic/ucontext.h:

struct ucontext {
        unsigned long     uc_flags;
        struct ucontext  *uc_link;
        stack_t           uc_stack;
        struct sigcontext uc_mcontext;
        sigset_t          uc_sigmask;
};

Which one is the one that userspace sees? And why does the kernel has
two different structures?

Given this oddities, I'm wondering how troublesome would be to just
re-do this and break the ptrace and signal ABI. For instance, just
pushing pt_regs in PTRACE_GETREGSET would make things much clearer.

I guess Linus would burn me for even suggesting to breaking users... but
do we have any users at all? This arch has just been mainlined. Altera's
out-of-tree is already ABI-incompatible with mainline so that's not an
issue.

The only one using this ABI is gdb, which is easily fixed.
-- 
Ezequiel Garcia, VanguardiaSur
www.vanguardiasur.com.ar

  reply	other threads:[~2015-02-25 11:35 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-24  3:04 Ezequiel Garcia
2015-02-24  8:54 ` Arnd Bergmann
2015-02-24 15:28   ` Ezequiel Garcia
2015-02-24 19:25     ` Arnd Bergmann
2015-02-25 11:33       ` Ezequiel Garcia [this message]
2015-02-25 14:07         ` Arnd Bergmann
2015-02-27  8:57           ` Chung-Lin Tang
2015-02-27 11:19             ` Ezequiel Garcia
2015-03-04 20:56               ` Ezequiel Garcia
2015-03-09 16:54               ` Chung-Lin Tang
2015-03-09 17:02                 ` Chung-Lin Tang
2015-03-09 17:05                   ` Ezequiel Garcia
2015-03-10  2:54                     ` Ley Foon Tan
2015-03-10  6:17                       ` Chung-Lin Tang
2015-03-11  7:48                         ` Ley Foon Tan
2015-03-11 14:31                           ` Ezequiel Garcia
2015-03-12 11:07                   ` Tobias Klauser
  -- strict thread matches above, loose matches on Subject: below --
2015-02-24  2:30 Ezequiel Garcia

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=54EDB2FC.4050901@vanguardiasur.com.ar \
    --to=ezequiel@vanguardiasur.com.ar \
    --cc=arnd@arndb.de \
    --cc=cltang@codesourcery.com \
    --cc=lftan@altera.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nios2-dev@lists.rocketboards.org \
    --cc=tklauser@distanz.ch \
    --cc=waltergoossens@home.nl \
    /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

Powered by JetHome