All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH dovetail/master & v5.10] x86: dovetail: add support to 32-bit syscall path
@ 2021-03-10 15:51 Jan Kiszka
  2021-03-14 16:25 ` Philippe Gerum
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Kiszka @ 2021-03-10 15:51 UTC (permalink / raw)
  To: Philippe Gerum, Xenomai, Evl

From: Jan Kiszka <jan.kiszka@siemens.com>

Analogously to do_syscall_64.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 arch/x86/entry/common.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c
index c93d6be8f3ac..dc90c7fb4b9b 100644
--- a/arch/x86/entry/common.c
+++ b/arch/x86/entry/common.c
@@ -99,11 +99,22 @@ __visible noinstr void do_int80_syscall_32(struct pt_regs *regs)
 	 * or may not be necessary, but it matches the old asm behavior.
 	 */
 	nr = (unsigned int)syscall_enter_from_user_mode(regs, nr);
+
+	if (dovetailing()) {
+		if (nr == EXIT_SYSCALL_OOB) {
+			hard_local_irq_disable();
+			return;
+		}
+		if (nr == EXIT_SYSCALL_TAIL)
+			goto done;
+	}
+
 	instrumentation_begin();
 
 	do_syscall_32_irqs_on(regs, nr);
 
 	instrumentation_end();
+done:
 	syscall_exit_to_user_mode(regs);
 }
 
@@ -145,9 +156,20 @@ static noinstr bool __do_fast_syscall_32(struct pt_regs *regs)
 	/* The case truncates any ptrace induced syscall nr > 2^32 -1 */
 	nr = (unsigned int)syscall_enter_from_user_mode_work(regs, nr);
 
+	if (dovetailing()) {
+		if (nr == EXIT_SYSCALL_OOB) {
+			instrumentation_end();
+			hard_local_irq_disable();
+			return true;
+		}
+		if (nr == EXIT_SYSCALL_TAIL)
+			goto done;
+	}
+
 	/* Now this is just like a normal syscall. */
 	do_syscall_32_irqs_on(regs, nr);
 
+done:
 	instrumentation_end();
 	syscall_exit_to_user_mode(regs);
 	return true;
-- 
2.26.2


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

* Re: [PATCH dovetail/master & v5.10] x86: dovetail: add support to 32-bit syscall path
  2021-03-10 15:51 [PATCH dovetail/master & v5.10] x86: dovetail: add support to 32-bit syscall path Jan Kiszka
@ 2021-03-14 16:25 ` Philippe Gerum
  0 siblings, 0 replies; 2+ messages in thread
From: Philippe Gerum @ 2021-03-14 16:25 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Xenomai, Evl


Jan Kiszka <jan.kiszka@siemens.com> writes:

> From: Jan Kiszka <jan.kiszka@siemens.com>
>
> Analogously to do_syscall_64.
>
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>  arch/x86/entry/common.c | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
>
> diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c
> index c93d6be8f3ac..dc90c7fb4b9b 100644
> --- a/arch/x86/entry/common.c
> +++ b/arch/x86/entry/common.c
> @@ -99,11 +99,22 @@ __visible noinstr void do_int80_syscall_32(struct pt_regs *regs)
>  	 * or may not be necessary, but it matches the old asm behavior.
>  	 */
>  	nr = (unsigned int)syscall_enter_from_user_mode(regs, nr);
> +
> +	if (dovetailing()) {
> +		if (nr == EXIT_SYSCALL_OOB) {
> +			hard_local_irq_disable();
> +			return;
> +		}
> +		if (nr == EXIT_SYSCALL_TAIL)
> +			goto done;
> +	}
> +
>  	instrumentation_begin();
>  
>  	do_syscall_32_irqs_on(regs, nr);
>  
>  	instrumentation_end();
> +done:
>  	syscall_exit_to_user_mode(regs);
>  }
>  
> @@ -145,9 +156,20 @@ static noinstr bool __do_fast_syscall_32(struct pt_regs *regs)
>  	/* The case truncates any ptrace induced syscall nr > 2^32 -1 */
>  	nr = (unsigned int)syscall_enter_from_user_mode_work(regs, nr);
>  
> +	if (dovetailing()) {
> +		if (nr == EXIT_SYSCALL_OOB) {
> +			instrumentation_end();
> +			hard_local_irq_disable();
> +			return true;
> +		}
> +		if (nr == EXIT_SYSCALL_TAIL)
> +			goto done;
> +	}
> +
>  	/* Now this is just like a normal syscall. */
>  	do_syscall_32_irqs_on(regs, nr);
>  
> +done:
>  	instrumentation_end();
>  	syscall_exit_to_user_mode(regs);
>  	return true;

Merged, thanks.

-- 
Philippe.


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

end of thread, other threads:[~2021-03-14 16:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-10 15:51 [PATCH dovetail/master & v5.10] x86: dovetail: add support to 32-bit syscall path Jan Kiszka
2021-03-14 16:25 ` Philippe Gerum

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.