All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai] bad syscall <0x15b> on x86_64
@ 2019-01-29 22:14 Richard Weinberger
  2019-01-30  7:34 ` Jan Kiszka
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Weinberger @ 2019-01-29 22:14 UTC (permalink / raw)
  To: xenomai

Hi!

When running a ia32 application on x86_64 I get bad syscall errors.
This happens with ipipe-core-4.14.89-x86-2.patch and xenomai 3.0.8.

The problem seems to be that both ipipe_handle_syscall() and
handle_head_syscall()
check for syscall-nr being >= NR_syscalls.
On ia32 the syscall table is larger and therefore the check is wrong.

So the code has to check the TS_COMPAT flag and then compare either to
NR_syscalls or IA32_NR_syscalls.
I gave this already a short try and things seem to work better.

-- 
Thanks,
//richard


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: bad syscall <0x15b> on x86_64
  2019-01-29 22:14 [Xenomai] bad syscall <0x15b> on x86_64 Richard Weinberger
@ 2019-01-30  7:34 ` Jan Kiszka
  2019-01-30  8:29   ` Richard Weinberger
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Kiszka @ 2019-01-30  7:34 UTC (permalink / raw)
  To: Richard Weinberger, xenomai, Philippe Gerum

On 29.01.19 23:14, Richard Weinberger via Xenomai wrote:
> Hi!
> 
> When running a ia32 application on x86_64 I get bad syscall errors.
> This happens with ipipe-core-4.14.89-x86-2.patch and xenomai 3.0.8.
> 
> The problem seems to be that both ipipe_handle_syscall() and
> handle_head_syscall()
> check for syscall-nr being >= NR_syscalls.
> On ia32 the syscall table is larger and therefore the check is wrong.

Hmm, the kernel's tracer also only checks for NR_syscalls. Strange.

> 
> So the code has to check the TS_COMPAT flag and then compare either to
> NR_syscalls or IA32_NR_syscalls.
> I gave this already a short try and things seem to work better.
> 

There are more places where we check for NR_syscalls, some in ipipe itself. 
Problem is that IA32_NR_syscalls is, well, IA32-specific while we are testing in 
generic code. We need to abstract that first, in ipipe. Then we can fix also 
Xenomai.

Philippe, any better idea?

Jan

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: bad syscall <0x15b> on x86_64
  2019-01-30  7:34 ` Jan Kiszka
@ 2019-01-30  8:29   ` Richard Weinberger
  2019-01-30  8:59     ` Jan Kiszka
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Weinberger @ 2019-01-30  8:29 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: xenomai, Philippe Gerum

On Wed, Jan 30, 2019 at 8:34 AM Jan Kiszka <jan.kiszka@siemens.com> wrote:
>
> On 29.01.19 23:14, Richard Weinberger via Xenomai wrote:
> > Hi!
> >
> > When running a ia32 application on x86_64 I get bad syscall errors.
> > This happens with ipipe-core-4.14.89-x86-2.patch and xenomai 3.0.8.
> >
> > The problem seems to be that both ipipe_handle_syscall() and
> > handle_head_syscall()
> > check for syscall-nr being >= NR_syscalls.
> > On ia32 the syscall table is larger and therefore the check is wrong.
>
> Hmm, the kernel's tracer also only checks for NR_syscalls. Strange.

Well, the kernel tracer is in this matter a little lazy and sets
ARCH_TRACE_IGNORE_COMPAT_SYSCALLS
for x86.

-- 
Thanks,
//richard


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: bad syscall <0x15b> on x86_64
  2019-01-30  8:29   ` Richard Weinberger
@ 2019-01-30  8:59     ` Jan Kiszka
  0 siblings, 0 replies; 4+ messages in thread
From: Jan Kiszka @ 2019-01-30  8:59 UTC (permalink / raw)
  To: Richard Weinberger; +Cc: xenomai, Philippe Gerum

On 30.01.19 09:29, Richard Weinberger wrote:
> On Wed, Jan 30, 2019 at 8:34 AM Jan Kiszka <jan.kiszka@siemens.com> wrote:
>>
>> On 29.01.19 23:14, Richard Weinberger via Xenomai wrote:
>>> Hi!
>>>
>>> When running a ia32 application on x86_64 I get bad syscall errors.
>>> This happens with ipipe-core-4.14.89-x86-2.patch and xenomai 3.0.8.
>>>
>>> The problem seems to be that both ipipe_handle_syscall() and
>>> handle_head_syscall()
>>> check for syscall-nr being >= NR_syscalls.
>>> On ia32 the syscall table is larger and therefore the check is wrong.
>>
>> Hmm, the kernel's tracer also only checks for NR_syscalls. Strange.
> 
> Well, the kernel tracer is in this matter a little lazy and sets
> ARCH_TRACE_IGNORE_COMPAT_SYSCALLS
> for x86.
> 

Oh, wow...

Well, we can't be that lazy.

Jan

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-01-30  8:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-29 22:14 [Xenomai] bad syscall <0x15b> on x86_64 Richard Weinberger
2019-01-30  7:34 ` Jan Kiszka
2019-01-30  8:29   ` Richard Weinberger
2019-01-30  8:59     ` Jan Kiszka

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.