Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755971AbcJFW3K (ORCPT ); Thu, 6 Oct 2016 18:29:10 -0400 Received: from mail-oi0-f51.google.com ([209.85.218.51]:36493 "EHLO mail-oi0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752434AbcJFW3G (ORCPT ); Thu, 6 Oct 2016 18:29:06 -0400 MIME-Version: 1.0 In-Reply-To: References: <20161005054407.GC7297@1wt.eu> <20161005190604.GA8116@1wt.eu> From: Linus Torvalds Date: Thu, 6 Oct 2016 15:29:04 -0700 X-Google-Sender-Auth: jHdW49dGeJ7EJpyN7zU9ODdgD4E Message-ID: Subject: Re: BUG_ON() in workingset_node_shadows_dec() triggers To: Kees Cook Cc: Willy Tarreau , Paul Gortmaker , Johannes Weiner , Andrew Morton , Antonio SJ Musumeci , Miklos Szeredi , Linux Kernel Mailing List , stable Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1213 Lines: 26 On Thu, Oct 6, 2016 at 3:07 PM, Kees Cook wrote: > The "cleanest" way to handle it seemed to be the lock-busting logic > already built into BUG, so I moved to that. Heh. The lock-busting logic in BUG() has always been broken. It's been random hacks. It doesn't actually work in any general case, it just occasionally happens to get things right. Mostly it tries to handle the console locking (the whole "oops_in_progress" magic) so that if you have a BUG_ON() in bad areas, at least you still end up getting output. But no, it's not reliable in any way, shape or form. That's really why you want to continue after a BUG(). > By far the most problematic is "stop kernel execution from > continuing", but that's currently the behavior that BUG depends on, so > replacing BUG with anything needs to either fix the surrounding logic > to fail sanely or we have the keep the feature. Well, I'm not sure how much we actually end up depending on it, considering that we now have two examples of BUG() implementations that actually do _not_ depend on stopping execution: both the sound subsystem and the XFS version of BUG_ON() end up not actually doing the BUG() thing. Linus