[OS-BUILD PATCHv3] kernel/rh_taint.c: Update to new messaging

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Prarit Bhargava <prarit@xxxxxxxxxx>

kernel/rh_taint.c: Update to new messaging

Bugzilla: https://bugzilla.redhat.com/2019377

Upstream Status: RHEL only

Red Hat requires customer-facing messages to inform users that hardware
and drivers are scheduled to be removed from support ie) disabled in the
kernel.  Hardware and drivers that are scheduled to be disabled in a
future release fall into two categories: unmaintained and deprecated.

Deprecated hardware and drivers continue to be fully maintained in the
current release, but will be disabled in a future major release.
Unmaintained hardware and drivers may receive security fixes and are also
disabled in a future major release.

The new messages have been agreed upon by the RHBU and RH Engineering.

The changes include renaming rh_taint.c to rh_message.c and adding PCI
device specific functions.

Signed-off-by: Prarit Bhargava <prarit@xxxxxxxxxx>

diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index blahblah..blahblah 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -752,7 +752,8 @@ static void rh_check_supported(void)
 		pr_crit("Detected processor %s %s\n",
 			boot_cpu_data.x86_vendor_id,
 			boot_cpu_data.x86_model_id);
-		mark_hardware_unsupported("Processor");
+		mark_hardware_unmaintained("x86 processor", "%s %s", boot_cpu_data.x86_vendor_id,
+					  boot_cpu_data.x86_model_id);
 		break;
 	}
 
diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c
index blahblah..blahblah 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_main.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_main.c
@@ -224,10 +224,7 @@ static int __init e1000_init_module(void)
 
 	pr_info("%s\n", e1000_copyright);
 
-#ifdef CONFIG_RHEL_DIFFERENCES
-	add_taint(TAINT_SUPPORT_REMOVED, LOCKDEP_STILL_OK);
-	mark_driver_unsupported(e1000_driver_name);
-#endif
+	mark_driver_unmaintained(e1000_driver_name);
 
 	ret = pci_register_driver(&e1000_driver);
 	if (copybreak != COPYBREAK_DEFAULT) {
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index blahblah..blahblah 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -3045,7 +3045,7 @@ static int __init team_module_init(void)
 	if (err)
 		goto err_nl_init;
 
-	mark_hardware_deprecated(DRV_NAME);
+	mark_driver_deprecated(DRV_NAME);
 
 	return 0;
 
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index blahblah..blahblah 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -296,33 +296,83 @@ static struct attribute *pci_drv_attrs[] = {
 };
 ATTRIBUTE_GROUPS(pci_drv);
 
+#if CONFIG_RHEL_DIFFERENCES
 /**
- * pci_hw_vendor_status - Tell if a PCI device is supported by the HW vendor
+ * pci_hw_deprecated - Tell if a PCI device is deprecated
  * @ids: array of PCI device id structures to search in
  * @dev: the PCI device structure to match against
  *
- * Used by a driver to check whether this device is in its list of unsupported
+ * Used by a driver to check whether this device is in its list of deprecated
  * devices.  Returns the matching pci_device_id structure or %NULL if there is
  * no match.
  *
  * Reserved for Internal Red Hat use only.
  */
-const struct pci_device_id *pci_hw_vendor_status(
-						const struct pci_device_id *ids,
+const struct pci_device_id *pci_hw_deprecated(const struct pci_device_id *ids,
+					      struct pci_dev *dev)
+{
+	const struct pci_device_id *ret = pci_match_id(ids, dev);
+
+	if (!ret)
+		return NULL;
+
+	mark_hardware_deprecated(dev_driver_string(&dev->dev), "%04X:%04X @ %s",
+				 dev->device, dev->vendor, pci_name(dev));
+	return ret;
+}
+EXPORT_SYMBOL(pci_hw_deprecated);
+
+/**
+ * pci_hw_unmaintained - Tell if a PCI device is unmaintained
+ * @ids: array of PCI device id structures to search in
+ * @dev: the PCI device structure to match against
+ *
+ * Used by a driver to check whether this device is in its list of unmaintained
+ * devices.  Returns the matching pci_device_id structure or %NULL if there is
+ * no match.
+ *
+ * Reserved for Internal Red Hat use only.
+ */
+const struct pci_device_id *pci_hw_unmaintained(const struct pci_device_id *ids,
 						struct pci_dev *dev)
 {
-	char devinfo[64];
 	const struct pci_device_id *ret = pci_match_id(ids, dev);
 
-	if (ret) {
-		snprintf(devinfo, sizeof(devinfo), "%s %s",
-			 dev_driver_string(&dev->dev), dev_name(&dev->dev));
-		mark_hardware_deprecated(devinfo);
-	}
+	if (!ret)
+		return NULL;
 
+	mark_hardware_unmaintained(dev_driver_string(&dev->dev), "%04X:%04X @ %s",
+				   dev->device, dev->vendor, pci_name(dev));
 	return ret;
 }
-EXPORT_SYMBOL(pci_hw_vendor_status);
+EXPORT_SYMBOL(pci_hw_unmaintained);
+
+/**
+ * pci_hw_disabled - Tell if a PCI device is disabled
+ * @ids: array of PCI device id structures to search in
+ * @dev: the PCI device structure to match against
+ *
+ * Used by a driver to check whether this device is in its list of disabled
+ * devices.  Returns the matching pci_device_id structure or %NULL if there is
+ * no match.
+ *
+ * Reserved for Internal Red Hat use only.
+ */
+const struct pci_device_id *pci_hw_disabled(const struct pci_device_id *ids,
+					    struct pci_dev *dev)
+{
+	const struct pci_device_id *ret = pci_match_id(ids, dev);
+
+	if (!ret)
+		return NULL;
+
+	mark_hardware_disabled(dev_driver_string(&dev->dev), "%04X:%04X @ %s",
+				   dev->device, dev->vendor, pci_name(dev));
+	return ret;
+}
+EXPORT_SYMBOL(pci_hw_disabled);
+
+#endif
 
 struct drv_dev_and_id {
 	struct pci_driver *drv;
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index blahblah..blahblah 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -499,17 +499,19 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
 struct module;
 
 #ifdef CONFIG_RHEL_DIFFERENCES
-void mark_hardware_unsupported(const char *msg);
-void mark_hardware_deprecated(const char *msg);
+void mark_hardware_unmaintained(const char *driver_name, char *fmt, ...);
+void mark_driver_unmaintained(const char *driver_name);
+void mark_hardware_deprecated(const char *driver_name, char *fmt, ...);
+void mark_driver_deprecated(const char *driver_name);
+void mark_hardware_disabled(const char *driver_name, char *fmt, ...);
 void mark_tech_preview(const char *msg, struct module *mod);
-void mark_driver_unsupported(const char *name);
-void mark_driver_deprecated(const char *name);
 #else
-static inline void mark_hardware_unsupported(const char *msg) { }
-static inline void mark_hardware_deprecated(const char *msg) { }
+static inline void mark_hardware_unsupported(const char *driver_name, char *fmt, ...) { }
+static inline void mark_driver_unmaintained(const char *driver_name) { }
+static inline void mark_hardware_deprecated(const char *driver_name, char *fmt, ...) { }
+static inline void mark_driver_deprecated(const char *driver_name) { }
+static inline void mark_hardware_disabled(const char *driver_name, char *fmt, ...) { }
 static inline void mark_tech_preview(const char *msg, struct module *mod) { }
-static inline void mark_driver_unsupported(const char *name) { }
-static inline void mark_driver_deprecated(const char *name) { }
 #endif
 
 #endif
diff --git a/include/linux/pci.h b/include/linux/pci.h
index blahblah..blahblah 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1478,10 +1478,22 @@ int pci_add_dynid(struct pci_driver *drv,
 		  unsigned long driver_data);
 const struct pci_device_id *pci_match_id(const struct pci_device_id *ids,
 					 struct pci_dev *dev);
-/* Reserved for Internal Red Hat use only */
-const struct pci_device_id *pci_hw_vendor_status(
-						const struct pci_device_id *ids,
+
+#ifdef CONFIG_RHEL_DIFFERENCES
+const struct pci_device_id *pci_hw_deprecated(const struct pci_device_id *ids,
+					      struct pci_dev *dev);
+const struct pci_device_id *pci_hw_unmaintained(const struct pci_device_id *ids,
 						struct pci_dev *dev);
+const struct pci_device_id *pci_hw_disabled(const struct pci_device_id *ids,
+					    struct pci_dev *dev);
+#else
+static inline const struct pci_device_id *pci_hw_deprecated(const struct pci_device_id *ids,
+							    struct pci_dev *dev) { return NULL; }
+static inline const struct pci_device_id *pci_hw_unmaintained(const struct pci_device_id *ids,
+							      struct pci_dev *dev) { return NULL; }
+const struct pci_device_id *pci_hw_disabled(const struct pci_device_id *ids,
+					    struct pci_dev *dev) {return NULL; }
+#endif
 int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
 		    int pass);
 
diff --git a/kernel/Makefile b/kernel/Makefile
index blahblah..blahblah 100644
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -12,7 +12,7 @@ obj-y     = fork.o exec_domain.o panic.o \
 	    notifier.o ksysfs.o cred.o reboot.o \
 	    async.o range.o smpboot.o ucount.o regset.o
 
-obj-$(CONFIG_RHEL_DIFFERENCES) += rh_taint.o
+obj-$(CONFIG_RHEL_DIFFERENCES) += rh_messages.o
 obj-$(CONFIG_USERMODE_DRIVER) += usermode_driver.o
 obj-$(CONFIG_MODULES) += kmod.o
 obj-$(CONFIG_MULTIUSER) += groups.o
diff --git a/kernel/rh_messages.c b/kernel/rh_messages.c
new file mode 100644
index blahblah..blahblah 100644
--- /dev/null
+++ b/kernel/rh_messages.c
@@ -0,0 +1,179 @@
+#include <linux/kernel.h>
+#include <linux/module.h>
+
+#define DEV_DESC_LEN 256
+/*
+ * The following functions are used by Red Hat to indicate to users that
+ * hardware and drivers are unsupported, or have limited support in RHEL major
+ * and minor releases.  These functions output loud warning messages to the end
+ * user and should be USED WITH CAUTION.
+ *
+ * Any use of these functions _MUST_ be documented in the RHEL Release Notes,
+ * and have approval of management.
+ *
+ * Generally, the process of disabling a driver or device in RHEL requires the
+ * driver or device to be marked as 'deprecated' in all existing releases, and
+ * then either 'unmaintained' or 'disabled' in a future release.
+ *
+ * In general, deprecated and unmaintained drivers continue to receive security
+ * related fixes until they are disabled.
+ */
+
+/**
+ * mark_hardware_unmaintained() - Mark hardware as unmaintained.
+ * @driver_name: driver name
+ * @fmt: format for device description
+ * @...: args for device description
+ *
+ * Called to notify users that the device will no longer be tested on a routine
+ * basis and driver code associated with this device is no longer being updated.
+ * Red Hat may fix security-related and critical issues.  Support for this device
+ * will be disabled in a future major release and users deploying this device
+ * should plan to replace the device in production systems.
+ *
+ * This function should be used when the driver's usage can be tied to a
+ * specific hardware device.  For example, a network device driver loading on a
+ * specific device that is no longer maintained by the manufacturer.
+ */
+void mark_hardware_unmaintained(const char *driver_name, char *fmt, ...)
+{
+	char device_description[DEV_DESC_LEN];
+	va_list args;
+
+	va_start(args, fmt);
+	vsnprintf(device_description, DEV_DESC_LEN, fmt, args);
+	pr_crit("Warning: Unmaintained hardware is detected:  %s:%s\n", driver_name,
+		device_description);
+	va_end(args);
+}
+EXPORT_SYMBOL(mark_hardware_unmaintained);
+
+/**
+ * mark_driver_unmaintained() - Mark a driver as unmaintained.
+ * @driver_name: driver name
+ *
+ * Called to notify users that a driver will no longer be tested on a routine
+ * basis and the driver code is no longer being updated.  Red Hat may fix
+ * security-related and critical issues.  Support for this driver will be
+ * disabled in a future major release, and users should replace any affected
+ * devices in production systems.
+ *
+ * This function should be used when a driver's usage cannot be tied to a
+ * specific hardware device.  For example, a network bonding driver or a higher
+ * level storage layer driver that is no longer maintained upstream.
+ */
+void mark_driver_unmaintained(const char *driver_name)
+{
+	pr_crit("Warning: Unmaintained driver is detected:  %s\n", driver_name);
+}
+EXPORT_SYMBOL(mark_driver_unmaintained);
+
+/**
+ * mark_hardware_deprecated() - Mark hardware as deprecated.
+ * @driver_name: driver name
+ * @fmt: format for device description
+ * @...: args for device description
+ *
+ * Called to notify users that support for the device is planned to be
+ * unmaintained in a future major release, and will eventually be disabled in a
+ * future major release.  This device should not be used in new production
+ * environments and users should replace the device in production systems.
+ *
+ * This function should be used when the driver's usage can be tied to a
+ * specific hardware device.  For example, a network device driver loading on a
+ * specific device that is no longer maintained by the manufacturer.
+ */
+void mark_hardware_deprecated(const char *driver_name, char *fmt, ...)
+{
+	char device_description[DEV_DESC_LEN];
+	va_list args;
+
+	va_start(args, fmt);
+	vsnprintf(device_description, DEV_DESC_LEN, fmt, args);
+	pr_crit("Warning: Deprecated Hardware is detected: %s:%s will not be maintained in a future major release and may be disabled\n",
+		driver_name, device_description);
+	va_end(args);
+}
+EXPORT_SYMBOL(mark_hardware_deprecated);
+
+/**
+ * mark_driver_deprecated() - Mark a driver as deprecated.
+ * @driver_name: driver name
+ *
+ * Called to notify users that support for this driver is planned to be
+ * unmaintained in a future major release, and will eventually be disabled in a
+ * future major release.  This driver should not be used in new production
+ * environments and users should replace any affected devices in production
+ * systems.
+ *
+ * This function should be used when a driver's usage cannot be tied to a
+ * specific hardware device.  For example, a network bonding driver or a higher
+ * level storage layer driver that is no longer maintained upstream.
+ */
+void mark_driver_deprecated(const char *driver_name)
+{
+	pr_crit("Warning: Deprecated Driver is detected: %s will not be maintained in a future major release and may be disabled\n",
+		driver_name);
+}
+EXPORT_SYMBOL(mark_driver_deprecated);
+
+/**
+ * mark_hardware_disabled() - Mark a driver as removed.
+ * @driver_name: driver name
+ * @fmt: format for device description
+ * @...: args for device description
+ *
+ * Called to notify users that a device's support has been completely disabled
+ * and no future support updates will occur.  This device cannot be used in new
+ * production environments, and users must replace the device in production
+ * systems.
+ *
+ * This function should be used when the driver's usage can be tied to a
+ * specific hardware device.  For example, a network device driver loading on a
+ * specific device that is no longer maintained by the manufacturer.
+ */
+void mark_hardware_disabled(const char *driver_name, char *fmt, ...)
+{
+	char device_description[DEV_DESC_LEN];
+	va_list args;
+
+	va_start(args, fmt);
+	vsnprintf(device_description, DEV_DESC_LEN, fmt, args);
+	pr_crit("Warning: Disabled Hardware is detected: %s:%s is no longer enabled in this release.\n",
+		driver_name, device_description);
+	va_end(args);
+}
+EXPORT_SYMBOL(mark_hardware_disabled);
+
+/**
+ * mark_tech_preview() - Mark driver or kernel subsystem as 'Tech Preview'
+ * @msg: Driver or kernel subsystem name
+ *
+ * Called to minimize the support status of a new driver.  This does TAINT the
+ * kernel.  Calling this function indicates that the driver or subsystem has
+ * had limited testing and is not marked for full support within this RHEL
+ * minor release.  The next RHEL minor release may contain full support for
+ * this driver.  Red Hat does not guarantee that bugs reported against this
+ * driver or subsystem will be resolved.
+ */
+void mark_tech_preview(const char *msg, struct module *mod)
+{
+	const char *str = NULL;
+
+	if (msg)
+		str = msg;
+#ifdef CONFIG_MODULES
+	else if (mod && mod->name)
+		str = mod->name;
+#endif
+
+	pr_warn("TECH PREVIEW: %s may not be fully supported.\n"
+		"Please review provided documentation for limitations.\n",
+		(str ? str : "kernel"));
+	add_taint(TAINT_AUX, LOCKDEP_STILL_OK);
+#ifdef CONFIG_MODULES
+	if (mod)
+		mod->taints |= (1U << TAINT_AUX);
+#endif
+}
+EXPORT_SYMBOL(mark_tech_preview);
diff --git a/kernel/rh_taint.c b/kernel/rh_taint.c
deleted file mode 100644
index blahblah..blahblah 0
--- a/kernel/rh_taint.c
+++ /dev/null
@@ -1,109 +0,0 @@
-#include <linux/kernel.h>
-#include <linux/module.h>
-
-/*
- * The following functions are used by Red Hat to indicate to users that
- * hardware and drivers are unsupported, or have limited support in RHEL major
- * and minor releases.  These functions output loud warning messages to the end
- * user and should be USED WITH CAUTION.
- *
- * Any use of these functions _MUST_ be documented in the RHEL Release Notes,
- * and have approval of management.
- */
-
-/**
- * mark_hardware_unsupported() - Mark hardware, class, or type as unsupported.
- * @msg: Hardware name, class, or type
- *
- * Called to mark a device, class of devices, or types of devices as not having
- * support in any RHEL minor release.  This does not TAINT the kernel.  Red Hat
- * will not fix bugs against this hardware in this minor release.  Red Hat may
- * declare support in a future major or minor update release.  This cannot be
- * used to mark drivers unsupported.
- */
-void mark_hardware_unsupported(const char *msg)
-{
-	/* Print one single message */
-	pr_crit("Warning: %s - this hardware has not undergone testing by Red Hat and might not be certified. Please consult https://catalog.redhat.com for certified hardware.\n", msg);
-}
-EXPORT_SYMBOL(mark_hardware_unsupported);
-
-/**
- * mark_hardware_deprecated() - Mark hardware, class, or type as deprecated.
- * @msg: Hardware name, class, or type
- *
- * Called to minimize the support status of a previously supported device in
- * a minor release.  This does not TAINT the kernel.  Marking hardware
- * deprecated is usually done in conjunction with the hardware vendor.  Future
- * RHEL major releases may not include this driver.  Driver updates and fixes
- * for this device will be limited to critical issues in future minor releases.
- */
-void mark_hardware_deprecated(const char *msg)
-{
-	pr_crit("Warning: %s - this hardware is not recommended for new deployments. It continues to be supported in this RHEL release, but it is likely to be removed in the next major release. Driver updates and fixes for this device will be limited to critical issues. Please contact Red Hat Support or your device's hardware vendor for additional information.\n", msg);
-}
-EXPORT_SYMBOL(mark_hardware_deprecated);
-
-/**
- * mark_tech_preview() - Mark driver or kernel subsystem as 'Tech Preview'
- * @msg: Driver or kernel subsystem name
- *
- * Called to minimize the support status of a new driver.  This does TAINT the
- * kernel.  Calling this function indicates that the driver or subsystem has
- * had limited testing and is not marked for full support within this RHEL
- * minor release.  The next RHEL minor release may contain full support for
- * this driver.  Red Hat does not guarantee that bugs reported against this
- * driver or subsystem will be resolved.
- */
-void mark_tech_preview(const char *msg, struct module *mod)
-{
-	const char *str = NULL;
-
-	if (msg)
-		str = msg;
-#ifdef CONFIG_MODULES
-	else if (mod && mod->name)
-		str = mod->name;
-#endif
-
-	pr_warn("TECH PREVIEW: %s may not be fully supported.\n"
-		"Please review provided documentation for limitations.\n",
-		(str ? str : "kernel"));
-	add_taint(TAINT_AUX, LOCKDEP_STILL_OK);
-#ifdef CONFIG_MODULES
-	if (mod)
-		mod->taints |= (1U << TAINT_AUX);
-#endif
-}
-EXPORT_SYMBOL(mark_tech_preview);
-
-/**
- * mark_driver_unsupported - drivers that we know we don't want to support
- * @name: the name of the driver
- *
- * In some cases Red Hat has chosen to build a driver for internal QE
- * use. Use this function to mark those drivers as unsupported for
- * customers.
- */
-void mark_driver_unsupported(const char *name)
-{
-	pr_crit("Warning: %s - This driver has not undergone sufficient testing by Red Hat for this release and therefore cannot be used in production systems.\n",
-	        name ? name : "kernel");
-}
-EXPORT_SYMBOL(mark_driver_unsupported);
-
-/**
- * mark_driver_deprecated() - Mark drivers as deprecated.
- * @name: the name of the driver
- *
- * Called to minimize the support status of a previously supported driver in
- * a minor release. This does not TAINT the kernel. Future
- * RHEL major releases may not include this driver. Driver updates and fixes
- * will be limited to critical issues in future minor releases.
- */
-void mark_driver_deprecated(const char *name)
-{
-	pr_crit("Warning: %s - this driver is not recommended for new deployments. It continues to be supported in this RHEL release, but it is likely to be removed in the next major release. Driver updates and fixes will be limited to critical issues. Please contact Red Hat Support for additional information.\n",
-	        name ? name : "kernel");
-}
-EXPORT_SYMBOL(mark_driver_deprecated);

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/1459
_______________________________________________
kernel mailing list -- kernel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to kernel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/kernel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure




[Index of Archives]     [Fedora General Discussion]     [Older Fedora Users Archive]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Announce]     [Fedora Package Review]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Coolkey]     [Yum Users]     [Tux]     [Yosemite News]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [USB]     [Asterisk PBX]

  Powered by Linux