From 33b3ab6631ded858f811d6f5f6d7af4ac15dbc65 Mon Sep 17 00:00:00 2001
From: Michal Marek <mmarek@suse.cz>
Date: Fri, 16 Sep 2011 11:56:20 +0200
Subject: [PATCH 3/3] kabi: Add placeholders to a couple of important
structures
Patch-mainline: Never, kabi
References: fate#312013
Add a void* suse_kabi_padding placeholder to the following structures:
struct smp_ops
struct vm_area_struct
struct mm_struct
struct zone
- adding an explicit padding here is not strictly required, but can
serve as documentation that there is some space
struct vfsmount
struct device
struct bus_type
struct class
struct device_driver
struct module
struct signal_struct
struct sched_rt_entity
struct sock
struct task_struct
The idea is that when a fix appears that requires a new member in any of
these structures, we use this padding:
#ifdef __GENKSYMS__
void *suse_kabi_padding;
#else
long foo;
#endif
And we don't have to worry about changing size of the structure, as long
as the new member is a pointer or a long.
Signed-off-by: Michal Marek <mmarek@suse.cz>
---
arch/x86/include/asm/mmu.h | 1 +
arch/x86/include/asm/smp.h | 1 +
include/linux/device.h | 1 +
include/linux/device/bus.h | 2 ++
include/linux/device/class.h | 2 ++
include/linux/device/driver.h | 2 ++
include/linux/mm_types.h | 2 ++
include/linux/mmzone.h | 1 +
include/linux/module.h | 1 +
include/linux/mount.h | 1 +
include/linux/sched.h | 3 +++
include/linux/sched/signal.h | 1 +
include/net/sock.h | 1 +
13 files changed, 19 insertions(+)
--- a/arch/x86/include/asm/mmu.h
+++ b/arch/x86/include/asm/mmu.h
@@ -55,6 +55,7 @@ typedef struct {
u16 pkey_allocation_map;
s16 execute_only_pkey;
#endif
+ void *suse_kabi_padding;
} mm_context_t;
#define INIT_MM_CONTEXT(mm) \
--- a/arch/x86/include/asm/smp.h
+++ b/arch/x86/include/asm/smp.h
@@ -56,6 +56,7 @@ struct smp_ops {
void (*send_call_func_ipi)(const struct cpumask *mask);
void (*send_call_func_single_ipi)(int cpu);
+ void *suse_kabi_padding;
};
/* Globals due to paravirt */
--- a/include/linux/device/bus.h
+++ b/include/linux/device/bus.h
@@ -112,6 +112,8 @@ struct bus_type {
struct lock_class_key lock_key;
bool need_parent_lock;
+
+ void *suse_kabi_padding;
};
extern int __must_check bus_register(struct bus_type *bus);
--- a/include/linux/device/class.h
+++ b/include/linux/device/class.h
@@ -75,6 +75,8 @@ struct class {
const struct dev_pm_ops *pm;
struct subsys_private *p;
+
+ void *suse_kabi_padding;
};
struct class_dev_iter {
--- a/include/linux/device/driver.h
+++ b/include/linux/device/driver.h
@@ -118,6 +118,8 @@ struct device_driver {
void (*coredump) (struct device *dev);
struct driver_private *p;
+
+ void *suse_kabi_padding;
};
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -575,6 +575,7 @@ struct device {
#ifdef CONFIG_DMA_OPS_BYPASS
bool dma_ops_bypass : 1;
#endif
+ void *suse_kabi_padding;
};
/**
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -386,6 +386,7 @@ struct vm_area_struct {
struct mempolicy *vm_policy; /* NUMA policy for the VMA */
#endif
struct vm_userfaultfd_ctx vm_userfaultfd_ctx;
+ void *suse_kabi_padding;
} __randomize_layout;
struct core_thread {
@@ -584,6 +585,7 @@ struct mm_struct {
#if defined(CONFIG_IOMMU_SUPPORT) || defined(CONFIG_IOMMU_SVA)
u32 pasid;
#endif
+ void *suse_kabi_padding;
} __randomize_layout;
/*
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -657,6 +657,7 @@ struct zone {
/* Zone statistics */
atomic_long_t vm_stat[NR_VM_ZONE_STAT_ITEMS];
atomic_long_t vm_numa_event[NR_VM_NUMA_EVENT_ITEMS];
+ void *suse_kabi_padding;
} ____cacheline_internodealigned_in_smp;
enum pgdat_flags {
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -533,6 +533,7 @@ struct module {
struct error_injection_entry *ei_funcs;
unsigned int num_ei_funcs;
#endif
+ void *suse_kabi_padding;
} ____cacheline_aligned __randomize_layout;
#ifndef MODULE_ARCH_INIT
#define MODULE_ARCH_INIT {}
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -73,6 +73,7 @@ struct vfsmount {
struct super_block *mnt_sb; /* pointer to superblock */
int mnt_flags;
struct user_namespace *mnt_userns;
+ void *suse_kabi_padding;
} __randomize_layout;
static inline struct user_namespace *mnt_user_ns(const struct vfsmount *mnt)
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -580,6 +580,7 @@ struct sched_rt_entity {
/* rq "owned" by this entity/group: */
struct rt_rq *my_q;
#endif
+ void *suse_kabi_padding;
} __randomize_layout;
struct sched_dl_entity {
@@ -1481,6 +1482,8 @@ struct task_struct {
struct llist_head kretprobe_instances;
#endif
+ void *suse_kabi_padding;
+
/*
* New fields for task_struct should be added above here, so that
* they are included in the randomized portion of task_struct.
--- a/include/linux/sched/signal.h
+++ b/include/linux/sched/signal.h
@@ -235,6 +235,7 @@ struct signal_struct {
* and may have inconsistent
* permissions.
*/
+ void *suse_kabi_padding;
} __randomize_layout;
/*
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -530,6 +530,7 @@ struct sock {
struct sk_buff *skb);
#endif
void (*sk_destruct)(struct sock *sk);
+ void *suse_kabi_padding;
struct sock_reuseport __rcu *sk_reuseport_cb;
#ifdef CONFIG_BPF_SYSCALL
struct bpf_local_storage __rcu *sk_bpf_storage;