Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2664006pxk; Sun, 6 Sep 2020 08:48:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjF3Kp3hTMqotUHBqnMUWAm92j2UAHphm9c1euu07DpJ931JPofEk0US9X6OMaXRU9nBf5 X-Received: by 2002:a17:906:4a8c:: with SMTP id x12mr17626105eju.271.1599407302062; Sun, 06 Sep 2020 08:48:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599407302; cv=none; d=google.com; s=arc-20160816; b=NNd5Nl6+SKewOcHoGVdJB9z1s7AlHLN8V72QCIlEmCGgCyAHq4ZBSd8IDDedreDeVL J1sJBSJ9J7YsYBkB03Kgu3/67yFnQ+g25g0+JKaUf4RoRs3YgWg0oo2dGxC56D293bNk 4z8vu37ny8pvKadaLBofUSflVCGlug/q/7svvjvNb/ZMtyWhy/CSiiFxyY6OPIC1BE08 QLQA4AAw7rQT+1WeqlElqa8tN3GUcETBGT18EA6ZsOyJeHd5QvIQySopvM/y+4wXb/bh tT+k0ZfZ64VzULSuPaKJJIiiIboqozS7IxIDC35ZPpxTdYuTNz2peA3KSwTJ69u27pk9 yX6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=cwfFY7TN/tKtx1/whrHCZkKmf/vlnao87UIaSBAnD6M=; b=Jqt7b9U4zht2OEaEE8K51fM3nsmfKEnrAgbIJ2YQ2jHxcSZEYZjDBhXviRZMa2UUfR vnm22eZ2A7dc/DNk7IGrmQhPTjDCDfV7k5yG553kH35AjCdyUOAeLtbx5u4GjHM2fAL8 N+R94VmUShDDpy5l+UzdbmaqGyaplC1IhvJuLUFbvIt48pwuGAOgZ9uSg5VXw/eTyXKv 09aNApzf1V03XyS7Of8tS83DnQSFSVNyXOG+j8sVOuCxROo5E0dSJpR2Rcz53FEAGyH4 6nEr8/g0QOQSc1LoJ2lOPz7TLfo1XS6GGCt5qa31sLRkLMoWl537ybVpaksNXwo9reVN eJhg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y59si8293496ede.24.2020.09.06.08.47.59; Sun, 06 Sep 2020 08:48:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729032AbgIFPqz (ORCPT + 99 others); Sun, 6 Sep 2020 11:46:55 -0400 Received: from mail-qk1-f196.google.com ([209.85.222.196]:39463 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729033AbgIFPqm (ORCPT ); Sun, 6 Sep 2020 11:46:42 -0400 Received: by mail-qk1-f196.google.com with SMTP id w12so10811132qki.6 for ; Sun, 06 Sep 2020 08:46:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=cwfFY7TN/tKtx1/whrHCZkKmf/vlnao87UIaSBAnD6M=; b=TmolK0xPkn3hcaeoeb316dlk9+meudqGXCq0J72njHZjj0nRg9T6Gc1zkwJwXObdNu FSM8mvINwsxycDURjE3/+4I+J/oq0Gb0DeJA+led8fwGje+djTkXirFMBDTe5Ei03G0x SBIR4mA2ciR7WQQBrpPRVPc6lDnpaWaWtPYsUXZk4VfKvzrgQhxb6pPk4PPyWQbYEeKT 64yjP0drYT7Jp23wE8PbWu/I+htgjdpPrjBRVj++hCpV3zTMyfdiDgxzXNwYrNM/Feyi Xg1VrYarcn4nXndKjJ0aZAWLmFn/oEzX/V1923OxoTIRzSKZV2JOF1O9hfsZ+IrCFIf0 lw3Q== X-Gm-Message-State: AOAM5309xGgObxsghtI3aFALlb8EV768crSlYeZIWc8vmBUqifPuFYpt LfUZ6Bfoaaz8NLk1E+6Qp8Q7i3Nh5AU= X-Received: by 2002:a37:e103:: with SMTP id c3mr15760313qkm.90.1599407199227; Sun, 06 Sep 2020 08:46:39 -0700 (PDT) Received: from rani.riverdale.lan ([2001:470:1f07:5f3::b55f]) by smtp.gmail.com with ESMTPSA id u55sm9774286qtu.42.2020.09.06.08.46.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Sep 2020 08:46:38 -0700 (PDT) From: Arvind Sankar To: x86@kernel.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH] x86/cmdline: Disable instrumentation of cmdline unconditionally Date: Sun, 6 Sep 2020 11:46:37 -0400 Message-Id: <20200906154637.1618112-1-nivedita@alum.mit.edu> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 32-bit, cmdline_find_option_bool() is used before paging is enabled, from check_loader_disabled_bsp() in the early microcode loader. Instrumentation options that insert accesses to global data will likely crash or corrupt memory at this point. cmdline_find_option{,_bool}() are only used during boot, so instrumentation is not that useful anyway. Disable instrumentation unconditionally, and additionally disable: - GCOV - UBSAN - tracing: change -pg -> CC_FLAGS_FTRACE - STACKLEAK_PLUGIN - BRANCH_PROFILING Signed-off-by: Arvind Sankar --- arch/x86/lib/Makefile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile index aa067859a70b..0ad4ae9def44 100644 --- a/arch/x86/lib/Makefile +++ b/arch/x86/lib/Makefile @@ -15,17 +15,19 @@ CFLAGS_REMOVE_delay.o = $(CC_FLAGS_FTRACE) endif # Early boot use of cmdline; don't instrument it -ifdef CONFIG_AMD_MEM_ENCRYPT +GCOV_PROFILE_cmdline.o := n KCOV_INSTRUMENT_cmdline.o := n KASAN_SANITIZE_cmdline.o := n +UBSAN_SANITIZE_cmdline.o := n KCSAN_SANITIZE_cmdline.o := n ifdef CONFIG_FUNCTION_TRACER -CFLAGS_REMOVE_cmdline.o = -pg +CFLAGS_REMOVE_cmdline.o = $(CC_FLAGS_FTRACE) endif CFLAGS_cmdline.o := -fno-stack-protector -fno-jump-tables -endif +CFLAGS_cmdline.o += $(DISABLE_STACKLEAK_PLUGIN) +CFLAGS_cmdline.o += -DDISABLE_BRANCH_PROFILING inat_tables_script = $(srctree)/arch/x86/tools/gen-insn-attr-x86.awk inat_tables_maps = $(srctree)/arch/x86/lib/x86-opcode-map.txt -- 2.26.2