linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] arch/x86: Return value from notify_die should to be checked.
@ 2020-06-21 10:26 Bo YU
  2020-06-22  8:52 ` Alexandre Chartre
  0 siblings, 1 reply; 5+ messages in thread
From: Bo YU @ 2020-06-21 10:26 UTC (permalink / raw)
  To: tglx, mingo, bp, hpa, peterz, luto, alexandre.chartre, jannh,
	dave.hansen
  Cc: linux-kernel, tsu.yubo

This is detected by Coverity scan: #CID: 1464472(CHECKED_RETURN)

FIXES: c94082656dac7(x86: Use enum instead of literals for trap values)
Signed-off-by: Bo YU <tsu.yubo@gmail.com>
---
 arch/x86/kernel/traps.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index af75109485c2..bf014fb59017 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -401,7 +401,8 @@ DEFINE_IDTENTRY_DF(exc_double_fault)

 	nmi_enter();
 	instrumentation_begin();
-	notify_die(DIE_TRAP, str, regs, error_code, X86_TRAP_DF, SIGSEGV);
+	if (notify_die(DIE_TRAP, str, regs, error_code, X86_TRAP_DF, SIGSEGV))
+		return;

 	tsk->thread.error_code = error_code;
 	tsk->thread.trap_nr = X86_TRAP_DF;
--
2.11.0


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

* Re: [PATCH -next] arch/x86: Return value from notify_die should to be checked.
  2020-06-21 10:26 [PATCH -next] arch/x86: Return value from notify_die should to be checked Bo YU
@ 2020-06-22  8:52 ` Alexandre Chartre
  2020-06-22  9:17   ` Boris Petkov
  0 siblings, 1 reply; 5+ messages in thread
From: Alexandre Chartre @ 2020-06-22  8:52 UTC (permalink / raw)
  To: Bo YU, tglx, mingo, bp, hpa, peterz, luto, jannh, dave.hansen
  Cc: linux-kernel


On 6/21/20 12:26 PM, Bo YU wrote:
> This is detected by Coverity scan: #CID: 1464472(CHECKED_RETURN)
> 
> FIXES: c94082656dac7(x86: Use enum instead of literals for trap values)
> Signed-off-by: Bo YU <tsu.yubo@gmail.com>
> ---
> arch/x86/kernel/traps.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
> index af75109485c2..bf014fb59017 100644
> --- a/arch/x86/kernel/traps.c
> +++ b/arch/x86/kernel/traps.c
> @@ -401,7 +401,8 @@ DEFINE_IDTENTRY_DF(exc_double_fault)
> 
>      nmi_enter();
>      instrumentation_begin();
> -    notify_die(DIE_TRAP, str, regs, error_code, X86_TRAP_DF, SIGSEGV);
> +    if (notify_die(DIE_TRAP, str, regs, error_code, X86_TRAP_DF, SIGSEGV))
> +        return;
> 

This change is not correct, if there's a double fault then we should die even if
notify_die() fails. So the appropriate change to make Coverity happy is probably:

  (void) notify_die(DIE_TRAP, str, regs, error_code, X86_TRAP_DF, SIGSEGV);

alex.

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

* Re: [PATCH -next] arch/x86: Return value from notify_die should to be checked.
  2020-06-22  8:52 ` Alexandre Chartre
@ 2020-06-22  9:17   ` Boris Petkov
  2020-06-22  9:46     ` Peter Zijlstra
  0 siblings, 1 reply; 5+ messages in thread
From: Boris Petkov @ 2020-06-22  9:17 UTC (permalink / raw)
  To: Alexandre Chartre, Bo YU, tglx, mingo, hpa, peterz, luto, jannh,
	dave.hansen
  Cc: linux-kernel

On June 22, 2020 10:52:23 AM GMT+02:00, Alexandre Chartre <alexandre.chartre@oracle.com> wrote:
> So the appropriate change to make Coverity happy 

Or we can stop "fixing" the kernel in order to shut up tools and not do anything.


-- 
Sent from a small device: formatting sux and brevity is inevitable.

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

* Re: [PATCH -next] arch/x86: Return value from notify_die should to be checked.
  2020-06-22  9:17   ` Boris Petkov
@ 2020-06-22  9:46     ` Peter Zijlstra
  2020-06-22 11:56       ` Bo YU
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Zijlstra @ 2020-06-22  9:46 UTC (permalink / raw)
  To: Boris Petkov
  Cc: Alexandre Chartre, Bo YU, tglx, mingo, hpa, luto, jannh,
	dave.hansen, linux-kernel

On Mon, Jun 22, 2020 at 11:17:51AM +0200, Boris Petkov wrote:
> On June 22, 2020 10:52:23 AM GMT+02:00, Alexandre Chartre <alexandre.chartre@oracle.com> wrote:
> > So the appropriate change to make Coverity happy 
> 
> Or we can stop "fixing" the kernel in order to shut up tools and not do anything.

Agreed, no change required here.

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

* Re: [PATCH -next] arch/x86: Return value from notify_die should to be checked.
  2020-06-22  9:46     ` Peter Zijlstra
@ 2020-06-22 11:56       ` Bo YU
  0 siblings, 0 replies; 5+ messages in thread
From: Bo YU @ 2020-06-22 11:56 UTC (permalink / raw)
  To: Peter Zijlstra
  Cc: Boris Petkov, Alexandre Chartre, Thomas Gleixner, Ingo Molnar,
	H. Peter Anvin, Andy Lutomirski, Jann Horn, Dave Hansen,
	open list

On Mon, Jun 22, 2020 at 5:46 PM Peter Zijlstra <peterz@infradead.org> wrote:
>
> On Mon, Jun 22, 2020 at 11:17:51AM +0200, Boris Petkov wrote:
> > On June 22, 2020 10:52:23 AM GMT+02:00, Alexandre Chartre <alexandre.chartre@oracle.com> wrote:
> > > So the appropriate change to make Coverity happy
> >
> > Or we can stop "fixing" the kernel in order to shut up tools and not do anything.
>
> Agreed, no change required here.
Ok, thanks for everyone.

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

end of thread, other threads:[~2020-06-22 11:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-21 10:26 [PATCH -next] arch/x86: Return value from notify_die should to be checked Bo YU
2020-06-22  8:52 ` Alexandre Chartre
2020-06-22  9:17   ` Boris Petkov
2020-06-22  9:46     ` Peter Zijlstra
2020-06-22 11:56       ` Bo YU

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 NNTP newsgroup(s).