Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751726AbdGZMwP (ORCPT ); Wed, 26 Jul 2017 08:52:15 -0400 Received: from mail-io0-f193.google.com ([209.85.223.193]:36228 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751543AbdGZMwO (ORCPT ); Wed, 26 Jul 2017 08:52:14 -0400 Message-ID: <1501073531.1196.7.camel@gmail.com> Subject: Re: [PATCH] fortify: Use WARN instead of BUG for now From: Daniel Micay To: Kees Cook , Andrew Morton Cc: Linus Torvalds , Dan Williams , Mika Westerberg , Al Viro , David Howells , Heikki Krogerus , Bjorn Helgaas , Arnd Bergmann , Greg Kroah-Hartman , Mauro Carvalho Chehab , linux-kernel@vger.kernel.org Date: Wed, 26 Jul 2017 08:52:11 -0400 In-Reply-To: <20170726035036.GA76341@beast> References: <20170726035036.GA76341@beast> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.24.4 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1130 Lines: 19 It should just be renamed from fortify_panic -> fortify_error, including in arch/x86/boot/compressed/misc.c and arch/x86/boot/compressed/misc.c. It can use WARN instead of BUG by with a 'default n', !COMPILE_TEST option to use BUG again. Otherwise it needs to be patched downstream when that's wanted. I don't think splitting it is the right approach to improving the runtime error handling. That only makes sense for the compile-time errors due to the limitations of __attribute__((error)). Can we think about that before changing it? Just make it use WARN for now. The best debugging experience would be passing along the sizes and having the fortify_error function convert that into nice error messages. For memcpy(p, q, n), n can be larger than both the detected sizes of p and q, not just either one. The error should just be saying the function name and printing the copy size and maximum sizes of p and q. That's going to increase the code size too but I think splitting it will be worse and it goes in the wrong direction in terms of complexity. It's going to make future extensions / optimization harder if it's split.