Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2931672ybl; Mon, 19 Aug 2019 09:30:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqxD/OsAe+cDjVy2YjeiuE+snqE0M+IcYIzIPiNSbiuRBmnJErm7kVhbi2T2g2mFCaCgT2Nr X-Received: by 2002:a17:90a:dc82:: with SMTP id j2mr22139539pjv.89.1566232250051; Mon, 19 Aug 2019 09:30:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566232250; cv=none; d=google.com; s=arc-20160816; b=w+crrdB+dV2guaIeaOQOi7rxG03tCiRGyzhqgafMKcsKWNWrlkT+saxh6GoVae7SWL zZfcbumN8nE4L04rqABdYg/BEbzMKBVrf2EcpKQBlIg8yyHKaj60DzlYT7+8+C7iJhhy f1LvLScg9lTB7kB4RvaqvhJVGSNfVyqXlkQrcfQVCJFQIc0HoF0gzsmnhC9U9b9aU4Ds tEDSl6//YThn93OW5K2A3fL6KM77sY4aE555S3Q4fCsS1bCmept1PU5y0lM1b0XhJ++I Mu+fonwcKv0i5bwdCDruzt2FL2Iiavn1NtF+VWdOiv83mm6LPCkHbKvQeeyvLmcX7l9X b0Lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=dtollBZp7Cd+ev2dDovCVJwksY+nLROyjuudRVM9OKw=; b=GzMc4H3hW/rBPYofnkGOOumnlhhdYOVX7t0IKFv4bRn76ChGqhuiTG8pAGJzcEGxPS xQ62l3U5T2S1fxmjNkbZLVAdz7d33cwHBb1PFXYktrF2URV2EPFwvqYKkYfhoObKUVA+ odIDAq6TVGdtpIZckA8NhwVXRqNv8981jF5HORzuvHXsFQv30GefbDFQvmAH/HzG4nOi jEthntLfBsgm+6KSO25SefEKI7H/x9QPMJu9srGC2tTql1alUpt/DlSeHjjPcpDlToOJ Ru9mo+PZKH8GjsBFVubkEnLQk1WzREsoivL1NqOdN6RJUyQgvfnfC1DgkqpMsT2Z1nbs YTUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=BxmwhJll; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z27si10964029pfj.225.2019.08.19.09.30.33; Mon, 19 Aug 2019 09:30:50 -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; dkim=pass header.i=@chromium.org header.s=google header.b=BxmwhJll; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727691AbfHSQ2G (ORCPT + 99 others); Mon, 19 Aug 2019 12:28:06 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:43074 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726879AbfHSQ2G (ORCPT ); Mon, 19 Aug 2019 12:28:06 -0400 Received: by mail-pl1-f196.google.com with SMTP id 4so1200149pld.10 for ; Mon, 19 Aug 2019 09:28:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=dtollBZp7Cd+ev2dDovCVJwksY+nLROyjuudRVM9OKw=; b=BxmwhJllUMx6b1ZbOB0Bait3CD4aF8Nn7N71cUa/X450cNrv63L2ssIVE3JWtHagWE KMf79uArWdp5TpG5aurF+084leROU41Y0YRKJsgFfXB+X01NaQgX/UgLRy5iHzyIwQtl iNjLpw5NRpqOuli+PZSjJgLgxOYvTz5hhoRb4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=dtollBZp7Cd+ev2dDovCVJwksY+nLROyjuudRVM9OKw=; b=QCZt1nuUuTeguJZh9ucgtfbMPrao7OLRw93Hl+B4dz+jq7dXJxN7C+LmXHSYfkEW7F oRuGqk8fNYPEUnswa5V/biWkHLNYXKgV2pnFh8fGPbcki7VsJFK+eUpkJVlhakuSAQP5 G6eeM6/R6Qs+v+B7m4RPj+8hWHNGN4OCQjpTqw7M/bizOWxPMrP1/0z94gs7p9W8RKf4 vRK6UEYVy8/uPL7sQ7NAvZwZLoZU4MkHnKpMMD/ijNRimQmXMvDPE9F3g1Z0odlkKhNy bembBuCI4LuPi4Jn31C/CXyG1+K7DUwL9v2ByorHjAd82bozAVKjviwQp4HLgrKruVn1 kziQ== X-Gm-Message-State: APjAAAWGDAFv/xSb0+tiYGMYZBPOeKOr2KnXo6I/DoDHkiGMIbxW2MEh GyeDXYkL+K9WSK9Wz6xL1kbtuA== X-Received: by 2002:a17:902:be03:: with SMTP id r3mr23853750pls.156.1566232085869; Mon, 19 Aug 2019 09:28:05 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id x2sm16090710pja.22.2019.08.19.09.28.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 19 Aug 2019 09:28:05 -0700 (PDT) Date: Mon, 19 Aug 2019 09:28:03 -0700 From: Kees Cook To: Christophe Leroy Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , segher@kernel.crashing.org, Drew Davenport , Andrew Morton , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH 1/3] powerpc: don't use __WARN() for WARN_ON() Message-ID: <201908190917.9C65E23D6A@keescook> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 19, 2019 at 01:06:28PM +0000, Christophe Leroy wrote: > __WARN() used to just call __WARN_TAINT(TAINT_WARN) > > But a call to printk() has been added in the commit identified below > to print a "---- cut here ----" line. > > This change only applies to warnings using __WARN(), which means > WARN_ON() where the condition is constant at compile time. > For WARN_ON() with a non constant condition, the additional line is > not printed. > > In addition, adding a call to printk() forces GCC to add a stack frame > and save volatile registers. Powerpc has been using traps to implement > warnings in order to avoid that. > > So, call __WARN_TAINT(TAINT_WARN) directly instead of using __WARN() > in order to restore the previous behaviour. > > If one day powerpc wants the decorative "---- cut here ----" line, it > has to be done in the trap handler, not in the WARN_ON() macro. > > Fixes: 6b15f678fb7d ("include/asm-generic/bug.h: fix "cut here" for WARN_ON for __WARN_TAINT architectures") > Signed-off-by: Christophe Leroy Ah! Hmpf. Yeah, that wasn't an intended side-effect of this fix. It seems PPC is not alone in this situation of making this code much noisier. It looks like there needs to be a way to indicate to the trap handler that a message was delivered or not. Perhaps we can add another taint flag? -kees > --- > arch/powerpc/include/asm/bug.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/powerpc/include/asm/bug.h b/arch/powerpc/include/asm/bug.h > index fed7e6241349..3928fdaebb71 100644 > --- a/arch/powerpc/include/asm/bug.h > +++ b/arch/powerpc/include/asm/bug.h > @@ -99,7 +99,7 @@ > int __ret_warn_on = !!(x); \ > if (__builtin_constant_p(__ret_warn_on)) { \ > if (__ret_warn_on) \ > - __WARN(); \ > + __WARN_TAINT(TAINT_WARN); \ > } else { \ > __asm__ __volatile__( \ > "1: "PPC_TLNEI" %4,0\n" \ > -- > 2.13.3 > -- Kees Cook