xenomai.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Philippe Gerum <rpm@xenomai.org>
To: Florian Bezdeka <florian.bezdeka@siemens.com>
Cc: xenomai@lists.linux.dev, jan.kiszka@siemens.com
Subject: Re: [PATCH dovetail 6.8, 6.6, 6.1] x86: dovetail: Fix compat syscall handling, account for new IDT entry
Date: Tue, 23 Apr 2024 08:26:55 +0200	[thread overview]
Message-ID: <87wmoozj9l.fsf@xenomai.org> (raw)
In-Reply-To: <20240416102436.550147-1-florian.bezdeka@siemens.com>


Florian Bezdeka <florian.bezdeka@siemens.com> writes:

> The following upstream commit introduces a new IDTENTRY for handling
> compat syscall. As that commit is now backported into stable trees it
> broke compat syscall handling for dovetail.
>
> be5341eb0d43 ("x86/entry: Convert INT 0x80 emulation to IDTENTRY")
>
> We no longer end up in do_int80_syscall_32() which has the dovetail
> specific bits. We need the same handling in asm_int80_emulation().
>
> The problematic part in asm_int80_emulation() is the call to
> do_syscall_32_irqs_on() which basically overwrites regs->ax
> unconditionally. Linux does not know about the co-kernel syscalls, so
> we get -ENOSYS for each syscall result.
>
> Signed-off-by: Florian Bezdeka <florian.bezdeka@siemens.com>
> ---
>  arch/x86/entry/common.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c
> index 0220ca163a32..42e8cb036fff 100644
> --- a/arch/x86/entry/common.c
> +++ b/arch/x86/entry/common.c
> @@ -212,9 +212,21 @@ DEFINE_IDTENTRY_RAW(int80_emulation)
>  
>  	local_irq_enable();
>  	nr = syscall_enter_from_user_mode_work(regs, nr);
> +
> +	if (dovetailing()) {
> +		if (nr == EXIT_SYSCALL_OOB) {
> +			hard_local_irq_disable();
> +			return;
> +		}
> +		if (nr == EXIT_SYSCALL_TAIL)
> +			goto done;
> +	}
> +
>  	do_syscall_32_irqs_on(regs, nr);
>  
>  	instrumentation_end();
> +
> +done:
>  	syscall_exit_to_user_mode(regs);
>  }
>  #else /* CONFIG_IA32_EMULATION */

Merged, thanks.

-- 
Philippe.

      reply	other threads:[~2024-04-23  6:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-16 10:24 [PATCH dovetail 6.8, 6.6, 6.1] x86: dovetail: Fix compat syscall handling, account for new IDT entry Florian Bezdeka
2024-04-23  6:26 ` Philippe Gerum [this message]

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=87wmoozj9l.fsf@xenomai.org \
    --to=rpm@xenomai.org \
    --cc=florian.bezdeka@siemens.com \
    --cc=jan.kiszka@siemens.com \
    --cc=xenomai@lists.linux.dev \
    /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).