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 pglist_data
struct vfsmount
struct module
struct signal_struct
struct sched_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 | 7 +++++++
include/linux/mm_types.h | 1 +
include/linux/mmzone.h | 1 +
include/linux/module.h | 1 +
include/linux/mount.h | 1 +
include/linux/sched.h | 2 ++
include/linux/sched/signal.h | 1 +
include/net/sock.h | 1 +
10 files changed, 17 insertions(+)
--- a/arch/x86/include/asm/mmu.h
+++ b/arch/x86/include/asm/mmu.h
@@ -54,6 +54,7 @@ typedef struct {
/* address of the bounds directory */
void __user *bd_addr;
#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
@@ -59,6 +59,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.h
+++ b/include/linux/device.h
@@ -144,6 +144,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);
@@ -301,6 +303,8 @@ struct device_driver {
void (*coredump) (struct device *dev);
struct driver_private *p;
+
+ void *suse_kabi_padding;
};
@@ -428,6 +432,8 @@ struct class {
const struct dev_pm_ops *pm;
struct subsys_private *p;
+
+ void *suse_kabi_padding;
};
struct class_dev_iter {
@@ -1074,6 +1080,7 @@ struct device {
defined(CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU_ALL)
bool dma_coherent:1;
#endif
+ void *suse_kabi_padding;
};
static inline struct device *kobj_to_dev(struct kobject *kobj)
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -348,6 +348,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 {
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -559,6 +559,7 @@ struct zone {
/* Zone statistics */
atomic_long_t vm_stat[NR_VM_ZONE_STAT_ITEMS];
atomic_long_t vm_numa_stat[NR_VM_NUMA_STAT_ITEMS];
+ void *suse_kabi_padding;
} ____cacheline_internodealigned_in_smp;
enum pgdat_flags {
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -508,6 +508,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
@@ -69,6 +69,7 @@ struct vfsmount {
struct dentry *mnt_root; /* root of the mounted tree */
struct super_block *mnt_sb; /* pointer to superblock */
int mnt_flags;
+ void *suse_kabi_padding;
} __randomize_layout;
struct file; /* forward dec */
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -507,6 +507,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 {
@@ -1273,6 +1274,7 @@ struct task_struct {
unsigned long lowest_stack;
unsigned long prev_lowest_stack;
#endif
+ void *suse_kabi_padding;
/*
* New fields for task_struct should be added above here, so that
--- a/include/linux/sched/signal.h
+++ b/include/linux/sched/signal.h
@@ -233,6 +233,7 @@ struct signal_struct {
struct mutex cred_guard_mutex; /* guard against foreign influences on
* credential calculations
* (notably. ptrace) */
+ void *suse_kabi_padding;
} __randomize_layout;
/*
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -506,6 +506,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_sk_storage __rcu *sk_bpf_storage;