Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2829952lqp; Mon, 25 Mar 2024 10:20:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWObaQ9sGOgJ/P+IPb6WF9hXquyoMIjDX/BBOzT5OK3EIb7U/JLR3ASc0KPWyJ2uwmQPbRJ8u7arORyvNV0rnunyTnDGp/x4wS23VlMLA== X-Google-Smtp-Source: AGHT+IHrHmZ8yu6Jcfy0jyHcDHMTVjM4UyedL4PHlsIiRxeYbUyLBIItcsSY+t52b7oW7jOKrgKg X-Received: by 2002:a17:902:b40a:b0:1e0:7f83:e99a with SMTP id x10-20020a170902b40a00b001e07f83e99amr6426972plr.49.1711387215290; Mon, 25 Mar 2024 10:20:15 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711387215; cv=pass; d=google.com; s=arc-20160816; b=Rg0AopyXC+GOTzEcnDZurxyonjUG6BQGbsceTXclpClmbBvpiG50IO4NqyOqR8Qzud vOrAtP3N5pOuCeDOWTqAdFSipiGxm/VDzJ7JTX5eLGlbKfHvrPUC2qEEqueYmVa5x+LR Gp9DXwxLDh/LPQh3UDXCUTth9oLqbEohZs0DTPaovA6zvCRHoJshkSjGl91eTpuvY72n YtqWBzLBmTU4ghnqXdA7KpBEgyhiYgUtSSYpqANoDxwEHQSkP6DHfmhBW6i5kRm3INAl tC/FUB2gpoTUAL9LMShry6kZEcn+CFcjTPCO6EMsveUFo0VqMCNsF/hCzHIDrR8lSjsC HXSQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:organization:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature; bh=MKJqFGOF0wXx9LBcPVkTeb8GzDY4kNRQ4mgI6UwwsWA=; fh=4MFyt5ztCVz18+vvPsZXX18KN+3XYxehttdwUL9PLs4=; b=wZJFLYMQ06e4GTWr35QaTas1tLcCtQsZoLydE23ST8NkRrOL3iCV+x2UkjMmQt3Sea 0UY8iTKzX50L+849g7dx6wPGY4OqcXqAUkyAdLXoS/4FjFllNqMiy6zGEGtJYzcrRKaG SwixXm+ZeZ2YS3la/f/HpGOe2InrLCV8YK5A9podm9hZMuzMVUWpl+YGYv5445dqMKpE HwliKHFSH6Ex0+fqEaOrLp38dJuo1xeF0L3dwEsMeNNtsUzPJV2HEN+K2UaVJ0oqkupL ukda8rPV0vyUgMxu3veZefFyBHIBugxB5RklTGZ2blWFZosWKkVDpTxKW5N6J8Gk5mOm RJcg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=d3qeQ5ot; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-117386-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117386-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id q12-20020a17090311cc00b001e087e6a6b4si5225784plh.465.2024.03.25.10.20.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 10:20:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-117386-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=d3qeQ5ot; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-117386-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117386-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id BEF3D29E0B2 for ; Mon, 25 Mar 2024 17:07:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1DBD8130A57; Mon, 25 Mar 2024 15:36:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="d3qeQ5ot" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 970121304AD for ; Mon, 25 Mar 2024 15:36:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.9 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711381017; cv=none; b=K744/741lbUH77LEOqEwpGjYOUxvlnCvcNQsB7u4NTz8qTcVsHrF7qOLHgnibpr98vDHr79SR+nuKWGqKEfgRMo7OUddeOloB0LTD5wGIdn0X80XRhXHeLD0ZXvjdf6nXDPBmhWFBmFNkvKQ/pl0LpSE59w2DYcc1iHq2dtr9nE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711381017; c=relaxed/simple; bh=wMsPr5Ua8rI3QCm1XRXIe808ikAt5n5DeLEZcsm/1xw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=jTKKfI8tSE1UtTnavcx33x+od+7X7RhWH5ArhDEGpdyQWWO6s1gpcewI0BV3eRziMmY2zJJJzLE2xToZlVkMkOWVxIIIKGpm9tEFmaGAKk8peponm3ixw54rvU7iE8J9bEMi93/MYkOHLNmhyIYW91Yvca4iX0y5FZ+MO8tkxV0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=d3qeQ5ot; arc=none smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711381016; x=1742917016; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=wMsPr5Ua8rI3QCm1XRXIe808ikAt5n5DeLEZcsm/1xw=; b=d3qeQ5otQonddW59pMPvmNTbyLB3gP4pu06TfJVzuKFZRH7djIo0GJYI rBJ/+on70+vtjduzL79AveoZC57Y25POFGzGcB3+B+OZikIdR9GJiMAyB /sH7AblbBKgPhcwqgRsjh8OIZRozpB+7sjed5CD1BnV7kvdUjfP7Z6cCn QiAIe9cCyf98TIWdz76LwSL05+d4vg/iSdOvAx8YyqZJAhGoextnD5jpt tP8/xB/HIX4MDOn+qpsoYGlIgcwPsae3ayy9JNasMu/6Ipn5kLUG+HU1m OPnHD2DDqx2FfU2y773ycFSFtGd4AYgxYPOj/LYGKQQuuK7Oyb9JLq6jU w==; X-IronPort-AV: E=McAfee;i="6600,9927,11023"; a="17125100" X-IronPort-AV: E=Sophos;i="6.07,153,1708416000"; d="scan'208";a="17125100" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Mar 2024 08:36:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,153,1708416000"; d="scan'208";a="15523966" Received: from idirlea-mobl.ger.corp.intel.com (HELO localhost) ([10.252.55.171]) by orviesa010-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Mar 2024 08:36:53 -0700 From: Jani Nikula To: Andrew Morton , Greg KH , linux-kernel@vger.kernel.org Cc: jani.nikula@intel.com Subject: [RFC 3/4] kernel/panic: initialize taint_flags[] using a macro Date: Mon, 25 Mar 2024 17:36:34 +0200 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Content-Transfer-Encoding: 8bit Make it easier to extend struct taint_flags in follow-up. Cc: Andrew Morton Cc: Greg KH Signed-off-by: Jani Nikula --- kernel/panic.c | 46 +++++++++++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/kernel/panic.c b/kernel/panic.c index d2d5f0a4b514..e1f87ba51ba1 100644 --- a/kernel/panic.c +++ b/kernel/panic.c @@ -473,32 +473,40 @@ void panic(const char *fmt, ...) EXPORT_SYMBOL(panic); +#define TAINT_FLAG(taint, _c_true, _c_false, _module) \ + [ TAINT_##taint ] = { \ + .c_true = _c_true, .c_false = _c_false, \ + .module = _module, \ + } + /* * TAINT_FORCED_RMMOD could be a per-module flag but the module * is being removed anyway. */ const struct taint_flag taint_flags[TAINT_FLAGS_COUNT] = { - [ TAINT_PROPRIETARY_MODULE ] = { 'P', 'G', true }, - [ TAINT_FORCED_MODULE ] = { 'F', ' ', true }, - [ TAINT_CPU_OUT_OF_SPEC ] = { 'S', ' ', false }, - [ TAINT_FORCED_RMMOD ] = { 'R', ' ', false }, - [ TAINT_MACHINE_CHECK ] = { 'M', ' ', false }, - [ TAINT_BAD_PAGE ] = { 'B', ' ', false }, - [ TAINT_USER ] = { 'U', ' ', false }, - [ TAINT_DIE ] = { 'D', ' ', false }, - [ TAINT_OVERRIDDEN_ACPI_TABLE ] = { 'A', ' ', false }, - [ TAINT_WARN ] = { 'W', ' ', false }, - [ TAINT_CRAP ] = { 'C', ' ', true }, - [ TAINT_FIRMWARE_WORKAROUND ] = { 'I', ' ', false }, - [ TAINT_OOT_MODULE ] = { 'O', ' ', true }, - [ TAINT_UNSIGNED_MODULE ] = { 'E', ' ', true }, - [ TAINT_SOFTLOCKUP ] = { 'L', ' ', false }, - [ TAINT_LIVEPATCH ] = { 'K', ' ', true }, - [ TAINT_AUX ] = { 'X', ' ', true }, - [ TAINT_RANDSTRUCT ] = { 'T', ' ', true }, - [ TAINT_TEST ] = { 'N', ' ', true }, + TAINT_FLAG(PROPRIETARY_MODULE, 'P', 'G', true), + TAINT_FLAG(FORCED_MODULE, 'F', ' ', true), + TAINT_FLAG(CPU_OUT_OF_SPEC, 'S', ' ', false), + TAINT_FLAG(FORCED_RMMOD, 'R', ' ', false), + TAINT_FLAG(MACHINE_CHECK, 'M', ' ', false), + TAINT_FLAG(BAD_PAGE, 'B', ' ', false), + TAINT_FLAG(USER, 'U', ' ', false), + TAINT_FLAG(DIE, 'D', ' ', false), + TAINT_FLAG(OVERRIDDEN_ACPI_TABLE, 'A', ' ', false), + TAINT_FLAG(WARN, 'W', ' ', false), + TAINT_FLAG(CRAP, 'C', ' ', true), + TAINT_FLAG(FIRMWARE_WORKAROUND, 'I', ' ', false), + TAINT_FLAG(OOT_MODULE, 'O', ' ', true), + TAINT_FLAG(UNSIGNED_MODULE, 'E', ' ', true), + TAINT_FLAG(SOFTLOCKUP, 'L', ' ', false), + TAINT_FLAG(LIVEPATCH, 'K', ' ', true), + TAINT_FLAG(AUX, 'X', ' ', true), + TAINT_FLAG(RANDSTRUCT, 'T', ' ', true), + TAINT_FLAG(TEST, 'N', ' ', true), }; +#undef TAINT_FLAG + static void print_tainted_seq(struct seq_buf *s) { int i; -- 2.39.2