From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753478AbcFOQVT (ORCPT ); Wed, 15 Jun 2016 12:21:19 -0400 Received: from mx2.suse.de ([195.135.220.15]:41787 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753182AbcFOQVP (ORCPT ); Wed, 15 Jun 2016 12:21:15 -0400 Subject: Re: [PATCH] kcov: reject open when kernel not instrumented To: Mark Rutland References: <1466005756-15626-1-git-send-email-mark.rutland@arm.com> Cc: linux-kernel@vger.kernel.org, Alexander Potapenko , Andrew Morton , Dmitry Vyukov , James Morse , Kees Cook From: Michal Marek Message-ID: <5761806F.5020103@suse.com> Date: Wed, 15 Jun 2016 18:21:03 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <1466005756-15626-1-git-send-email-mark.rutland@arm.com> Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Dne 15.6.2016 v 17:49 Mark Rutland napsal(a): > If the toolchain does not support -fsanitize-coverage=trace-pc, we blat > this option from CFLAGS_KCOV, and build the kernel without > instrumentation, even if CONFIG_KCOV was selected. However, we still > build the rest of the kcov infrastructure, and expose a kcov file under > debugfs. This can be confusing, as the kernel will appear to support > kcov, yet will never manage to sample any trace PC values. While we do > note this fact at build time, this may be missed, and a user may not > have access to build logs. > > This patch adds an artificial CONFIG symbol, CONFIG_KCOV_CC, that is > only set when the toolchain supports -fsanitize-coverage=trace-pc, and > hence the kernel is built with instrumentation. When this is not the > case, the kernel will return -ENOTSUPP if userspace attempts to open the > kcov debugfs file, indicating that kcov functionality is unavailable. Hi Mark, please use a define outside the CONFIG_ namespace, because it is not a config option that one can find in .config or a Kconfig file. We already have CC_HAVE_ASM_GOTO, CC_USING_FENTRY and similar in the kernel. Thanks, Michal