Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp4757697ybi; Sat, 6 Jul 2019 12:33:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqy+k8CpbYdhYmcDvtJiBNClz6G4ASF/1NpsgyZmiiOshu9soLDMyykxuQ0xy2rMOYKHAADI X-Received: by 2002:a17:90a:2768:: with SMTP id o95mr13181277pje.37.1562441597664; Sat, 06 Jul 2019 12:33:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562441597; cv=none; d=google.com; s=arc-20160816; b=xvCgRKp4mYDkzPyr0zWEKT+L48XDR2vIaQJarr+AYH4Oew0ehNYNFYruUvqLgGxVOP oWyH+7LlLPmQSPV6tB6pWzwD/lyEdLFbkE/8s9Qv5+gyn5loVu1Mt+LqpJjK3FqmLfry QijFM0i3bDK/yzIwddc+zvUUQdYY2l7KRILPVobWc22KFh17SICUBbAUv3ux3F142hsK nOF4VNyqElRzawVovWYTS3qCLd1/pk4QjGbsuuymDQ1nY3KKS2fN0iVkEnmtGtgL2BOZ rUAR5zGKuqdCfrP3EYrztoheiBRzqM5gIjXhEaJNQUN2FNMIfCzZBZja2QK4ZQzXmgIA 6n+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=VtgR6KoCFVIzroAjERAIToQxvq4K2CCA0PtAfrSHdqA=; b=qWinOZFZ7yVkbUcOSTBRUHIwfDRZJsjRq+z+ySOWPxvA2Pk1EZ4aDue2Xh6kYpp1qo iY8gEHXKt/95Fa1IgGtjhNJg80RWrz5WtbjI5TQYUGV6kgFicb/P6rZBOM/r+1OkGfxj Fx1nFdAguPXWiCGbFV13IXU6VUp6OGpnzwhI7dffqpmuOyxeA2hKUnx2VAEKrKtt+ct2 OYCl1+SCACzQl5GBlCyI/zG01yNVPTSso0J8j6b0xHNZ+3ZSgid5YQ1huvmnkD9oAwMb 8xcRRG/db93gU9RNYd/UeebnrQ8hfctdrgbFrGfNPJsVQy4e26mELwe7nKWxWe/Jopo8 mQuA== 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 64si11729434ply.15.2019.07.06.12.32.35; Sat, 06 Jul 2019 12:33:17 -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 S1727026AbfGFT27 (ORCPT + 99 others); Sat, 6 Jul 2019 15:28:59 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:59086 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726743AbfGFT26 (ORCPT ); Sat, 6 Jul 2019 15:28:58 -0400 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92 #3 (Red Hat Linux)) id 1hjqMf-0002wo-4P; Sat, 06 Jul 2019 19:28:53 +0000 Date: Sat, 6 Jul 2019 20:28:53 +0100 From: Al Viro To: Salvatore Mesoraca Cc: linux-kernel@vger.kernel.org, kernel-hardening@lists.openwall.com, linux-mm@kvack.org, linux-security-module@vger.kernel.org, Brad Spengler , Casey Schaufler , Christoph Hellwig , James Morris , Jann Horn , Kees Cook , PaX Team , "Serge E. Hallyn" , Thomas Gleixner Subject: Re: [PATCH v5 06/12] S.A.R.A.: WX protection Message-ID: <20190706192852.GO17978@ZenIV.linux.org.uk> References: <1562410493-8661-1-git-send-email-s.mesoraca16@gmail.com> <1562410493-8661-7-git-send-email-s.mesoraca16@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1562410493-8661-7-git-send-email-s.mesoraca16@gmail.com> User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jul 06, 2019 at 12:54:47PM +0200, Salvatore Mesoraca wrote: > +#define sara_warn_or_return(err, msg) do { \ > + if ((sara_wxp_flags & SARA_WXP_VERBOSE)) \ > + pr_wxp(msg); \ > + if (!(sara_wxp_flags & SARA_WXP_COMPLAIN)) \ > + return -err; \ > +} while (0) > + > +#define sara_warn_or_goto(label, msg) do { \ > + if ((sara_wxp_flags & SARA_WXP_VERBOSE)) \ > + pr_wxp(msg); \ > + if (!(sara_wxp_flags & SARA_WXP_COMPLAIN)) \ > + goto label; \ > +} while (0) No. This kind of "style" has no place in the kernel. Don't hide control flow. It's nasty enough to reviewers, but it's pure hell on anyone who strays into your code while chasing a bug or doing general code audit. In effect, you are creating your oh-so-private C dialect and assuming that everyone who ever looks at your code will start with learning that *AND* incorporating it into their mental C parser. I'm sorry, but you are not that important. If it looks like a function call, a casual reader will assume that this is exactly what it is. And when one is scanning through a function (e.g. to tell if handling of some kind of refcounts is correct, with twentieth grep through the tree having brought something in your code into the view), the last thing one wants is to switch between the area-specific C dialects. Simply because looking at yours is sandwiched between digging through some crap in drivers/target/ and that weird thing in kernel/tracing/, hopefully staying limited to 20 seconds of glancing through several functions in your code. Don't Do That. Really.