Received: by 2002:a4a:301c:0:0:0:0:0 with SMTP id q28-v6csp812000oof; Tue, 25 Sep 2018 05:07:21 -0700 (PDT) X-Google-Smtp-Source: ACcGV629Ee23vDsBxl5pepo95wTu2wkbzRJ9zGoH7YY5hTQnDBNgngAQia56Xwcdwy3CopNprJ55 X-Received: by 2002:a17:902:2904:: with SMTP id g4-v6mr899304plb.70.1537877241773; Tue, 25 Sep 2018 05:07:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537877241; cv=none; d=google.com; s=arc-20160816; b=We0Z3UjB+sp7MRgLVGzmw0Z96KEKY3qHULSpkxh7lpGUkPKHzw4tHJdK0lH8NFygV6 rTzlaNlFQVlIDdOZGEKQ1xim9bTcMO5R19VyKEnkjMsS0MNolLesHbC0ElmZd7n1c+ca nOhFdvPRqcKM8nZQ7SEcSLrqIyoos7dUWzKaD04BAqOgkWjxKP6VCopKg9P1lVqbpsnH DnKpZd22DGjHW0BVfiAd5w1JYEy7tZlaTc/AnUpwoXVlt4mVJX9x94UXahaggMnZojHV 0XC8ygFTyso988Rs0JDtKYOLEZRWMOyh3InD9S5kf/UT8EbLqOdxD+YmV6ieb2BiRLWD JEOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=ojtbzqXI3SRj+RwYW3lH4Vt2p8Ofq7raDT8qoqyhBM4=; b=MmvlCzOrEqgTYa30WvTv91p9CwL/MS4nwrSI2krAz0/ukB6YZeKH3qPpbXmM3ALVqu VkVOY135iAJZynt9EdbXazbD/TwcjHsPd7Oflmy6MuViePSGkw2Wrk7ncGchPZtrvrz1 Nf/RWjTlHmfqwTjCT82i2kaSNOiMON0g7hHU6aYgXLCGrnJ1EHKk7w2/sjXtj1EqTKyB sFY2M7kTE4UjNGUMn2QGDdBiae1FLj3akTq/2cVvR1ClkJh0ijuN29hzjakNUBUua/eK BjF/1qKUreTu5GheECRShapyKNUpXoAn938Pph07sUj8gKbYDlJqvw7Gxk1qUnKW5VOM hfIw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h17-v6si2174428pgg.218.2018.09.25.05.07.06; Tue, 25 Sep 2018 05:07:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727823AbeIYSOK (ORCPT + 99 others); Tue, 25 Sep 2018 14:14:10 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:45453 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726926AbeIYSOJ (ORCPT ); Tue, 25 Sep 2018 14:14:09 -0400 Received: by mail-qt1-f196.google.com with SMTP id l2-v6so12976988qtr.12; Tue, 25 Sep 2018 05:06:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ojtbzqXI3SRj+RwYW3lH4Vt2p8Ofq7raDT8qoqyhBM4=; b=FjTVsqGS7MPeTCfC/iZldU8mEWBf5oifcYr0GaUe61qUFy1x7xWztZPV9PmiY2vwpb VY6C00xEcXBhAA6DPxAU+0O2JqOjZn0pqh+a6bfA+5SOGNPHw6DhRSs9ZLWh7QJR7dUH 0b49gF9mBvnYreKoIwNjOLncGFALT6C83wfx9+OcaXJTrcVjM6bFkkomL0vBD3QFJGw6 xwtmtE1NG7x5voZ1l0/FjMvBtJEMR1l/n0h63iPG++S8dqJhXx01VTGF8BOnjV1fCUJT DhF4W7nFWZFIH1LDpg+oLFKbt/nEwkVpRQXqiE21xJucj4nEh2HBMp4KaUjIrOJzdHAS NLKA== X-Gm-Message-State: ABuFfog9DJA8o/hI8CCyKlaLGg/XaCWPY7rbEZoNuuMSxTAKtcvXQZfc 0e+Zfhyj2XDeHG3nW/b9bv9bUCp2oViQhCPW2Bc= X-Received: by 2002:a0c:8834:: with SMTP id 49-v6mr504879qvl.40.1537877215131; Tue, 25 Sep 2018 05:06:55 -0700 (PDT) MIME-Version: 1.0 References: <9516e4b3-f9f2-b150-f019-8b1ef465efb3@tu-dortmund.de> In-Reply-To: <9516e4b3-f9f2-b150-f019-8b1ef465efb3@tu-dortmund.de> From: Arnd Bergmann Date: Tue, 25 Sep 2018 14:06:38 +0200 Message-ID: Subject: Re: [x86] BUG()/BUG_ON() macros cannot be disabled To: alexander.lochmann@tu-dortmund.de Cc: linux-arch , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 25, 2018 at 1:35 PM Alexander Lochmann wrote: > > Hi Arnd, > > I recently tried to disable the BUG macros on x86-32. I disabled the > config item in 'General Setup -> Configure standard kernel features > (expert users) -> BUG() support'. > However, BUG/BUG_ON is still defined. In the !CONFIG_BUG branch in > include/asm-generic/bug.h (line 181) the code checks for the existence > of architecture-specific variants of those macros. > Since x86 defines its own version of BUG(), line 182 is *not* used. > In the following, the x86 variant of BUG() is then used to define the > BUG_ON() macro. > > I propose a patch that really disables both macros if the developer > wants it. > It undefines the respective x86 variants, and defines both macros as > 'empty' macros. Maybe we should update the documentation instead. Note that the generic version is using 'while (1)' rather than 'while (0)', so this is not an empty macro but rather one that does more than the arch-specific one-instruction version does. We don't really want an empty macro any more, this was used in the past, but causes compile-time warnings and undefined behavior for no good reason. Arnd