From mboxrd@z Thu Jan 1 00:00:00 1970 From: Linus Torvalds Subject: Re: [PATCH 4/7] signal/mips: Document a conflict with SI_USER with SIGFPE Date: Mon, 7 Aug 2017 10:41:39 -0700 Message-ID: References: <87o9shg7t7.fsf_-_@xmission.com> <20170718140651.15973-4-ebiederm@xmission.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Return-path: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: "Maciej W. Rozycki" Cc: "Eric W. Biederman" , Linux Kernel Mailing List , Andy Lutomirski , Al Viro , Oleg Nesterov , Andrei Vagin , Thomas Gleixner , Greg KH , Andrey Vagin , Serge Hallyn , Pavel Emelyanov , Cyrill Gorcunov , Peter Zijlstra , Willy Tarreau , "linux-arch@vger.kernel.org" , Linux API , Linux Containers , Michael Kerrisk , Ralf Baechle List-Id: linux-arch.vger.kernel.org On Mon, Aug 7, 2017 at 9:18 AM, Maciej W. Rozycki wrote: > > So what would be the right value of `si_code' to use here for such an > unexpected exception condition? I think `BUG()' would be too big a > hammer here. Or wouldn't it? Hell no. NEVER EVER BUG(). The only case to use BUG() is if there is some core data structure (say, kernel stack) that is so corrupted that you know you cannot continue. That's the *only* valid use. If this is a "this condition cannot happen" issue, then just remove the damn conditional. It's pointless. Adding a BUG() to show "this cannot happen" is not acceptable. Linus From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi0-f42.google.com ([209.85.218.42]:35935 "EHLO mail-oi0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751857AbdHGRlk (ORCPT ); Mon, 7 Aug 2017 13:41:40 -0400 MIME-Version: 1.0 In-Reply-To: References: <87o9shg7t7.fsf_-_@xmission.com> <20170718140651.15973-4-ebiederm@xmission.com> From: Linus Torvalds Date: Mon, 7 Aug 2017 10:41:39 -0700 Message-ID: Subject: Re: [PATCH 4/7] signal/mips: Document a conflict with SI_USER with SIGFPE Content-Type: text/plain; charset="UTF-8" Sender: linux-arch-owner@vger.kernel.org List-ID: To: "Maciej W. Rozycki" Cc: "Eric W. Biederman" , Linux Kernel Mailing List , Andy Lutomirski , Al Viro , Oleg Nesterov , Andrei Vagin , Thomas Gleixner , Greg KH , Andrey Vagin , Serge Hallyn , Pavel Emelyanov , Cyrill Gorcunov , Peter Zijlstra , Willy Tarreau , "linux-arch@vger.kernel.org" , Linux API , Linux Containers , Michael Kerrisk , Ralf Baechle Message-ID: <20170807174139.nX44UkKxvnCc39n1W-ySI4Z60SBCTSTfj8aHIsz0Cx4@z> On Mon, Aug 7, 2017 at 9:18 AM, Maciej W. Rozycki wrote: > > So what would be the right value of `si_code' to use here for such an > unexpected exception condition? I think `BUG()' would be too big a > hammer here. Or wouldn't it? Hell no. NEVER EVER BUG(). The only case to use BUG() is if there is some core data structure (say, kernel stack) that is so corrupted that you know you cannot continue. That's the *only* valid use. If this is a "this condition cannot happen" issue, then just remove the damn conditional. It's pointless. Adding a BUG() to show "this cannot happen" is not acceptable. Linus