hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I8Z1W8 CVE: NA
------------------------------
Add KABI_AUX_PTR extenstions to the following base structures before KABI freeze:
struct task_struct struct mm_struct struct device_driver struct class struct device struct hrtimer struct ipmi_smi_handlers struct net_device
Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/device.h | 8 ++++++++ include/linux/device/class.h | 8 ++++++++ include/linux/device/driver.h | 8 ++++++++ include/linux/hrtimer.h | 8 ++++++++ include/linux/ipmi_smi.h | 11 +++++++++++ include/linux/mm_types.h | 10 ++++++++++ include/linux/netdevice.h | 8 ++++++++ include/linux/sched.h | 9 +++++++++ 8 files changed, 70 insertions(+)
diff --git a/include/linux/device.h b/include/linux/device.h index 56d93a1ffb7b..76e53f09c934 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -602,6 +602,12 @@ struct device_physical_location { bool lid; };
+/** + * struct device_extended_resvd - KABI extension struct + */ +struct device_extended_resvd { +}; + /** * struct device - The basic device structure * @parent: The device's "parent" device, the device to which it is attached. @@ -805,6 +811,8 @@ struct device { #ifdef CONFIG_DMA_OPS_BYPASS bool dma_ops_bypass : 1; #endif + /* Use device_extended after all KABI_RESERVE fields used */ + KABI_AUX_PTR(device_extended) };
/** diff --git a/include/linux/device/class.h b/include/linux/device/class.h index abf3d3bfb6fe..f26339f701eb 100644 --- a/include/linux/device/class.h +++ b/include/linux/device/class.h @@ -22,6 +22,12 @@ struct device; struct fwnode_handle;
+/** + * struct class_extended_resvd - KABI extension struct + */ +struct class_extended_resvd { +}; + /** * struct class - device classes * @name: Name of the class. @@ -69,6 +75,8 @@ struct class { void (*get_ownership)(const struct device *dev, kuid_t *uid, kgid_t *gid);
const struct dev_pm_ops *pm; + /* Use class_extended after all KABI_RESERVE fields used */ + KABI_AUX_PTR(class_extended) };
struct class_dev_iter { diff --git a/include/linux/device/driver.h b/include/linux/device/driver.h index 7738f458995f..22dcc5f3a69c 100644 --- a/include/linux/device/driver.h +++ b/include/linux/device/driver.h @@ -48,6 +48,12 @@ enum probe_type { PROBE_FORCE_SYNCHRONOUS, };
+/** + * struct device_driver_extended_resvd - KABI extension struct + */ +struct device_driver_extended_resvd { +}; + /** * struct device_driver - The basic device driver structure * @name: Name of the device driver. @@ -119,6 +125,8 @@ struct device_driver { void (*coredump) (struct device *dev);
struct driver_private *p; + /* Use device_driver_extended after all KABI_RESERVE fields used */ + KABI_AUX_PTR(device_driver_extended) };
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index f2044d5a652b..529bc97b62f5 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h @@ -94,6 +94,12 @@ enum hrtimer_restart { #define HRTIMER_STATE_INACTIVE 0x00 #define HRTIMER_STATE_ENQUEUED 0x01
+/** + * struct hrtimer_extended_resvd - KABI extension struct + */ +struct hrtimer_extended_resvd { +}; + /** * struct hrtimer - the basic hrtimer structure * @node: timerqueue node, which also manages node.expires, @@ -124,6 +130,8 @@ struct hrtimer { u8 is_rel; u8 is_soft; u8 is_hard; + /* Use hrtimer_extended after all KABI_RESERVE fields used */ + KABI_AUX_PTR(hrtimer_extended) };
/** diff --git a/include/linux/ipmi_smi.h b/include/linux/ipmi_smi.h index 5d69820d8b02..e53b9ac17327 100644 --- a/include/linux/ipmi_smi.h +++ b/include/linux/ipmi_smi.h @@ -131,6 +131,15 @@ struct ipmi_smi_msg { .type = IPMI_SMI_MSG_TYPE_NORMAL \ }
+/** + * struct ipmi_smi_handlers_extended_resvd - KABI extension struct + * This extension must be dynamically allocated for every instance of + * ipmi_smi_handlers, because ipmi_smi_handlers is embedded in another + * struct. + */ +struct ipmi_smi_handlers_extended_resvd { +}; + struct ipmi_smi_handlers { struct module *owner;
@@ -218,6 +227,8 @@ struct ipmi_smi_handlers { * block. */ void (*set_maintenance_mode)(void *send_info, bool enable); + /* Use ipmi_smi_handlers_extended after all KABI_RESERVE fields used */ + KABI_AUX_PTR(ipmi_smi_handlers_extended) };
struct ipmi_device_id { diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 80858ee05ee4..99d0d393c7e7 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -688,6 +688,13 @@ struct mm_cid { #endif
struct kioctx_table; + +/** + * struct mm_struct_extended_resvd - KABI extension struct + */ +struct mm_struct_extended_resvd { +}; + struct mm_struct { struct { /* @@ -947,6 +954,9 @@ struct mm_struct { #endif } __randomize_layout;
+ /* Use mm_struct_extended after all KABI_RESERVE fields used */ + KABI_AUX_PTR(mm_struct_extended) + /* * The mm_cpumask needs to be at the end of mm_struct, because it * is dynamically sized based on nr_cpu_ids. diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index b8e60a20416b..ff93e61a4ef2 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -1781,6 +1781,12 @@ enum netdev_stat_type { NETDEV_PCPU_STAT_DSTATS, /* struct pcpu_dstats */ };
+/** + * struct net_device_extended_resvd - KABI extension struct + */ +struct net_device_extended_resvd { +}; + /** * struct net_device - The DEVICE structure. * @@ -2417,6 +2423,8 @@ struct net_device { struct rtnl_hw_stats64 *offload_xstats_l3;
struct devlink_port *devlink_port; + /* Use net_device_extended after all KABI_RESERVE fields used */ + KABI_AUX_PTR(net_device_extended) }; #define to_net_dev(d) container_of(d, struct net_device, dev)
diff --git a/include/linux/sched.h b/include/linux/sched.h index 4f18d4505618..598d1c907a32 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -751,6 +751,12 @@ struct kmap_ctrl { #endif };
+/** + * struct task_struct_extended_resvd - KABI extension struct + */ +struct task_struct_extended_resvd { +}; + struct task_struct { #ifdef CONFIG_THREAD_INFO_IN_TASK /* @@ -1564,6 +1570,9 @@ struct task_struct { struct sched_grid_qos *grid_qos; #endif
+ /* Use task_struct_extended after all KABI_RESERVE fields used */ + KABI_AUX_PTR(task_struct_extended) + /* * New fields for task_struct should be added above here, so that * they are included in the randomized portion of task_struct.