Skip to contentSkip to conversation

arm64: ni_syscall should be similar to other archs

PATCH New per.hallsmark at windriver.com 2 participants 5 messages Feb 24, 2016 – Aug 31, 2016 arm64

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: ni_syscall should be similar to other archs

From: Per Hallsmark <[email protected]>

Today arm64 have it's own variant when a userspace app is doing a non-implemented syscall in that it dumps on console process name, registers and such. This makes a different behaviour on arm64 than on all other archs.

This patch propose to get inline with other archs.

If we want to have a note on console, syslog or so when doing a nonimplemented syscall, it would be better to add a variable show_nonimplemented_syscalls and sense on it in the generic kernel/sys_ni.c::sys_ni_syscall() which could dump info (and then it would be generic for all archs). But that is another discussion alltogether, lets first synchronize the archs to behave similar.

---
 arch/arm64/kernel/traps.c | 8 --------
 1 file changed, 8 deletions(-)
arch/arm64/kernel/traps.c +0 -8
index cbedd72..980ff63 100644
@@ -403,14 +403,6 @@ asmlinkage long do_ni_syscall(struct pt_regs *regs)
 	}
 #endif
 
-	if (show_unhandled_signals_ratelimited()) {
-		pr_info("%s[%d]: syscall %d\n", current->comm,
-			task_pid_nr(current), (int)regs->syscallno);
-		dump_instr("", regs);
-		if (user_mode(regs))
-			__show_regs(regs);
-	}
-
 	return sys_ni_syscall();
 }
 
Signature · 1 line
2.5.0
maintainer
#1 lore raw

PATCH 1/1 arm64: ni_syscall should be similar to other archs

(I forgot about this email, some two months ago)

Quoted 6 lines · per.hallsmark at windriver.com

From: Per Hallsmark <[email protected]>

Today arm64 have it's own variant when a userspace app is doing a non-implemented syscall in that it dumps on console process name, registers and such. This makes a different behaviour on arm64 than on all other archs.

Are you hitting a real issue with this? Test apps doing random syscalls?

Quoted 1 line

This patch propose to get inline with other archs.

Well, it's not fully in line, for example on arch/arm we generate a SIGILL (and I think we should fix the compat path in the arm64 do_ni_syscall() to do the same).

Quoted 6 lines

If we want to have a note on console, syslog or so when doing a nonimplemented syscall, it would be better to add a variable show_nonimplemented_syscalls and sense on it in the generic kernel/sys_ni.c::sys_ni_syscall() which could dump info (and then it would be generic for all archs). But that is another discussion alltogether, lets first synchronize the archs to behave similar.

Or we could have finer grained show_unhandled_signals variable. The user visible /proc/sys/debug/exception-trace doesn't say anything about signals.

Quoted 23 lines
---
 arch/arm64/kernel/traps.c | 8 --------
 1 file changed, 8 deletions(-)
arch/arm64/kernel/traps.c +0 -8
index cbedd72..980ff63 100644
@@ -403,14 +403,6 @@ asmlinkage long do_ni_syscall(struct pt_regs *regs)
 	}
 #endif
 
-	if (show_unhandled_signals_ratelimited()) {
-		pr_info("%s[%d]: syscall %d\n", current->comm,
-			task_pid_nr(current), (int)regs->syscallno);
-		dump_instr("", regs);
-		if (user_mode(regs))
-			__show_regs(regs);
-	}
-
 	return sys_ni_syscall();
 }
Signature · 1 line
Catalin
#2 lore raw

PATCH 1/1 arm64: ni_syscall should be similar to other archs

No problem, I managed to miss this reply with same amount ;-)

The issue was found on a real case, running lttng that tries to make use of sys_brk before falling back to internal variant. On arm64 this generates an "ugly" dump on console which dont happen on arm, x86 etc.

Ok, missed that part with SIGILL, so even more to align then.

--

Per Hallsmark                        per.hallsmark at windriver.com
Senior Member Technical Staff        Wind River AB
Mobile: +46733249340                 Office: +46859461127
Torshamnsgatan 27                    164 40 Kista

________________________________________
From: Catalin Marinas [catalin.marinas at arm.com]
Sent: Monday, April 18, 2016 11:58
To: Hallsmark, Per
Cc: linux-arm-kernel at lists.infradead.org; Will Deacon
Subject: Re: [PATCH] arm64: ni_syscall should be similar to other archs

(I forgot about this email, some two months ago)

Quoted 6 lines · per.hallsmark at windriver.com

From: Per Hallsmark <[email protected]>

Today arm64 have it's own variant when a userspace app is doing a non-implemented syscall in that it dumps on console process name, registers and such. This makes a different behaviour on arm64 than on all other archs.

Are you hitting a real issue with this? Test apps doing random syscalls?

Quoted 1 line

This patch propose to get inline with other archs.

Well, it's not fully in line, for example on arch/arm we generate a SIGILL (and I think we should fix the compat path in the arm64 do_ni_syscall() to do the same).

Quoted 6 lines

If we want to have a note on console, syslog or so when doing a nonimplemented syscall, it would be better to add a variable show_nonimplemented_syscalls and sense on it in the generic kernel/sys_ni.c::sys_ni_syscall() which could dump info (and then it would be generic for all archs). But that is another discussion alltogether, lets first synchronize the archs to behave similar.

Or we could have finer grained show_unhandled_signals variable. The user visible /proc/sys/debug/exception-trace doesn't say anything about signals.

Quoted 13 lines
---
 arch/arm64/kernel/traps.c | 8 --------
 1 file changed, 8 deletions(-)
arch/arm64/kernel/traps.c +0 -0
index cbedd72..980ff63 100644
@@ -403,14 +403,6 @@ asmlinkage long do_ni_syscall(struct pt_regs *regs)
      }
 #endif
 

arch/arm64/kernel/traps.c asmlinkage long do_ni_syscall(struct pt_regs *regs) · line 407

Quoted 10 lines
arch/arm64/kernel/traps.c +0 -8
-     if (show_unhandled_signals_ratelimited()) {
-             pr_info("%s[%d]: syscall %d\n", current->comm,
-                     task_pid_nr(current), (int)regs->syscallno);
-             dump_instr("", regs);
-             if (user_mode(regs))
-                     __show_regs(regs);
-     }
-
      return sys_ni_syscall();
 }

--
Catalin

maintainer
#3 lore raw

PATCH 1/1 arm64: ni_syscall should be similar to other archs

Quoted 9 lines · Per
Quoted 8 lines · Catalin Marinas
Quoted 6 lines · per.hallsmark at windriver.com

From: Per Hallsmark <[email protected]>

Today arm64 have it's own variant when a userspace app is doing a non-implemented syscall in that it dumps on console process name, registers and such. This makes a different behaviour on arm64 than on all other archs.

Quoted 5 lines
Quoted 1 line

Are you hitting a real issue with this? Test apps doing random syscalls?

The issue was found on a real case, running lttng that tries to make use of sys_brk before falling back to internal variant. On arm64 this generates an "ugly" dump on console which dont happen on arm, x86 etc.

Why would a sys_brk() end up on the do_ni_syscall() path?

Signature · 1 line
Catalin
#4 lore raw

PATCH 1/1 arm64: ni_syscall should be similar to other archs

hmmm... sorry that was completely wrong syscall, sys_membarrier it should have been.

From: Catalin Marinas [catalin.marinas at arm.com]
Sent: Thursday, August 25, 2016 13:00
To: Hallsmark, Per
Cc: Will Deacon; linux-arm-kernel at lists.infradead.org
Subject: Re: [PATCH] arm64: ni_syscall should be similar to other archs

Quoted 9 lines · Per
Quoted 8 lines · Catalin Marinas
Quoted 6 lines · per.hallsmark at windriver.com

From: Per Hallsmark <[email protected]>

Today arm64 have it's own variant when a userspace app is doing a non-implemented syscall in that it dumps on console process name, registers and such. This makes a different behaviour on arm64 than on all other archs.

Quoted 5 lines
Quoted 1 line

Are you hitting a real issue with this? Test apps doing random syscalls?

The issue was found on a real case, running lttng that tries to make use of sys_brk before falling back to internal variant. On arm64 this generates an "ugly" dump on console which dont happen on arm, x86 etc.

Why would a sys_brk() end up on the do_ni_syscall() path?

--
Catalin