KABI: Add KABI paddings for base structures
Alexey Gladkov (1): Increase size of ucounts to atomic_long_t
Cui GaoSheng (1): kabi: reserve space for net_namespace
GONG, Ruiqi (1): kabi: reserve space for cred and user_namespace
Guan Jing (1): KABI:reserve space for sched structures
Guo Zihua (1): KABI: reserve space for IMA IPE
Gustavo A. R. Silva (1): UAPI: nfsfh.h: Replace one-element array with flexible-array member
Jialin Zhang (2): kabi: reserve space for posix clock related structure kabi: reserve space for power management related structure
Lin Ruizhe (6): bootparam: Add kabi_reserve in bootparam interrupt: Add kabi_reserve in interrupt.h irq: Add kabi_reserve in irq irq_desc: Add kabi_reserve in irq_desc irqdomain: Add kabi_reserve in irqdomain msi: Add kabi_reserve in msi.h
Lu Jialin (4): kabi: reserve space for cgroup framework related structures kabi: reserve space for memcg related structures kabi: reserve space for cpu cgroup and cpuset cgroup related structures kabi: reserve space for cgroup bpf structures
Tan Xiaojun (1): kabi: reserve space for pci subsystem related structure
Wang Hai (6): kabi: net: reserve space for net base subsystem related structure kabi: net: reserve space for net can subsystem related structure kabi: net: reserve space for net sunrpc subsystem related structure kabi: net: reserve space for net rdma subsystem related structure kabi: net: reserve space for net bpf subsystem related structure kabi: net: reserve space for net netfilter subsystem related structure
Wang ShaoBo (8): kabi: reserve space for io subsystem related structures kabi: reserve space for kobject related structures kabi: reserve space for struct module kabi: reserve space for struct ptp_clock kabi: reserve space for struct ptp_clock_info kabi: reserve space for ptp_clock.h kabi: reserve space for iommu.h kabi: reserve space for fwnode.h
Xie XiuQi (6): kabi: add kabi helper macros kabi: add KABI_SIZE_ALIGN_CHECKS for more stringent kabi checks kabi: enables more stringent kabi checks kabi: add script tools to check kabi symbol kabi: add a tool to generate the kabi reference relationship kabi: add kABI reference checking tool
Yang Jihong (1): kabi: reserve space for perf subsystem related structures
Yang Yingliang (2): kabi: reserve space for struct cpu_stop_work kabi: reserve space for struct dma_map_ops
Yongqiang Liu (1): kabi: mm: reserve space for memory subsystem related
Yu Liao (3): kabi: reserve space for struct worker kabi: reserve space for time and workqueue subsystem related structure kabi: reserve space for hrtimer related structures
Zheng Zengkai (2): KABI: add KABI padding to cpuidle structures KABI: add KABI padding to x86/paravirt ops structures
Zhihao Cheng (1): kabi: Add kabi reservation for storage module
Kconfig | 7 + arch/arm64/configs/openeuler_defconfig | 1 + arch/x86/configs/openeuler_defconfig | 1 + arch/x86/include/asm/paravirt_types.h | 9 + arch/x86/include/uapi/asm/bootparam.h | 2 + block/blk-mq-tag.h | 7 + drivers/nvme/host/nvme.h | 6 + drivers/pci/pci.h | 9 + drivers/ptp/ptp_private.h | 4 + include/linux/backing-dev-defs.h | 11 + include/linux/bio.h | 10 + include/linux/blk-cgroup.h | 11 + include/linux/blk-mq.h | 30 ++ include/linux/blk_types.h | 12 + include/linux/blkdev.h | 16 + include/linux/bpf-cgroup.h | 18 + include/linux/can/core.h | 4 + include/linux/can/dev.h | 6 + include/linux/can/rx-offload.h | 4 + include/linux/can/skb.h | 1 + include/linux/cgroup-defs.h | 29 ++ include/linux/cpuidle.h | 15 + include/linux/cred.h | 12 + include/linux/dcache.h | 9 + include/linux/delayacct.h | 4 + include/linux/device.h | 19 + include/linux/device/class.h | 7 + include/linux/device/driver.h | 6 + include/linux/dma-map-ops.h | 7 + include/linux/elevator.h | 15 + include/linux/ethtool.h | 6 + include/linux/exportfs.h | 4 + include/linux/fs.h | 48 +++ include/linux/fsnotify_backend.h | 3 + include/linux/fwnode.h | 7 + include/linux/genhd.h | 14 + include/linux/hrtimer.h | 10 + include/linux/interrupt.h | 3 + include/linux/iomap.h | 6 + include/linux/iommu.h | 12 + include/linux/ioport.h | 6 + include/linux/ipv6.h | 6 + include/linux/irq.h | 6 + include/linux/irqdesc.h | 3 +- include/linux/irqdomain.h | 2 + include/linux/jbd2.h | 6 + include/linux/kabi.h | 494 ++++++++++++++++++++++++- include/linux/kernfs.h | 9 + include/linux/kobject.h | 13 + include/linux/lsm_hooks.h | 2 + include/linux/memcontrol.h | 20 + include/linux/mm.h | 6 + include/linux/mm_types.h | 15 + include/linux/mmu_notifier.h | 9 + include/linux/mmzone.h | 9 + include/linux/module.h | 4 + include/linux/mount.h | 3 + include/linux/msi.h | 3 + include/linux/net.h | 6 + include/linux/netdevice.h | 47 +++ include/linux/netfilter.h | 9 + include/linux/netfilter/ipset/ip_set.h | 7 + include/linux/netfilter/nfnetlink.h | 5 + include/linux/netfilter_ipv6.h | 3 + include/linux/ns_common.h | 4 + include/linux/pci.h | 34 ++ include/linux/pci_hotplug.h | 18 + include/linux/perf_event.h | 8 + include/linux/pm.h | 14 + include/linux/pm_domain.h | 9 + include/linux/pm_qos.h | 7 + include/linux/pm_wakeup.h | 4 + include/linux/posix-clock.h | 17 + include/linux/ptp_clock_kernel.h | 4 + include/linux/quota.h | 7 + include/linux/sbitmap.h | 3 + include/linux/sched.h | 30 ++ include/linux/sched/signal.h | 6 + include/linux/sched/topology.h | 4 + include/linux/sched/user.h | 4 + include/linux/skbuff.h | 6 + include/linux/skmsg.h | 11 + include/linux/stop_machine.h | 2 + include/linux/sunrpc/cache.h | 4 + include/linux/sunrpc/clnt.h | 10 + include/linux/sunrpc/sched.h | 14 + include/linux/sunrpc/stats.h | 5 + include/linux/sunrpc/xprt.h | 17 + include/linux/swap.h | 4 + include/linux/sysfs.h | 3 + include/linux/timer.h | 6 + include/linux/user_namespace.h | 36 +- include/linux/workqueue.h | 11 + include/linux/writeback.h | 4 + include/linux/xattr.h | 3 + include/net/dcbnl.h | 9 + include/net/dst.h | 10 + include/net/dst_ops.h | 10 + include/net/fib_rules.h | 10 + include/net/flow.h | 10 + include/net/genetlink.h | 10 + include/net/inet_connection_sock.h | 5 + include/net/ip6_fib.h | 9 + include/net/l3mdev.h | 6 + include/net/lwtunnel.h | 7 + include/net/neighbour.h | 8 + include/net/net_namespace.h | 6 + include/net/netfilter/nf_conntrack.h | 4 + include/net/netlink.h | 5 + include/net/netns/can.h | 3 + include/net/netns/ipv4.h | 8 + include/net/netns/ipv6.h | 3 + include/net/netns/netfilter.h | 3 + include/net/netns/nftables.h | 3 + include/net/netns/xfrm.h | 3 + include/net/page_pool.h | 3 + include/net/rtnetlink.h | 10 + include/net/sch_generic.h | 7 + include/net/sock.h | 19 + include/net/switchdev.h | 6 + include/net/tcp.h | 6 + include/net/tls.h | 5 + include/net/xdp.h | 6 + include/net/xfrm.h | 6 + include/rdma/ib_addr.h | 3 + include/rdma/rdma_cm.h | 8 + include/rdma/rdma_counter.h | 3 + include/rdma/rdma_netlink.h | 4 + include/rdma/rdma_vt.h | 6 + include/rdma/rdmavt_qp.h | 5 + include/scsi/scsi_cmnd.h | 6 + include/scsi/scsi_device.h | 15 + include/scsi/scsi_host.h | 13 + include/scsi/scsi_transport_fc.h | 25 ++ include/target/target_core_base.h | 7 + include/uapi/linux/nfsd/nfsfh.h | 27 +- include/uapi/linux/ptp_clock.h | 4 + kernel/cgroup/cpuset.c | 6 + kernel/sched/sched.h | 23 ++ kernel/ucount.c | 32 +- kernel/workqueue_internal.h | 6 + scripts/check-kabi | 147 ++++++++ scripts/kabideps | 161 ++++++++ scripts/kabisyms | 141 +++++++ 144 files changed, 2220 insertions(+), 29 deletions(-) create mode 100755 scripts/check-kabi create mode 100755 scripts/kabideps create mode 100755 scripts/kabisyms
From: Xie XiuQi xiexiuqi@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4K3S5
We intruduce kabi helper macros which derived from RHEL "include/linux/rh_kabi.h", tried to standardize the kabi work on openEuler.
Signed-off-by: Xie XiuQi xiexiuqi@huawei.com Reviewed-by: Cheng Jian cj.chengjian@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/kabi.h | 494 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 484 insertions(+), 10 deletions(-)
diff --git a/include/linux/kabi.h b/include/linux/kabi.h index 10c3dcfbbe55..da5e6d71e66b 100644 --- a/include/linux/kabi.h +++ b/include/linux/kabi.h @@ -2,24 +2,498 @@ /* * kabi.h - openEuler kABI abstraction header * - * Copyright (C) 2021. Huawei Technologies Co., Ltd. All rights reserved. - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 and - * only version 2 as published by the Free Software Foundation. + * Copyright (c) 2014 Don Zickus + * Copyright (c) 2015-2018 Jiri Benc + * Copyright (c) 2015 Sabrina Dubroca, Hannes Frederic Sowa + * Copyright (c) 2016-2018 Prarit Bhargava + * Copyright (c) 2017 Paolo Abeni, Larry Woodman + * Copyright (c) 2021 Xie XiuQi xiexiuqi@huawei.com * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * This file is released under the GPLv2. + * See the file COPYING for more details. + * + * These kabi macros hide the changes from the kabi checker and from the + * process that computes the exported symbols' checksums. + * They have 2 variants: one (defined under __GENKSYMS__) used when + * generating the checksums, and the other used when building the kernel's + * binaries. + * + * The use of these macros does not guarantee that the usage and modification + * of code is correct. As with all openEuler only changes, an engineer must + * explain why the use of the macro is valid in the patch containing the + * changes. + * + * The macro helpers are derived from RHEL "include/linux/rh_kabi.h" + * Mostly debrand from RHEL. */
#ifndef _LINUX_KABI_H #define _LINUX_KABI_H
+#include <linux/compiler.h> +#include <linux/stringify.h> + +/* + * NOTE + * Unless indicated otherwise, don't use ';' after these macros as it + * messes up the kABI checker by changing what the resulting token string + * looks like. Instead let the macros add the ';' so it can be properly + * hidden from the kABI checker (mainly for KABI_EXTEND, but applied to + * most macros for uniformity). + * + * KABI_CONST + * Adds a new const modifier to a function parameter preserving the old + * checksum. + * + * KABI_ADD_MODIFIER + * Adds a new modifier to a function parameter or a typedef, preserving + * the old checksum. Useful e.g. for adding rcu annotations or changing + * int to unsigned. Beware that this may change the semantics; if you're + * sure this is safe, always explain why binary compatibility with 3rd + * party modules is retained. + * + * KABI_DEPRECATE + * Marks the element as deprecated and make it unusable by modules while + * keeping a hole in its place to preserve binary compatibility. + * + * # define KABI_BROKEN_INSERT_ENUM(_new) _new, + * # define KABI_BROKEN_REMOVE_ENUM(_orig) + * KABI_DEPRECATE_FN + * Marks the function pointer as deprecated and make it unusable by modules + * while keeping a hole in its place to preserve binary compatibility. + * + * KABI_EXTEND + * Adds a new field to a struct. This must always be added to the end of + * the struct. Before using this macro, make sure this is actually safe + * to do - there is a number of conditions under which it is *not* safe. + * In particular (but not limited to), this macro cannot be used: + * - if the struct in question is embedded in another struct, or + * - if the struct is allocated by drivers either statically or + * dynamically, or + * - if the struct is allocated together with driver data (an example of + * such behavior is struct net_device or struct request). + * + * KABI_EXTEND_WITH_SIZE + * Adds a new element (usually a struct) to a struct and reserves extra + * space for the new element. The provided 'size' is the total space to + * be added in longs (i.e. it's 8 * 'size' bytes), including the size of + * the added element. It is automatically checked that the new element + * does not overflow the reserved space, now nor in the future. However, + * no attempt is done to check the content of the added element (struct) + * for kABI conformance - kABI checking inside the added element is + * effectively switched off. + * For any struct being added by KABI_EXTEND_WITH_SIZE, it is + * recommended its content to be documented as not covered by kABI + * guarantee. + * + * KABI_FILL_HOLE + * Fills a hole in a struct. + * + * Warning: only use if a hole exists for _all_ arches. Use pahole to verify. + * + * KABI_RENAME + * Renames an element without changing its type. This macro can be used in + * bitfields, for example. + * + * NOTE: does not include the final ';' + * + * KABI_REPLACE + * Replaces the _orig field by the _new field. The size of the occupied + * space is preserved, it's fine if the _new field is smaller than the + * _orig field. If a _new field is larger or has a different alignment, + * compilation will abort. + * + * + * KABI_HIDE_INCLUDE + * Hides the given include file from kABI checksum computations. This is + * used when a newly added #include makes a previously opaque struct + * visible. + * + * Example usage: + * #include KABI_HIDE_INCLUDE(<linux/poll.h>) + * + * KABI_FAKE_INCLUDE + * Pretends inclusion of the given file for kABI checksum computations. + * This is used when upstream removed a particular #include but that made + * some structures opaque that were previously visible and is causing kABI + * checker failures. + * + * Example usage: + * #include KABI_FAKE_INCLUDE(<linux/rhashtable.h>) + * + * KABI_RESERVE + * Adds a reserved field to a struct. This is done prior to kABI freeze + * for structs that cannot be expanded later using KABI_EXTEND (for + * example because they are embedded in another struct or because they are + * allocated by drivers or because they use unusual memory layout). The + * size of the reserved field is 'unsigned long' and is assumed to be + * 8 bytes. + * + * The argument is a number unique for the given struct; usually, multiple + * KABI_RESERVE macros are added to a struct with numbers starting from + * one. + * + * Example usage: + * struct foo { + * int a; + * KABI_RESERVE(1) + * KABI_RESERVE(2) + * }; + * + * KABI_USE + * Simple wrappers to replace standard openEuler reserved elements. + * + * KABI_AUX_EMBED + * KABI_AUX_PTR + * Adds an extenstion of a struct in the form of "auxiliary structure". + * This is done prior to kABI freeze for structs that cannot be expanded + * later using KABI_EXTEND. See also KABI_RESERVED, these two + * approaches can (and often are) combined. + * + * To use this for 'struct foo' (the "base structure"), define a new + * structure called 'struct foo_rh'; this new struct is called "auxiliary + * structure". Then add KABI_AUX_EMBED or KABI_AUX_PTR to the end + * of the base structure. The argument is the name of the base structure, + * without the 'struct' keyword. + * + * KABI_AUX_PTR stores a pointer to the aux structure in the base + * struct. The lifecycle of the aux struct needs to be properly taken + * care of. + * + * KABI_AUX_EMBED embeds the aux struct into the base struct. This + * cannot be used when the base struct is itself embedded into another + * struct, allocated in an array, etc. + * + * Both approaches (ptr and embed) work correctly even when the aux struct + * is allocated by modules. To ensure this, the code responsible for + * allocation/assignment of the aux struct has to properly set the size of + * the aux struct; see the KABI_AUX_SET_SIZE and KABI_AUX_INIT_SIZE + * macros. + * + * New fields can be later added to the auxiliary structure, always to its + * end. Note the auxiliary structure cannot be shrunk in size later (i.e., + * fields cannot be removed, only deprecated). Any code accessing fields + * from the aux struct must guard the access using the KABI_AUX macro. + * The access itself is then done via a '_rh' field in the base struct. + * + * The auxiliary structure is not guaranteed for access by modules unless + * explicitly commented as such in the declaration of the aux struct + * itself or some of its elements. + * + * Example: + * + * struct foo_rh { + * int newly_added; + * }; + * + * struct foo { + * bool big_hammer; + * KABI_AUX_PTR(foo) + * }; + * + * void use(struct foo *f) + * { + * if (KABI_AUX(f, foo, newly_added)) + * f->_rh->newly_added = 123; + * else + * // the field 'newly_added' is not present in the passed + * // struct, fall back to old behavior + * f->big_hammer = true; + * } + * + * static struct foo_rh my_foo_rh { + * .newly_added = 0; + * } + * + * static struct foo my_foo = { + * .big_hammer = false, + * ._rh = &my_foo_rh, + * KABI_AUX_INIT_SIZE(foo) + * }; + * + * KABI_USE_AUX_PTR + * Creates an auxiliary structure post kABI freeze. This works by using + * two reserved fields (thus there has to be two reserved fields still + * available) and converting them to KABI_AUX_PTR. + * + * Example: + * + * struct foo_rh { + * }; + * + * struct foo { + * int a; + * KABI_RESERVE(1) + * KABI_USE_AUX_PTR(2, 3, foo) + * }; + * + * KABI_AUX_SET_SIZE + * KABI_AUX_INIT_SIZE + * Calculates and stores the size of the auxiliary structure. + * + * KABI_AUX_SET_SIZE is for dynamically allocated base structs, + * KABI_AUX_INIT_SIZE is for statically allocated case structs. + * + * These macros must be called from the allocation (KABI_AUX_SET_SIZE) + * or declaration (KABI_AUX_INIT_SIZE) site, regardless of whether + * that happens in the kernel or in a module. Without calling one of + * these macros, the aux struct will appear to have no fields to the + * kernel. + * + * Note: since KABI_AUX_SET_SIZE is intended to be invoked outside of + * a struct definition, it does not add the semicolon and must be + * terminated by semicolon by the caller. + * + * KABI_AUX + * Verifies that the given field exists in the given auxiliary structure. + * This MUST be called prior to accessing that field; failing to do that + * may lead to invalid memory access. + * + * The first argument is a pointer to the base struct, the second argument + * is the name of the base struct (without the 'struct' keyword), the + * third argument is the field name. + * + * This macro works for structs extended by either of KABI_AUX_EMBED, + * KABI_AUX_PTR and KABI_USE_AUX_PTR. + * + * KABI_FORCE_CHANGE + * Force change of the symbol checksum. The argument of the macro is a + * version for cases we need to do this more than once. + * + * This macro does the opposite: it changes the symbol checksum without + * actually changing anything about the exported symbol. It is useful for + * symbols that are not whitelisted, we're changing them in an + * incompatible way and want to prevent 3rd party modules to silently + * corrupt memory. Instead, by changing the symbol checksum, such modules + * won't be loaded by the kernel. This macro should only be used as a + * last resort when all other KABI workarounds have failed. + * + * KABI_EXCLUDE + * !!! WARNING: DANGEROUS, DO NOT USE unless you are aware of all the !!! + * !!! implications. This should be used ONLY EXCEPTIONALLY and only !!! + * !!! under specific circumstances. Very likely, this macro does not !!! + * !!! do what you expect it to do. Note that any usage of this macro !!! + * !!! MUST be paired with a KABI_FORCE_CHANGE annotation of !!! + * !!! a suitable symbol (or an equivalent safeguard) and the commit !!! + * !!! log MUST explain why the chosen solution is appropriate. !!! + * + * Exclude the element from checksum generation. Any such element is + * considered not to be part of the kABI whitelist and may be changed at + * will. Note however that it's the responsibility of the developer + * changing the element to ensure 3rd party drivers using this element + * won't panic, for example by not allowing them to be loaded. That can + * be achieved by changing another, non-whitelisted symbol they use, + * either by nature of the change or by using KABI_FORCE_CHANGE. + * + * Also note that any change to the element must preserve its size. Change + * of the size is not allowed and would constitute a silent kABI breakage. + * Beware that the KABI_EXCLUDE macro does not do any size checks. + * + * KABI_BROKEN_INSERT + * KABI_BROKEN_REMOVE + * Insert a field to the middle of a struct / delete a field from a struct. + * Note that this breaks kABI! It can be done only when it's certain that + * no 3rd party driver can validly reach into the struct. A typical + * example is a struct that is: both (a) referenced only through a long + * chain of pointers from another struct that is part of a whitelisted + * symbol and (b) kernel internal only, it should have never been visible + * to genksyms in the first place. + * + * Another example are structs that are explicitly exempt from kABI + * guarantee but we did not have enough foresight to use KABI_EXCLUDE. + * In this case, the warning for KABI_EXCLUDE applies. + * + * A detailed explanation of correctness of every KABI_BROKEN_* macro + * use is especially important. + * + * KABI_BROKEN_INSERT_BLOCK + * KABI_BROKEN_REMOVE_BLOCK + * A version of KABI_BROKEN_INSERT / REMOVE that allows multiple fields + * to be inserted or removed together. All fields need to be terminated + * by ';' inside(!) the macro parameter. The macro itself must not be + * terminated by ';'. + * + * KABI_BROKEN_REPLACE + * Replace a field by a different one without doing any checking. This + * allows replacing a field by another with a different size. Similarly + * to other KABI_BROKEN macros, use of this indicates a kABI breakage. + * + * KABI_BROKEN_INSERT_ENUM + * KABI_BROKEN_REMOVE_ENUM + * Insert a field to the middle of an enumaration type / delete a field from + * an enumaration type. Note that this can break kABI especially if the + * number of enum fields is used in an array within a structure. It can be + * done only when it is certain that no 3rd party driver will use the + * enumeration type or a structure that embeds an array with size determined + * by an enumeration type. + * + * KABI_EXTEND_ENUM + * Adds a new field to an enumeration type. This must always be added to + * the end of the enum. Before using this macro, make sure this is actually + * safe to do. + */ +#ifdef __GENKSYMS__ + +# define KABI_CONST +# define KABI_ADD_MODIFIER(_new) +# define KABI_EXTEND(_new) +# define KABI_FILL_HOLE(_new) +# define KABI_FORCE_CHANGE(ver) __attribute__((kabi_change ## ver)) +# define KABI_RENAME(_orig, _new) _orig +# define KABI_HIDE_INCLUDE(_file) <linux/kabi.h> +# define KABI_FAKE_INCLUDE(_file) _file +# define KABI_BROKEN_INSERT(_new) +# define KABI_BROKEN_REMOVE(_orig) _orig; +# define KABI_BROKEN_INSERT_BLOCK(_new) +# define KABI_BROKEN_REMOVE_BLOCK(_orig) _orig +# define KABI_BROKEN_REPLACE(_orig, _new) _orig; +# define KABI_BROKEN_INSERT_ENUM(_new) +# define KABI_BROKEN_REMOVE_ENUM(_orig) _orig, +# define KABI_EXTEND_ENUM(_new) + +# define _KABI_DEPRECATE(_type, _orig) _type _orig +# define _KABI_DEPRECATE_FN(_type, _orig, _args...) _type (*_orig)(_args) +# define _KABI_REPLACE(_orig, _new) _orig +# define _KABI_EXCLUDE(_elem) + +#else + +# define KABI_ALIGN_WARNING ". Disable CONFIG_KABI_SIZE_ALIGN_CHECKS if debugging." + +# define KABI_CONST const +# define KABI_ADD_MODIFIER(_new) _new +# define KABI_EXTEND(_new) _new; +# define KABI_FILL_HOLE(_new) _new; +# define KABI_FORCE_CHANGE(ver) +# define KABI_RENAME(_orig, _new) _new +# define KABI_HIDE_INCLUDE(_file) _file +# define KABI_FAKE_INCLUDE(_file) <linux/kabi.h> +# define KABI_BROKEN_INSERT(_new) _new; +# define KABI_BROKEN_REMOVE(_orig) +# define KABI_BROKEN_INSERT_BLOCK(_new) _new +# define KABI_BROKEN_REMOVE_BLOCK(_orig) +# define KABI_BROKEN_REPLACE(_orig, _new) _new; +# define KABI_BROKEN_INSERT_ENUM(_new) _new, +# define KABI_BROKEN_REMOVE_ENUM(_orig) +# define KABI_EXTEND_ENUM(_new) _new, + +#if IS_BUILTIN(CONFIG_KABI_SIZE_ALIGN_CHECKS) +# define __KABI_CHECK_SIZE_ALIGN(_orig, _new) \ + union { \ + _Static_assert(sizeof(struct{_new;}) <= sizeof(struct{_orig;}), \ + __FILE__ ":" __stringify(__LINE__) ": " __stringify(_new) " is larger than " __stringify(_orig) KABI_ALIGN_WARNING); \ + _Static_assert(__alignof__(struct{_new;}) <= __alignof__(struct{_orig;}), \ + __FILE__ ":" __stringify(__LINE__) ": " __stringify(_orig) " is not aligned the same as " __stringify(_new) KABI_ALIGN_WARNING); \ + } +# define __ABI_CHECK_SIZE(_item, _size) \ + _Static_assert(sizeof(struct{_item;}) <= _size, \ + __FILE__ ":" __stringify(__LINE__) ": " __stringify(_item) " is larger than the reserved size (" __stringify(_size) " bytes)" KABI_ALIGN_WARNING) +#else +# define __KABI_CHECK_SIZE_ALIGN(_orig, _new) +# define __KABI_CHECK_SIZE(_item, _size) +#endif + +# define _KABI_DEPRECATE(_type, _orig) _type kabi_reserved_##_orig +# define _KABI_DEPRECATE_FN(_type, _orig, _args...) \ + _type (* kabi_reserved_##_orig)(_args) +# define _KABI_REPLACE(_orig, _new) \ + union { \ + _new; \ + struct { \ + _orig; \ + } __UNIQUE_ID(kabi_hide); \ + __KABI_CHECK_SIZE_ALIGN(_orig, _new); \ + } + +# define _KABI_EXCLUDE(_elem) _elem + +#endif /* __GENKSYMS__ */ + +/* semicolon added wrappers for the KABI_REPLACE macros */ +# define KABI_DEPRECATE(_type, _orig) _KABI_DEPRECATE(_type, _orig); +# define KABI_DEPRECATE_FN(_type, _orig, _args...) \ + _KABI_DEPRECATE_FN(_type, _orig, _args); +# define KABI_REPLACE(_orig, _new) _KABI_REPLACE(_orig, _new); +/* + * Macro for breaking up a random element into two smaller chunks using an + * anonymous struct inside an anonymous union. + */ +# define KABI_REPLACE2(orig, _new1, _new2) KABI_REPLACE(orig, struct{ _new1; _new2;}) + /* - * Macro for Reserving KABI padding for base data structs before KABI freeze. + * We tried to standardize on openEuler reserved names. These wrappers + * leverage those common names making it easier to read and find in the + * code. */ +# define _KABI_RESERVE(n) unsigned long kabi_reserved##n +# define KABI_RESERVE(n) _KABI_RESERVE(n); +/* + * Simple wrappers to replace standard openEuler reserved elements. + */ +# define KABI_USE(n, _new) KABI_REPLACE(_KABI_RESERVE(n), _new) +/* + * Macros for breaking up a reserved element into two smaller chunks using + * an anonymous struct inside an anonymous union. + */ +# define KABI_USE2(n, _new1, _new2) KABI_REPLACE(_KABI_RESERVE(n), struct{ _new1; _new2; }) + +#define KABI_EXCLUDE(_elem) _KABI_EXCLUDE(_elem); + +#define KABI_EXTEND_WITH_SIZE(_new, _size) \ + KABI_EXTEND(union { \ + _new; \ + unsigned long KABI_UNIQUE_ID[_size]; \ + __KABI_CHECK_SIZE(_new, 8 * (_size)); \ + })
-#define KABI_RESERVE(n) unsigned long kabi_reserved##n; +#define _KABI_AUX_PTR(_struct) \ + size_t _struct##_size_rh; \ + _KABI_EXCLUDE(struct _struct##_rh *_rh) +#define KABI_AUX_PTR(_struct) \ + _KABI_AUX_PTR(_struct); + +#define _KABI_AUX_EMBED(_struct) \ + size_t _struct##_size_rh; \ + _KABI_EXCLUDE(struct _struct##_rh _rh) +#define KABI_AUX_EMBED(_struct) \ + _KABI_AUX_EMBED(_struct); + +#define KABI_USE_AUX_PTR(n1, n2, _struct) \ + KABI_USE(n1, n2, \ + struct { KABI_AUX_PTR(_struct) }) + +/* + * KABI_AUX_SET_SIZE calculates and sets the size of the extended struct and + * stores it in the size_rh field for structs that are dynamically allocated. + * This macro MUST be called when expanding a base struct with + * KABI_SIZE_AND_EXTEND, and it MUST be called from the allocation site + * regardless of being allocated in the kernel or a module. + * Note: since this macro is intended to be invoked outside of a struct, + * a semicolon is necessary at the end of the line where it is invoked. + */ +#define KABI_AUX_SET_SIZE(_name, _struct) ({ \ + (_name)->_struct##_size_rh = sizeof(struct _struct##_rh); \ +}) + +/* + * KABI_AUX_INIT_SIZE calculates and sets the size of the extended struct and + * stores it in the size_rh field for structs that are statically allocated. + * This macro MUST be called when expanding a base struct with + * KABI_SIZE_AND_EXTEND, and it MUST be called from the declaration site + * regardless of being allocated in the kernel or a module. + */ +#define KABI_AUX_INIT_SIZE(_struct) \ + ._struct##_size_rh = sizeof(struct _struct##_rh), + +/* + * KABI_AUX verifies allocated memory exists. This MUST be called to + * verify that memory in the _rh struct is valid, and can be called + * regardless if KABI_SIZE_AND_EXTEND or KABI_SIZE_AND_EXTEND_PTR is + * used. + */ +#define KABI_AUX(_ptr, _struct, _field) ({ \ + size_t __off = offsetof(struct _struct##_rh, _field); \ + (_ptr)->_struct##_size_rh > __off ? true : false; \ +})
#endif /* _LINUX_KABI_H */
From: Xie XiuQi xiexiuqi@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4K3S5
This option enables more stringent kabi checks. Those must be disable in case of a debug-build because they allow to change struct sizes.
Signed-off-by: Xie XiuQi xiexiuqi@huawei.com Reviewed-by: Cheng Jian cj.chengjian@huawei.com Reviewed-by: Cheng Jian cj.chengjian@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- Kconfig | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/Kconfig b/Kconfig index 745bc773f567..bb409bb587b0 100644 --- a/Kconfig +++ b/Kconfig @@ -30,3 +30,10 @@ source "lib/Kconfig" source "lib/Kconfig.debug"
source "Documentation/Kconfig" + +config KABI_SIZE_ALIGN_CHECKS + bool "Enables more stringent kabi checks in the macros" + default y + help + This option enables more stringent kabi checks. Those must be disable + in case of a debug-build because they allow to change struct sizes.
From: Xie XiuQi xiexiuqi@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4K3S5
This option enables more stringent kabi checks. Those must be disable in case of a debug-build because they allow to change struct sizes.
We enable this option by default.
Signed-off-by: Xie XiuQi xiexiuqi@huawei.com Reviewed-by: Cheng Jian cj.chengjian@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- arch/arm64/configs/openeuler_defconfig | 1 + arch/x86/configs/openeuler_defconfig | 1 + 2 files changed, 2 insertions(+)
diff --git a/arch/arm64/configs/openeuler_defconfig b/arch/arm64/configs/openeuler_defconfig index 63436eaa1ada..dd1bcf03e61a 100644 --- a/arch/arm64/configs/openeuler_defconfig +++ b/arch/arm64/configs/openeuler_defconfig @@ -7151,3 +7151,4 @@ CONFIG_SPFC=m CONFIG_GPIO_HISI=y CONFIG_OSNOISE_TRACER=y CONFIG_TIMERLAT_TRACER=y +CONFIG_KABI_SIZE_ALIGN_CHECKS=y diff --git a/arch/x86/configs/openeuler_defconfig b/arch/x86/configs/openeuler_defconfig index e0dc1686984d..5d403124e49b 100644 --- a/arch/x86/configs/openeuler_defconfig +++ b/arch/x86/configs/openeuler_defconfig @@ -8529,3 +8529,4 @@ CONFIG_USERSWAP=y CONFIG_NET_VENDOR_RAMAXEL=y CONFIG_SPNIC=m CONFIG_SPFC=m +CONFIG_KABI_SIZE_ALIGN_CHECKS=y
From: Xie XiuQi xiexiuqi@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4JZ0H?from=project-issue CVE: NA
Add a tool to generate the kabi reference relationship for given module list.
1) ./scripts/kabisyms -k <symlist> -s <symvers> -o <output>
Generate Module.kabi file via symbol list.
2) ./scripts/kabisyms -k <symlist> -d <kabideps> -o <output>
memset: 3: nvme-core.ko nvme-fc.ko nvme.ko nvmet.ko complete: 4: nvme-rdma.ko nvme-fc.ko nvme.ko nvme-fcloop.ko mutex_unlock: 3: nvme-rdma.ko nvme-core.ko nvme.ko init_timer_key: 3: nvme-rdma.ko nvme-core.ko nvme-fc.ko nvmet.ko mutex_lock: 2: nvme-rdma.ko nvme-core.ko
Signed-off-by: Xie XiuQi xiexiuqi@huawei.com Reviewed-by: Tan Xiaojun tanxiaojun@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com Signed-off-by: Jialin Zhang zhangjialin11@huawei.com Reviewed-by: Cheng Jian cj.chengjian@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- scripts/kabisyms | 141 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100755 scripts/kabisyms
diff --git a/scripts/kabisyms b/scripts/kabisyms new file mode 100755 index 000000000000..dcba08e64a26 --- /dev/null +++ b/scripts/kabisyms @@ -0,0 +1,141 @@ +#!/usr/bin/perl -w +# SPDX-License-Identifier: GPL-2.0 +# +# kabisyms - a script tools to generate kabi baseline and check symbol +# referance relationship. +# +# Author: Xie XiuQi xiexiuqi@huawei.com +# Copyright (C) 2019 Huawei, Inc. +# +# This software may be freely redistributed under the terms of the GNU +# General Public License (GPL). +# +# usage: +# ./scripts/kabisyms -k <symlist> -s <symvers> -o <output> +# ./scripts/kabisyms -k <symlist> -d <kabideps> -o <output> + +use 5.010; + +use strict; +use Getopt::Long; +use File::Basename; + +my $SYMLIST; +my $SYMVERS; +my $KABIDEPS; +my $OUTPUT = "Module.kabi"; +my $VERBOSE; + +my $PROG = basename $0; + +sub usage { + say "usage:"; + say " $PROG [--symlist|k] [--symvers|s] [--kabideps|d] [--output|o] [--verbose|v] [--help|h|?]"; + say " -k|--symlist"; + say " symbol list (filename)"; + say " -s|--symvers"; + say " Module.symvers"; + say " -d|--kabideps"; + say " kabideps"; + say " -o|--output"; + say " filename of output"; + say " -v|--verbose:"; + say " show more info"; + say " -h|-?|--help:"; + say " show this usage"; + say " examples:"; + say " ./scripts/kabisyms -k <symlist> -s <symvers> -o <output>"; + say " ./scripts/kabisyms -k <symlist> -d <kabideps> -o <output>"; + exit 0; +} + +usage() unless (@ARGV); +my $result = GetOptions( + 'symlist|k=s' => $SYMLIST, + 'symvers|s=s' => $SYMVERS, + 'kabideps|d=s' => $KABIDEPS, + 'output|o=s' => $OUTPUT, + 'verbose|v!' => $VERBOSE, + 'help|h|?' => &usage, +) or usage(); + +my @syms; +my @symvers; +my @kabideps; + +if ($SYMLIST) { + @syms = `cat $SYMLIST`; chomp @syms; +} +else { + usage(); +} + +if ($SYMVERS) { + @symvers = `cat $SYMVERS`; chomp @symvers; +} +elsif ($KABIDEPS) { + @kabideps = `cat $KABIDEPS`; chomp @kabideps; +} +else { + usage(); +} + +sub check_sym { + my $sym = shift; + my @res; + my $found; + + foreach (@symvers) { + if (/^\s*$/) { + next; + } + + if (/^0x[0-9a-fA-F]+\s+$sym\s+/) { + printf OUT "%s\n", $_; + $found = 1; + last; + } + } + + printf "%s is not included in %s\n", $sym, $SYMVERS if (!$found); +} + +sub check_deps { + my $sym = shift; + my @res; + my $found; + + foreach (@kabideps) { + if (/^\s*$/) { + next; + } + + if (/^\s*$sym:/) { + printf OUT "%s\n", $_; + $found = 1; + last; + } + } + + printf "%s is not included in %s\n", $sym, $KABIDEPS if (!$found); +} + +my $output = $OUTPUT; + +open(OUT, ">", "$output") + || die "can't open >$output : $!"; + +my $total = @syms; +my $count; +for (@syms) { + if ($SYMVERS) { + check_sym($_); + } + elsif ($KABIDEPS) { + check_deps($_); + } + printf "\r%d/%d", ++$count, $total if ($VERBOSE); +} +printf "output to %s\n", $OUTPUT; + +close OUT;
From: Xie XiuQi xiexiuqi@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4JZ0H?from=project-issue CVE: NA
Add a tool to generate the kabi reference relationship for given module list.
Like this:
memset: 3: nvme-core.ko nvme-fc.ko nvme.ko nvmet.ko complete: 4: nvme-rdma.ko nvme-fc.ko nvme.ko nvme-fcloop.ko mutex_unlock: 3: nvme-rdma.ko nvme-core.ko nvme.ko init_timer_key: 3: nvme-rdma.ko nvme-core.ko nvme-fc.ko nvmet.ko mutex_lock: 2: nvme-rdma.ko nvme-core.ko
usage: ./scripts/kabideps -m <mod list> -s <symvers> -d <dir of modules> -e
Signed-off-by: Xie XiuQi xiexiuqi@huawei.com Reviewed-by: Hanjun Guo guohanjun@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com Signed-off-by: Jialin Zhang zhangjialin11@huawei.com Reviewed-by: Cheng Jian cj.chengjian@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- scripts/kabideps | 161 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100755 scripts/kabideps
diff --git a/scripts/kabideps b/scripts/kabideps new file mode 100755 index 000000000000..210b79e761eb --- /dev/null +++ b/scripts/kabideps @@ -0,0 +1,161 @@ +#!/usr/bin/perl -w +# SPDX-License-Identifier: GPL-2.0 +# +# kabideps - a script tools to generate symbol referenced by other modules +# +# We use this script to check against reference Module.kabi files. +# +# Author: Xie XiuQi xiexiuqi@huawei.com +# Copyright (C) 2019 Huawei, Inc. +# +# This software may be freely redistributed under the terms of the GNU +# General Public License (GPL). +# +# usage: +# ./scripts/kabideps -m <module list> -s <symvers> -d <basedir of modules> -e + +use 5.010; + +use strict; +use Getopt::Long; +use File::Basename; + +my $MODULES; +my $SYMVERS; +my $EXCLUDE; +my $BASEDIR; +my $VERBOSE; + +my $PROG = basename $0; + +sub usage { + say "usage:"; + say " $PROG [--modules|m] [--symvers|s] [--basedir|d] [--exclude|e] [--verbose|v] [--help|h|?]"; + say " -m|--module"; + say " module list to be check (filename)"; + say " -d|--basedir"; + say " dir of ko"; + say " -s|--symvers"; + say " Module.symvers"; + say " -e|--exclude"; + say " exclude symbols which exported by the modules themselves"; + say " -v|--verbose:"; + say " show more info"; + say " -h|-?|--help:"; + say " show this usage"; + exit 0; +} + +usage() unless (@ARGV); +my $result = GetOptions( + 'module|m=s' => $MODULES, + 'basedir|d=s' => $BASEDIR, + 'symvers|s=s' => $SYMVERS, + 'exclude|e!' => $EXCLUDE, + 'verbose|v!' => $VERBOSE, + 'help|h|?' => &usage, +) or usage(); + +my @mods; + +if ($MODULES) { + @mods = `cat $MODULES`; chomp @mods; +} +else { + @mods = `find $BASEDIR |grep -E ".ko$"`; chomp @mods; +} + +my @allsyms = exclude_check(); +my $allmodsyms = {}; + +sub check_sym { + my $sym = shift; + my @res; + + foreach my $m (@mods) { + my @kmodsyms; + my $modname = basename $m; + + if ($m =~ /^\s*$/) { + next; + } + + if (!$allmodsyms->{$m}) { + @kmodsyms = `modprobe --dump-modversions $m |awk '{print $2}'`; chomp @kmodsyms; + $allmodsyms->{$m} = @kmodsyms; + } + + my $syms = $allmodsyms->{$m}; + for (@{$syms}) { + if ($sym eq $_) { + push @res, $modname; + } + } + } + + my $num = @res; + printf OUT "%d: ", $num; + for (@res) { + printf OUT "%s ", $_; + } +} + +sub exclude_check { + my @syms; + my @res; + my $i; + + if ($EXCLUDE) { + @syms = `cat $SYMVERS`; chomp @syms; + } + else { + @res = `cat $SYMVERS |awk '{print $2}'`; chomp @syms; + + return @res; + } + + my $total = @syms; + my $count; + say "excluding symbols exported by modules themselves..."; + for ($i = 0; $i < @syms; $i++) { + my @words = split(/\s+/, $syms[$i]); + my $found = 0; + + foreach my $mod (@mods) { + my $m; + + $words[2] = basename $words[2]; + $m = basename $mod; + $m =~ s/.ko$//g; + + if ($words[2] eq $m) { + $found = 1; + last; + } + } + push @res, $words[1] unless($found); + + printf "\r%d/%d", $count++, $total; + } + print "\n"; + + return @res; +} + +my $output = "kabideps.txt"; + +open(OUT, ">", "$output") + || die "can't open >$output : $!"; + +my $total = @allsyms; +my $count; +say "checking symbols ..."; +for (@allsyms) { + printf OUT "%s: ", $_; + check_sym($_); + print OUT "\n"; + + printf "\r%d/%d", $count++, $total; +} + +close OUT;
From: Xie XiuQi xiexiuqi@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4JZ0H?from=project-issue CVE: NA
Add check-kabi tool to detect the kabi changes introduced by the patch.
Usage: ./scripts/check-kabi -k Module.symvers.baseline -s Module.symvers
This tool is ported from CentOS 7.x source packages.
Signed-off-by: Xie XiuQi xiexiuqi@huawei.com Reviewed-by: Li Bin huawei.libin@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com Signed-off-by: Jialin Zhang zhangjialin11@huawei.com Reviewed-by: Cheng Jian cj.chengjian@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- scripts/check-kabi | 147 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 147 insertions(+) create mode 100755 scripts/check-kabi
diff --git a/scripts/check-kabi b/scripts/check-kabi new file mode 100755 index 000000000000..e3ec97cebffa --- /dev/null +++ b/scripts/check-kabi @@ -0,0 +1,147 @@ +#!/usr/bin/python +# SPDX-License-Identifier: GPL-2.0 +# +# check-kabi - Red Hat kABI reference checking tool +# +# We use this script to check against reference Module.kabi files. +# +# Author: Jon Masters jcm@redhat.com +# Copyright (C) 2007-2009 Red Hat, Inc. +# +# This software may be freely redistributed under the terms of the GNU +# General Public License (GPL). + +# Changelog: +# +# 2009/08/15 - Updated for use in RHEL6. +# 2007/06/13 - Initial rewrite in python by Jon Masters. + +__author__ = "Jon Masters jcm@redhat.com" +__version__ = "2.0" +__date__ = "2009/08/15" +__copyright__ = "Copyright (C) 2007-2009 Red Hat, Inc" +__license__ = "GPL" + +import getopt +import os +import re +import string +import sys + +true = 1 +false = 0 + +def load_symvers(symvers,filename): + """Load a Module.symvers file.""" + + symvers_file = open(filename,"r") + + while true: + in_line = symvers_file.readline() + if in_line == "": + break + if in_line == "\n": + continue + checksum,symbol,directory,type = string.split(in_line) + + symvers[symbol] = in_line[0:-1] + +def load_kabi(kabi,filename): + """Load a Module.kabi file.""" + + kabi_file = open(filename,"r") + + while true: + in_line = kabi_file.readline() + if in_line == "": + break + if in_line == "\n": + continue + checksum,symbol,directory,type = string.split(in_line) + + kabi[symbol] = in_line[0:-1] + +def check_kabi(symvers,kabi): + """Check Module.kabi and Module.symvers files.""" + + fail=0 + warn=0 + changed_symbols=[] + moved_symbols=[] + + for symbol in kabi: + abi_hash,abi_sym,abi_dir,abi_type = string.split(kabi[symbol]) + if symvers.has_key(symbol): + sym_hash,sym_sym,sym_dir,sym_type = string.split(symvers[symbol]) + if abi_hash != sym_hash: + fail=1 + changed_symbols.append(symbol) + + if abi_dir != sym_dir: + warn=1 + moved_symbols.append(symbol) + else: + fail=1 + changed_symbols.append(symbol) + + if fail: + print "*** ERROR - ABI BREAKAGE WAS DETECTED ***" + print "" + print "The following symbols have been changed (this will cause an ABI breakage):" + print "" + for symbol in changed_symbols: + print symbol + print "" + + if warn: + print "*** WARNING - ABI SYMBOLS MOVED ***" + print "" + print "The following symbols moved (typically caused by moving a symbol from being" + print "provided by the kernel vmlinux out to a loadable module):" + print "" + for symbol in moved_symbols: + print symbol + print "" + + """Halt the build, if we got errors and/or warnings. In either case, + double-checkig is required to avoid introducing / concealing + KABI inconsistencies.""" + if fail or warn: + sys.exit(1) + sys.exit(0) + +def usage(): + print """ +check-kabi: check Module.kabi and Module.symvers files. + + check-kabi [ -k Module.kabi ] [ -s Module.symvers ] + +""" + +if __name__ == "__main__": + + symvers_file = "" + kabi_file = "" + + opts, args = getopt.getopt(sys.argv[1:], 'hk:s:') + + for o, v in opts: + if o == "-s": + symvers_file = v + if o == "-h": + usage() + sys.exit(0) + if o == "-k": + kabi_file = v + + if (symvers_file == "") or (kabi_file == ""): + usage() + sys.exit(1) + + symvers={} + kabi={} + + load_symvers(symvers,symvers_file) + load_kabi(kabi,kabi_file) + check_kabi(symvers,kabi) +
From: Jialin Zhang zhangjialin11@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4JBL0 CVE: NA
-------------------------------
Reserve space for posix clock related structure.
Signed-off-by: Jialin Zhang zhangjialin11@huawei.com Reviewed-by: Wei Li liwei391@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/posix-clock.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
diff --git a/include/linux/posix-clock.h b/include/linux/posix-clock.h index 468328b1e1dd..f7518831f5dc 100644 --- a/include/linux/posix-clock.h +++ b/include/linux/posix-clock.h @@ -12,6 +12,7 @@ #include <linux/poll.h> #include <linux/posix-timers.h> #include <linux/rwsem.h> +#include <linux/kabi.h>
struct posix_clock;
@@ -62,6 +63,13 @@ struct posix_clock_operations {
ssize_t (*read) (struct posix_clock *pc, uint flags, char __user *buf, size_t cnt); + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) };
/** @@ -88,6 +96,15 @@ struct posix_clock { struct device *dev; struct rw_semaphore rwsem; bool zombie; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) + KABI_RESERVE(7) + KABI_RESERVE(8) };
/**
From: Tan Xiaojun tanxiaojun@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4JBL0 CVE: NA
-------------------------------
Reserve space for the structure in pci subsystem.
Signed-off-by: Tan Xiaojun tanxiaojun@huawei.com Reviewed-by: Xie XiuQi xiexiuqi@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com Signed-off-by: Jialin Zhang zhangjialin11@huawei.com Reviewed-by: wangxiongfeng 00379786 wangxiongfeng2@huawei.com Reviewed-by: Yang Yingliang yangyingliang@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- drivers/pci/pci.h | 9 +++++++++ include/linux/pci.h | 34 ++++++++++++++++++++++++++++++++++ include/linux/pci_hotplug.h | 18 ++++++++++++++++++ 3 files changed, 61 insertions(+)
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h index a96dc6f53076..9a4e34814005 100644 --- a/drivers/pci/pci.h +++ b/drivers/pci/pci.h @@ -343,6 +343,15 @@ struct pci_sriov { u16 subsystem_device; /* VF subsystem device */ resource_size_t barsz[PCI_SRIOV_NUM_BARS]; /* VF BAR size */ bool drivers_autoprobe; /* Auto probing of VFs by driver */ + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) + KABI_RESERVE(7) + KABI_RESERVE(8) };
/** diff --git a/include/linux/pci.h b/include/linux/pci.h index 7d4e52256e3a..ff6236a3dd6b 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -26,6 +26,7 @@
#include <linux/mod_devicetable.h>
+#include <linux/kabi.h> #include <linux/types.h> #include <linux/init.h> #include <linux/ioport.h> @@ -509,6 +510,22 @@ struct pci_dev { */ unsigned long slot_being_removed_rescanned; struct pci_dev *rpdev; /* root port pci_dev */ + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) + KABI_RESERVE(7) + KABI_RESERVE(8) + KABI_RESERVE(9) + KABI_RESERVE(10) + KABI_RESERVE(11) + KABI_RESERVE(12) + KABI_RESERVE(13) + KABI_RESERVE(14) + KABI_RESERVE(15) };
static inline struct pci_dev *pci_physfn(struct pci_dev *dev) @@ -646,6 +663,14 @@ struct pci_bus { struct bin_attribute *legacy_io; /* Legacy I/O for this bus */ struct bin_attribute *legacy_mem; /* Legacy mem */ unsigned int is_added:1; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) + KABI_RESERVE(7) };
#define to_pci_bus(n) container_of(n, struct pci_bus, dev) @@ -879,6 +904,15 @@ struct pci_driver { const struct attribute_group **groups; struct device_driver driver; struct pci_dynids dynids; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) + KABI_RESERVE(7) + KABI_RESERVE(8) };
#define to_pci_driver(drv) container_of(drv, struct pci_driver, driver) diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h index b482e42d7153..4eec239ff689 100644 --- a/include/linux/pci_hotplug.h +++ b/include/linux/pci_hotplug.h @@ -45,6 +45,15 @@ struct hotplug_slot_ops { int (*get_latch_status) (struct hotplug_slot *slot, u8 *value); int (*get_adapter_status) (struct hotplug_slot *slot, u8 *value); int (*reset_slot) (struct hotplug_slot *slot, int probe); + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) + KABI_RESERVE(7) + KABI_RESERVE(8) };
/** @@ -61,6 +70,15 @@ struct hotplug_slot { struct pci_slot *pci_slot; struct module *owner; const char *mod_name; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) + KABI_RESERVE(7) + KABI_RESERVE(8) };
static inline const char *hotplug_slot_name(const struct hotplug_slot *slot)
From: Jialin Zhang zhangjialin11@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4JBL0 CVE: NA
-------------------------------
Reserve space for power management related structure.
Signed-off-by: Jialin Zhang zhangjialin11@huawei.com Reviewed-by: Wei Li liwei391@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/pm.h | 14 ++++++++++++++ include/linux/pm_domain.h | 9 +++++++++ include/linux/pm_qos.h | 7 +++++++ include/linux/pm_wakeup.h | 4 ++++ 4 files changed, 34 insertions(+)
diff --git a/include/linux/pm.h b/include/linux/pm.h index 52d9724db9dc..265175a5dc60 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h @@ -15,6 +15,7 @@ #include <linux/timer.h> #include <linux/hrtimer.h> #include <linux/completion.h> +#include <linux/kabi.h>
/* * Callbacks for platform drivers to implement. @@ -542,6 +543,13 @@ struct pm_subsys_data { #ifdef CONFIG_PM_GENERIC_DOMAINS struct pm_domain_data *domain_data; #endif + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) };
/* @@ -621,6 +629,9 @@ struct dev_pm_info { struct pm_subsys_data *subsys_data; /* Owned by the subsystem. */ void (*set_latency_tolerance)(struct device *, s32); struct dev_pm_qos *qos; + + KABI_RESERVE(1) + KABI_RESERVE(2) };
extern int dev_pm_get_subsys_data(struct device *dev); @@ -647,6 +658,9 @@ struct dev_pm_domain { int (*activate)(struct device *dev); void (*sync)(struct device *dev); void (*dismiss)(struct device *dev); + + KABI_RESERVE(1) + KABI_RESERVE(2) };
/* diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index 1ad0ec481416..88675b787146 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h @@ -16,6 +16,7 @@ #include <linux/notifier.h> #include <linux/spinlock.h> #include <linux/cpumask.h> +#include <linux/kabi.h>
/* * Flags to control the behaviour of a genpd. @@ -94,6 +95,9 @@ struct genpd_power_state { struct fwnode_handle *fwnode; ktime_t idle_time; void *data; + + KABI_RESERVE(1) + KABI_RESERVE(2) };
struct genpd_lock_ops; @@ -153,6 +157,11 @@ struct generic_pm_domain { }; };
+ KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + };
static inline struct generic_pm_domain *pd_to_genpd(struct dev_pm_domain *pd) diff --git a/include/linux/pm_qos.h b/include/linux/pm_qos.h index 4a69d4af3ff8..4745e27680df 100644 --- a/include/linux/pm_qos.h +++ b/include/linux/pm_qos.h @@ -15,6 +15,7 @@ #include <linux/plist.h> #include <linux/notifier.h> #include <linux/device.h> +#include <linux/kabi.h>
enum pm_qos_flags_status { PM_QOS_FLAGS_UNDEFINED = -1, @@ -112,6 +113,9 @@ struct dev_pm_qos_request { struct freq_qos_request freq; } data; struct device *dev; + + KABI_RESERVE(1) + KABI_RESERVE(2) };
struct dev_pm_qos { @@ -122,6 +126,9 @@ struct dev_pm_qos { struct dev_pm_qos_request *resume_latency_req; struct dev_pm_qos_request *latency_tolerance_req; struct dev_pm_qos_request *flags_req; + + KABI_RESERVE(1) + KABI_RESERVE(2) };
/* Action requested to pm_qos_update_target */ diff --git a/include/linux/pm_wakeup.h b/include/linux/pm_wakeup.h index aa3da6611533..4f68cf989105 100644 --- a/include/linux/pm_wakeup.h +++ b/include/linux/pm_wakeup.h @@ -14,6 +14,7 @@ #endif
#include <linux/types.h> +#include <linux/kabi.h>
struct wake_irq;
@@ -61,6 +62,9 @@ struct wakeup_source { struct device *dev; bool active:1; bool autosleep_enabled:1; + + KABI_RESERVE(1) + KABI_RESERVE(2) };
#define for_each_wakeup_source(ws) \
From: Cui GaoSheng cuigaosheng1@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4KKML DTS: NA CVE: NA
---------------------------------------------------------
Reserve space in net_namespace.h
Signed-off-by: Cui GaoSheng cuigaosheng1@huawei.com Reviewed-by: Xiu Jianfeng xiujianfeng@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/net/net_namespace.h | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/include/net/net_namespace.h b/include/net/net_namespace.h index eb0e7731f3b1..c7faca9d7447 100644 --- a/include/net/net_namespace.h +++ b/include/net/net_namespace.h @@ -38,6 +38,7 @@ #include <linux/idr.h> #include <linux/skbuff.h> #include <linux/notifier.h> +#include <linux/kabi.h>
struct user_namespace; struct proc_dir_entry; @@ -189,6 +190,11 @@ struct net { struct sock *crypto_nlsk; #endif struct sock *diag_nlsk; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) } __randomize_layout;
#include <linux/seq_file_net.h>
From: Yu Liao liaoyu15@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4JBL0 CVE: NA
-------------------------------
Reserve space for struct worker.
Signed-off-by: Yu Liao liaoyu15@huawei.com Reviewed-by: Cheng Jian cj.chengjian@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- kernel/workqueue_internal.h | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/kernel/workqueue_internal.h b/kernel/workqueue_internal.h index 498de0e909a4..9f97a95190a1 100644 --- a/kernel/workqueue_internal.h +++ b/kernel/workqueue_internal.h @@ -11,6 +11,7 @@ #include <linux/workqueue.h> #include <linux/kthread.h> #include <linux/preempt.h> +#include <linux/kabi.h>
struct worker_pool;
@@ -57,6 +58,11 @@ struct worker {
/* used by the scheduler to determine a worker's last known identity */ work_func_t last_func; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
/**
From: Yu Liao liaoyu15@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4GUAB CVE: NA
-------------------------------
Reserve space for timer and workqueue subsystem.
Signed-off-by: Yu Liao liaoyu15@huawei.com Reviewed-by: wangxiongfeng 00379786 wangxiongfeng2@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/timer.h | 6 ++++++ include/linux/workqueue.h | 11 +++++++++++ 2 files changed, 17 insertions(+)
diff --git a/include/linux/timer.h b/include/linux/timer.h index d10bc7e73b41..d2dc1cb8b9f8 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h @@ -2,6 +2,7 @@ #ifndef _LINUX_TIMER_H #define _LINUX_TIMER_H
+#include <linux/kabi.h> #include <linux/list.h> #include <linux/ktime.h> #include <linux/stddef.h> @@ -21,6 +22,11 @@ struct timer_list { #ifdef CONFIG_LOCKDEP struct lockdep_map lockdep_map; #endif + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
#ifdef CONFIG_LOCKDEP diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index a48e8ea06d74..4ecfecb1202f 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h @@ -6,6 +6,7 @@ #ifndef _LINUX_WORKQUEUE_H #define _LINUX_WORKQUEUE_H
+#include <linux/kabi.h> #include <linux/timer.h> #include <linux/linkage.h> #include <linux/bitops.h> @@ -106,6 +107,11 @@ struct work_struct { #ifdef CONFIG_LOCKDEP struct lockdep_map lockdep_map; #endif + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
#define WORK_DATA_INIT() ATOMIC_LONG_INIT((unsigned long)WORK_STRUCT_NO_POOL) @@ -121,6 +127,11 @@ struct delayed_work { int cpu; /* delayed_work private data, only used in pciehp now */ unsigned long data; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
struct rcu_work {
From: Yu Liao liaoyu15@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4JBL0 CVE: NA
-------------------------------
Reserve space for hrtimer related structures.
Signed-off-by: Yu Liao liaoyu15@huawei.com Reviewed-by: Xiongfeng Wang wangxiongfeng2@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/hrtimer.h | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index 7f1b8549ebce..1525853610b0 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h @@ -20,6 +20,7 @@ #include <linux/seqlock.h> #include <linux/timer.h> #include <linux/timerqueue.h> +#include <linux/kabi.h>
struct hrtimer_clock_base; struct hrtimer_cpu_base; @@ -124,6 +125,9 @@ struct hrtimer { u8 is_rel; u8 is_soft; u8 is_hard; + + KABI_RESERVE(1) + KABI_RESERVE(2) };
/** @@ -165,6 +169,9 @@ struct hrtimer_clock_base { struct timerqueue_head active; ktime_t (*get_time)(void); ktime_t offset; + + KABI_RESERVE(1) + KABI_RESERVE(2) } __hrtimer_clock_base_align;
enum hrtimer_base_type { @@ -235,6 +242,9 @@ struct hrtimer_cpu_base { ktime_t softirq_expires_next; struct hrtimer *softirq_next_timer; struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES]; + + KABI_RESERVE(1) + KABI_RESERVE(2) } ____cacheline_aligned;
static inline void hrtimer_set_expires(struct hrtimer *timer, ktime_t time)
From: Lin Ruizhe linruizhe@huawei.com
hulk inclusion bugzilla: https://gitee.com/openeuler/kernel/issues/I4MZU1 CVE: NA
---------------------------
Add kabi_resetve in struct acpi_rsdp_addr and setup_header
Signed-off-by: Lin Ruizhe linruizhe@huawei.com Reviewed-by: Liao Chang liaochang1@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- arch/x86/include/uapi/asm/bootparam.h | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/arch/x86/include/uapi/asm/bootparam.h b/arch/x86/include/uapi/asm/bootparam.h index 600a141c8805..b1dce768d073 100644 --- a/arch/x86/include/uapi/asm/bootparam.h +++ b/arch/x86/include/uapi/asm/bootparam.h @@ -42,6 +42,7 @@ #include <linux/types.h> #include <linux/screen_info.h> #include <linux/apm_bios.h> +#include <linux/kabi.h> #include <linux/edd.h> #include <asm/ist.h> #include <video/edid.h> @@ -102,6 +103,7 @@ struct setup_header { __u32 init_size; __u32 handover_offset; __u32 kernel_info_offset; + KABI_RESERVE(1) } __attribute__((packed));
struct sys_desc_table {
From: Lin Ruizhe linruizhe@huawei.com
hulk inclusion bugzilla: https://gitee.com/openeuler/kernel/issues/I4MZU1 CVE: NA
---------------------------
Add kabi_reserve tasklet_struct and irq_affinity in interrupt.h
Signed-off-by: Lin Ruizhe linruizhe@huawei.com Reviewed-by: Liao Chang liaochang1@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/interrupt.h | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index 9e57d44d98c5..22240a8c3a1e 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h @@ -13,6 +13,7 @@ #include <linux/hrtimer.h> #include <linux/kref.h> #include <linux/workqueue.h> +#include <linux/kabi.h>
#include <linux/atomic.h> #include <asm/ptrace.h> @@ -302,6 +303,7 @@ struct irq_affinity { unsigned int set_size[IRQ_AFFINITY_MAX_SETS]; void (*calc_sets)(struct irq_affinity *, unsigned int nvecs); void *priv; + KABI_RESERVE(1) };
/** @@ -597,6 +599,7 @@ struct tasklet_struct void (*callback)(struct tasklet_struct *t); }; unsigned long data; + KABI_RESERVE(1) };
#define DECLARE_TASKLET(name, _callback) \
From: Lin Ruizhe linruizhe@huawei.com
hulk inclusion bugzilla: https://gitee.com/openeuler/kernel/issues/I4MZU1 CVE: NA
---------------------------
Add kabi_reserve in irq_common_data irq_chip irq_chip_type in irq.h
Signed-off-by: Lin Ruizhe linruizhe@huawei.com Reviewed-by: Liao Chang liaochang1@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/irq.h | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/include/linux/irq.h b/include/linux/irq.h index 607bee9271bd..34a65cb1cd9e 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h @@ -19,6 +19,7 @@ #include <linux/topology.h> #include <linux/io.h> #include <linux/slab.h> +#include <linux/kabi.h>
#include <asm/irq.h> #include <asm/ptrace.h> @@ -156,6 +157,9 @@ struct irq_common_data { #ifdef CONFIG_GENERIC_IRQ_IPI unsigned int ipi_offset; #endif + KABI_RESERVE(1) + KABI_RESERVE(2) + };
/** @@ -550,6 +554,7 @@ struct irq_chip { void (*irq_nmi_teardown)(struct irq_data *data);
unsigned long flags; + KABI_RESERVE(1) };
/* @@ -1015,6 +1020,7 @@ struct irq_chip_type { u32 type; u32 mask_cache_priv; u32 *mask_cache; + KABI_RESERVE(1) };
/**
From: Lin Ruizhe linruizhe@huawei.com
hulk inclusion bugzilla: https://gitee.com/openeuler/kernel/issues/I4MZU1 CVE: NA
---------------------------
Add KABI_RESERVE in irq_desc
Signed-off-by: Lin Ruizhe linruizhe@huawei.com Reviewed-by: Liao Chang liaochang1@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/irqdesc.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h index 5745491303e0..dc1b213ae941 100644 --- a/include/linux/irqdesc.h +++ b/include/linux/irqdesc.h @@ -5,7 +5,7 @@ #include <linux/rcupdate.h> #include <linux/kobject.h> #include <linux/mutex.h> - +#include <linux/kabi.h> /* * Core internal functions to deal with irq descriptors */ @@ -102,6 +102,7 @@ struct irq_desc { int parent_irq; struct module *owner; const char *name; + KABI_RESERVE(1) } ____cacheline_internodealigned_in_smp;
#ifdef CONFIG_SPARSE_IRQ
From: Lin Ruizhe linruizhe@huawei.com
hulk inclusion bugzilla: https://gitee.com/openeuler/kernel/issues/I4MZU1 CVE: NA
---------------------------
Add kabi_reserve in irqdomain.h
Signed-off-by: Lin Ruizhe linruizhe@huawei.com Reviewed-by: Liao Chang liaochang1@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/irqdomain.h | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h index ea5a337e0f8b..3f493c858fc6 100644 --- a/include/linux/irqdomain.h +++ b/include/linux/irqdomain.h @@ -35,6 +35,7 @@ #include <linux/of.h> #include <linux/mutex.h> #include <linux/radix-tree.h> +#include <linux/kabi.h>
struct device_node; struct irq_domain; @@ -184,6 +185,7 @@ struct irq_domain { unsigned int revmap_size; struct radix_tree_root revmap_tree; struct mutex revmap_tree_mutex; + KABI_RESERVE(1) unsigned int linear_revmap[]; };
From: Lin Ruizhe linruizhe@huawei.com
hulk inclusion bugzilla: https://gitee.com/openeuler/kernel/issues/I4MZU1 CVE: NA
---------------------------
Add KABI_RESERVE in msi.h
Signed-off-by: Lin Ruizhe linruizhe@huawei.com Reviewed-by: Liao Chang liaochang1@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/msi.h | 3 +++ 1 file changed, 3 insertions(+)
diff --git a/include/linux/msi.h b/include/linux/msi.h index 70c910b23e13..e7e1b8a73ccb 100644 --- a/include/linux/msi.h +++ b/include/linux/msi.h @@ -4,6 +4,7 @@
#include <linux/kobject.h> #include <linux/list.h> +#include <linux/kabi.h>
struct msi_msg { u32 address_lo; /* low 32 bits of msi message address */ @@ -128,6 +129,8 @@ struct msi_desc { struct fsl_mc_msi_desc fsl_mc; struct ti_sci_inta_msi_desc inta; }; + KABI_RESERVE(1) + KABI_RESERVE(2) };
/* Helpers to hide struct msi_desc implementation details */
From: Yongqiang Liu liuyongqiang13@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4JWSP CVE: NA
--------------------------------------
Reserve space for the structure in memory subsystem.
Signed-off-by: Yongqiang Liu liuyongqiang13@huawei.com Reviewed-by: Kefeng Wang wangkefeng.wang@huawei.com Reviewed-by: Kefeng Wang wangkefeng.wang@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/mm.h | 5 +++++ include/linux/mm_types.h | 15 +++++++++++++++ include/linux/mmu_notifier.h | 9 +++++++++ include/linux/mmzone.h | 9 +++++++++ include/linux/swap.h | 3 +++ 5 files changed, 41 insertions(+)
diff --git a/include/linux/mm.h b/include/linux/mm.h index e2eb3ea63d6a..439e550f242c 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -31,6 +31,7 @@ #include <linux/sizes.h> #include <linux/sched.h> #include <linux/pgtable.h> +#include <linux/kabi.h>
struct mempolicy; struct anon_vma; @@ -648,6 +649,10 @@ struct vm_operations_struct { */ struct page *(*find_special_page)(struct vm_area_struct *vma, unsigned long addr); + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
static inline void vma_init(struct vm_area_struct *vma, struct mm_struct *mm) diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 30b36a3adb87..75a9235f7aa9 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -4,6 +4,7 @@
#include <linux/mm_types_task.h>
+#include <linux/kabi.h> #include <linux/auxvec.h> #include <linux/list.h> #include <linux/spinlock.h> @@ -374,6 +375,11 @@ struct vm_area_struct { struct mempolicy *vm_policy; /* NUMA policy for the VMA */ #endif struct vm_userfaultfd_ctx vm_userfaultfd_ctx; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) } __randomize_layout;
struct core_thread { @@ -581,6 +587,15 @@ struct mm_struct { #endif } __randomize_layout;
+ KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) + KABI_RESERVE(7) + KABI_RESERVE(8) + #if IS_ENABLED(CONFIG_KVM) && !defined(__GENKSYMS__) struct kvm *kvm; #endif diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h index 1a6a9eb6d3fa..857df3eea53f 100644 --- a/include/linux/mmu_notifier.h +++ b/include/linux/mmu_notifier.h @@ -8,6 +8,7 @@ #include <linux/mmap_lock.h> #include <linux/srcu.h> #include <linux/interval_tree.h> +#include <linux/kabi.h>
struct mmu_notifier_subscriptions; struct mmu_notifier; @@ -215,6 +216,11 @@ struct mmu_notifier_ops { */ struct mmu_notifier *(*alloc_notifier)(struct mm_struct *mm); void (*free_notifier)(struct mmu_notifier *subscription); + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
/* @@ -234,6 +240,9 @@ struct mmu_notifier { struct mm_struct *mm; struct rcu_head rcu; unsigned int users; + + KABI_RESERVE(1) + KABI_RESERVE(2) };
/** diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index d73b1486ffb8..21b1def88436 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -21,6 +21,7 @@ #include <linux/mm_types.h> #include <linux/page-flags.h> #include <asm/page.h> +#include <linux/kabi.h>
/* Free memory management - zoned buddy allocator. */ #ifndef CONFIG_FORCE_MAX_ZONEORDER @@ -583,6 +584,11 @@ struct zone { bool contiguous;
ZONE_PADDING(_pad3_) + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) /* Zone statistics */ atomic_long_t vm_stat[NR_VM_ZONE_STAT_ITEMS]; atomic_long_t vm_numa_stat[NR_VM_NUMA_STAT_ITEMS]; @@ -824,6 +830,9 @@ typedef struct pglist_data {
ZONE_PADDING(_pad2_)
+ KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) /* Per-node vmstats */ struct per_cpu_nodestat __percpu *per_cpu_nodestats; atomic_long_t vm_stat[NR_VM_NODE_STAT_ITEMS]; diff --git a/include/linux/swap.h b/include/linux/swap.h index 9b708c0288bc..f2aa72ec0e57 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -12,6 +12,7 @@ #include <linux/fs.h> #include <linux/atomic.h> #include <linux/page-flags.h> +#include <linux/kabi.h> #include <asm/page.h>
struct notifier_block; @@ -291,6 +292,8 @@ struct swap_info_struct { */ struct work_struct discard_work; /* discard worker */ struct swap_cluster_list discard_clusters; /* discard clusters list */ + KABI_RESERVE(1) + KABI_RESERVE(2) struct plist_node avail_lists[]; /* * entries in swap_avail_heads, one * entry per node.
From: Lu Jialin lujialin4@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4GII8?from=project-issue CVE: NA
--------
We reserve some fields beforehand for cgroup framework related structures prone to change, therefore, we can hot add/change features of cgroupv1/cgroupv2 with this enhancement.
After reserving, normally cache does not matter as the reserved fields are not accessed at all.
---------
Signed-off-by: Lu Jialin lujialin4@huawei.com Reviewed-by: weiyang wang wangweiyang2@huawei.com Reviewed-by: Xiu Jianfeng xiujianfeng@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/cgroup-defs.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h index b87e13609f0f..648c2e1ec442 100644 --- a/include/linux/cgroup-defs.h +++ b/include/linux/cgroup-defs.h @@ -21,6 +21,7 @@ #include <linux/workqueue.h> #include <linux/bpf-cgroup.h> #include <linux/psi_types.h> +#include <linux/kabi.h>
#ifdef CONFIG_CGROUPS
@@ -126,6 +127,9 @@ struct cgroup_file { struct kernfs_node *kn; unsigned long notified_at; struct timer_list notify_timer; + + KABI_RESERVE(1) + KABI_RESERVE(2) };
/* @@ -183,6 +187,11 @@ struct cgroup_subsys_state { * fields of the containing structure. */ struct cgroup_subsys_state *parent; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
/* @@ -279,6 +288,11 @@ struct css_set {
/* For RCU-protected deletion */ struct rcu_head rcu_head; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
struct cgroup_base_stat { @@ -482,6 +496,10 @@ struct cgroup { /* Used to store internal freezer state */ struct cgroup_freezer_state freezer;
+ KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + /* ids of the ancestors at each level including self */ u64 ancestor_ids[]; }; @@ -523,6 +541,11 @@ struct cgroup_root {
/* The name for this hierarchy - may be empty */ char name[MAX_CGROUP_ROOT_NAMELEN]; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
/* @@ -618,6 +641,8 @@ struct cftype { __poll_t (*poll)(struct kernfs_open_file *of, struct poll_table_struct *pt);
+ KABI_RESERVE(1) + #ifdef CONFIG_DEBUG_LOCK_ALLOC struct lock_class_key lockdep_key; #endif @@ -650,6 +675,10 @@ struct cgroup_subsys { void (*release)(struct task_struct *task); void (*bind)(struct cgroup_subsys_state *root_css);
+ KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) bool early_init:1;
/*
From: Lu Jialin lujialin4@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4GII8?from=project-issue CVE: NA
--------
We reserve some fields beforehand for memcg related structures prone to change, therefore, we can hot add/change features of memcg with this enhancement.
After reserving, normally cache does not matter as the reserved fields are not accessed at all.
--------
Signed-off-by: Lu Jialin lujialin4@huawei.com Reviewed-by: weiyang wang wangweiyang2@huawei.com Reviewed-by: Xiu Jianfeng xiujianfeng@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/memcontrol.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 8bd428741de8..46062d99f14d 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -21,6 +21,7 @@ #include <linux/vmstat.h> #include <linux/writeback.h> #include <linux/page-flags.h> +#include <linux/kabi.h>
struct mem_cgroup; struct obj_cgroup; @@ -61,6 +62,7 @@ struct mem_cgroup_reclaim_cookie { struct mem_cgroup_id { int id; refcount_t ref; + KABI_RESERVE(1) };
/* @@ -87,6 +89,9 @@ struct memcg_vmstats_percpu { /* Cgroup1: threshold notifications & softlimit tree updates */ unsigned long nr_page_events; unsigned long targets[MEM_CGROUP_NTARGETS]; + + KABI_RESERVE(1) + KABI_RESERVE(2) };
struct memcg_vmstats { @@ -152,6 +157,12 @@ struct mem_cgroup_per_node { bool on_tree; struct mem_cgroup *memcg; /* Back pointer, we cannot */ /* use container_of */ + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) };
struct mem_cgroup_threshold { @@ -359,6 +370,15 @@ struct mem_cgroup { struct deferred_split deferred_split_queue; #endif
+ KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) + KABI_RESERVE(7) + KABI_RESERVE(8) + struct mem_cgroup_per_node *nodeinfo[0]; /* WARNING: nodeinfo must be the last member here */ };
From: Lu Jialin lujialin4@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4GII8?from=project-issue CVE: NA
--------
We reserve some fields beforehand for cpu cgroup and cpuset related structures prone to change, therefore, we can hot add/change features of cpu cgroup cpuset and cgroup with this enhancement.
After reserving, normally cache does not matter as the reserved fields are not accessed at all.
--------
Signed-off-by: Lu Jialin lujialin4@huawei.com Reviewed-by: Chen Hui judy.chenhui@huawei.com Reviewed-by: weiyang wang wangweiyang2@huawei.com Reviewed-by: Xiu Jianfeng xiujianfeng@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- kernel/cgroup/cpuset.c | 6 ++++++ kernel/sched/sched.h | 5 +++++ 2 files changed, 11 insertions(+)
diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index e575435811cf..4708c06eba0a 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -65,6 +65,7 @@ #include <linux/mutex.h> #include <linux/cgroup.h> #include <linux/wait.h> +#include <linux/kabi.h>
DEFINE_STATIC_KEY_FALSE(cpusets_pre_enable_key); DEFINE_STATIC_KEY_FALSE(cpusets_enabled_key); @@ -160,6 +161,11 @@ struct cpuset { */ int use_parent_ecpus; int child_ecpus_count; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
/* diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 4c58086cf080..ca7572c052f8 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -65,6 +65,7 @@ #include <linux/syscalls.h> #include <linux/task_work.h> #include <linux/tsacct_kern.h> +#include <linux/kabi.h>
#include <asm/tlb.h> #include <asm-generic/vmlinux.lds.h> @@ -440,6 +441,10 @@ struct task_group { struct uclamp_se uclamp[UCLAMP_CNT]; #endif
+ KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
#ifdef CONFIG_FAIR_GROUP_SCHED
From: Lu Jialin lujialin4@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4GII8?from=project-issue CVE: NA
--------
We reserve some fields beforehand for cgroup bpf structures prone to change, therefore, we can hot add/change features of bpf cgroup with this enhancement.
After reserving, normally cache does not matter as the reserved fields are not accessed at all.
Signed-off-by: Lu Jialin lujialin4@huawei.com Reviewed-by: weiyang wang wangweiyang2@huawei.com Reviewed-by: Xiu Jianfeng xiujianfeng@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/bpf-cgroup.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
diff --git a/include/linux/bpf-cgroup.h b/include/linux/bpf-cgroup.h index 5120ca319ff4..7014d2ade050 100644 --- a/include/linux/bpf-cgroup.h +++ b/include/linux/bpf-cgroup.h @@ -9,6 +9,7 @@ #include <linux/percpu-refcount.h> #include <linux/rbtree.h> #include <uapi/linux/bpf.h> +#include <linux/kabi.h>
struct sock; struct sockaddr; @@ -88,6 +89,23 @@ struct cgroup_bpf {
/* cgroup_bpf is released using a work queue */ struct work_struct release_work; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) + KABI_RESERVE(7) + KABI_RESERVE(8) + KABI_RESERVE(9) + KABI_RESERVE(10) + KABI_RESERVE(11) + KABI_RESERVE(12) + KABI_RESERVE(13) + KABI_RESERVE(14) + KABI_RESERVE(15) + KABI_RESERVE(16) };
int cgroup_bpf_inherit(struct cgroup *cgrp);
From: Wang Hai wanghai38@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4HE7P?from=project-issue CVE: NA
--------
Reserve some fields beforehand for net base framework related structures prone to change.
---------
Signed-off-by: Wang Hai wanghai38@huawei.com Reviewed-by: Wei Yongjun weiyongjun1@huawei.com Reviewed-by: Yue Haibing yuehaibing@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/device.h | 10 +++++++ include/linux/device/class.h | 6 ++++ include/linux/ethtool.h | 6 ++++ include/linux/ipv6.h | 6 ++++ include/linux/net.h | 6 ++++ include/linux/netdevice.h | 47 ++++++++++++++++++++++++++++++ include/linux/skbuff.h | 6 ++++ include/net/dcbnl.h | 9 ++++++ include/net/dst.h | 10 +++++++ include/net/dst_ops.h | 10 +++++++ include/net/fib_rules.h | 10 +++++++ include/net/flow.h | 10 +++++++ include/net/genetlink.h | 10 +++++++ include/net/inet_connection_sock.h | 5 ++++ include/net/ip6_fib.h | 9 ++++++ include/net/l3mdev.h | 6 ++++ include/net/lwtunnel.h | 7 +++++ include/net/neighbour.h | 8 +++++ include/net/netlink.h | 5 ++++ include/net/netns/ipv4.h | 8 +++++ include/net/netns/ipv6.h | 3 ++ include/net/netns/nftables.h | 3 ++ include/net/netns/xfrm.h | 3 ++ include/net/page_pool.h | 3 ++ include/net/rtnetlink.h | 10 +++++++ include/net/sch_generic.h | 7 +++++ include/net/sock.h | 19 ++++++++++++ include/net/switchdev.h | 6 ++++ include/net/tls.h | 5 ++++ include/net/xfrm.h | 6 ++++ 30 files changed, 259 insertions(+)
diff --git a/include/linux/device.h b/include/linux/device.h index 5dc0f81e4f9d..f14c248df848 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -30,6 +30,7 @@ #include <linux/device/bus.h> #include <linux/device/class.h> #include <linux/device/driver.h> +#include <linux/kabi.h> #include <asm/device.h>
struct device; @@ -558,6 +559,15 @@ struct device { #ifdef CONFIG_DMA_OPS_BYPASS bool dma_ops_bypass : 1; #endif + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) + KABI_RESERVE(7) + KABI_RESERVE(8) };
/** diff --git a/include/linux/device/class.h b/include/linux/device/class.h index e8d470c457d1..20d954100cc7 100644 --- a/include/linux/device/class.h +++ b/include/linux/device/class.h @@ -18,6 +18,7 @@ #include <linux/klist.h> #include <linux/pm.h> #include <linux/device/bus.h> +#include <linux/kabi.h>
struct device; struct fwnode_handle; @@ -75,6 +76,11 @@ struct class { const struct dev_pm_ops *pm;
struct subsys_private *p; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
struct class_dev_iter { diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index 0074c2e12cb5..726c1b27f3c4 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h @@ -17,6 +17,7 @@ #include <linux/compat.h> #include <linux/netlink.h> #include <uapi/linux/ethtool.h> +#include <linux/kabi.h>
struct compat_ethtool_rx_flow_spec { u32 flow_type; @@ -544,6 +545,11 @@ struct ethtool_ops { const struct ethtool_tunable *, void *); int (*set_phy_tunable)(struct net_device *, const struct ethtool_tunable *, const void *); + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
int ethtool_check_ops(const struct ethtool_ops *ops); diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h index f514a7dd8c9c..0e6f5d2785e9 100644 --- a/include/linux/ipv6.h +++ b/include/linux/ipv6.h @@ -3,6 +3,7 @@ #define _IPV6_H
#include <uapi/linux/ipv6.h> +#include <linux/kabi.h>
#define ipv6_optlen(p) (((p)->hdrlen+1) << 3) #define ipv6_authlen(p) (((p)->hdrlen+2) << 2) @@ -77,6 +78,11 @@ struct ipv6_devconf { __s32 rpl_seg_enabled;
struct ctl_table_header *sysctl_header; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
struct ipv6_params { diff --git a/include/linux/net.h b/include/linux/net.h index 0dcd51feef02..b40865005020 100644 --- a/include/linux/net.h +++ b/include/linux/net.h @@ -25,6 +25,7 @@ #include <linux/sockptr.h>
#include <uapi/linux/net.h> +#include <linux/kabi.h>
struct poll_table_struct; struct pipe_inode_info; @@ -203,6 +204,11 @@ struct proto_ops { int (*sendmsg_locked)(struct sock *sk, struct msghdr *msg, size_t size); int (*set_rcvlowat)(struct sock *sk, int val); + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
#define DECLARE_SOCKADDR(type, dst, src) \ diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h index 4fdeccf22378..1335981945d9 100644 --- a/include/linux/netdevice.h +++ b/include/linux/netdevice.h @@ -48,6 +48,7 @@ #include <uapi/linux/if_bonding.h> #include <uapi/linux/pkt_cls.h> #include <linux/hashtable.h> +#include <linux/kabi.h>
struct netpoll_info; struct device; @@ -278,6 +279,9 @@ struct header_ops { const unsigned char *haddr); bool (*validate)(const char *ll_header, unsigned int len); __be16 (*parse_protocol)(const struct sk_buff *skb); + + KABI_RESERVE(1) + KABI_RESERVE(2) };
/* These flag bits are private to the generic network queueing @@ -347,6 +351,11 @@ struct napi_struct { struct list_head dev_list; struct hlist_node napi_hash_node; unsigned int napi_id; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
enum { @@ -621,6 +630,11 @@ struct netdev_queue { #ifdef CONFIG_BQL struct dql dql; #endif + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) } ____cacheline_aligned_in_smp;
extern int sysctl_fb_tunnels_only_for_init_net; @@ -744,6 +758,11 @@ struct netdev_rx_queue { #ifdef CONFIG_XDP_SOCKETS struct xsk_buff_pool *pool; #endif + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) } ____cacheline_aligned_in_smp;
/* @@ -924,6 +943,11 @@ struct xfrmdev_ops { bool (*xdo_dev_offload_ok) (struct sk_buff *skb, struct xfrm_state *x); void (*xdo_dev_state_advance_esn) (struct xfrm_state *x); + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) }; #endif
@@ -1487,6 +1511,15 @@ struct net_device_ops { int (*ndo_tunnel_ctl)(struct net_device *dev, struct ip_tunnel_parm *p, int cmd); struct net_device * (*ndo_get_peer_dev)(struct net_device *dev); + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) + KABI_RESERVE(7) + KABI_RESERVE(8) };
/** @@ -2173,6 +2206,15 @@ struct net_device {
/* protected by rtnl_lock */ struct bpf_xdp_entity xdp_state[__MAX_XDP_MODE]; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) + KABI_RESERVE(7) + KABI_RESERVE(8) }; #define to_net_dev(d) container_of(d, struct net_device, dev)
@@ -2545,6 +2587,11 @@ struct packet_type { struct sock *sk); void *af_packet_priv; struct list_head list; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
struct offload_callbacks { diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 2529415e3483..9e3a454d2377 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -38,6 +38,7 @@ #include <linux/if_packet.h> #include <net/flow.h> #include <net/page_pool.h> +#include <linux/kabi.h> #if IS_ENABLED(CONFIG_NF_CONNTRACK) #include <linux/netfilter/nf_conntrack_common.h> #endif @@ -913,6 +914,11 @@ struct sk_buff { __u32 headers_end[0]; /* public: */
+ KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + /* These elements must be at the end, see alloc_skb() for details. */ sk_buff_data_t tail; sk_buff_data_t end; diff --git a/include/net/dcbnl.h b/include/net/dcbnl.h index e4ad58c4062c..22cf936bf774 100644 --- a/include/net/dcbnl.h +++ b/include/net/dcbnl.h @@ -107,6 +107,15 @@ struct dcbnl_rtnl_ops { /* buffer settings */ int (*dcbnl_getbuffer)(struct net_device *, struct dcbnl_buffer *); int (*dcbnl_setbuffer)(struct net_device *, struct dcbnl_buffer *); + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) + KABI_RESERVE(7) + KABI_RESERVE(8) };
#endif /* __NET_DCBNL_H__ */ diff --git a/include/net/dst.h b/include/net/dst.h index acd15c544cf3..633e79e69d5a 100644 --- a/include/net/dst.h +++ b/include/net/dst.h @@ -18,6 +18,7 @@ #include <linux/refcount.h> #include <net/neighbour.h> #include <asm/processor.h> +#include <linux/kabi.h>
struct sk_buff;
@@ -76,6 +77,15 @@ struct dst_entry { #ifndef CONFIG_64BIT atomic_t __refcnt; /* 32-bit offset 64 */ #endif + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) + KABI_RESERVE(7) + KABI_RESERVE(8) };
struct dst_metrics { diff --git a/include/net/dst_ops.h b/include/net/dst_ops.h index 88ff7bb2bb9b..250e23188858 100644 --- a/include/net/dst_ops.h +++ b/include/net/dst_ops.h @@ -4,6 +4,7 @@ #include <linux/types.h> #include <linux/percpu_counter.h> #include <linux/cache.h> +#include <linux/kabi.h>
struct dst_entry; struct kmem_cachep; @@ -41,6 +42,15 @@ struct dst_ops { struct kmem_cache *kmem_cachep;
struct percpu_counter pcpuc_entries ____cacheline_aligned_in_smp; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) + KABI_RESERVE(7) + KABI_RESERVE(8) };
static inline int dst_entries_get_fast(struct dst_ops *dst) diff --git a/include/net/fib_rules.h b/include/net/fib_rules.h index 4b10676c69d1..17296ab1dcd5 100644 --- a/include/net/fib_rules.h +++ b/include/net/fib_rules.h @@ -11,6 +11,7 @@ #include <net/rtnetlink.h> #include <net/fib_notifier.h> #include <linux/indirect_call_wrapper.h> +#include <linux/kabi.h>
struct fib_kuid_range { kuid_t start; @@ -44,6 +45,15 @@ struct fib_rule { struct fib_rule_port_range sport_range; struct fib_rule_port_range dport_range; struct rcu_head rcu; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) + KABI_RESERVE(7) + KABI_RESERVE(8) };
struct fib_lookup_arg { diff --git a/include/net/flow.h b/include/net/flow.h index b2531df3f65f..104b8b2d720c 100644 --- a/include/net/flow.h +++ b/include/net/flow.h @@ -13,6 +13,7 @@ #include <linux/atomic.h> #include <net/flow_dissector.h> #include <linux/uidgid.h> +#include <linux/kabi.h>
/* * ifindex generation is per-net namespace, and loopback is @@ -41,6 +42,9 @@ struct flowi_common { kuid_t flowic_uid; struct flowi_tunnel flowic_tun_key; __u32 flowic_multipath_hash; + + KABI_RESERVE(1) + KABI_RESERVE(2) };
union flowi_uli { @@ -93,6 +97,9 @@ struct flowi4 { #define fl4_ipsec_spi uli.spi #define fl4_mh_type uli.mht.type #define fl4_gre_key uli.gre_key + + KABI_RESERVE(1) + KABI_RESERVE(2) } __attribute__((__aligned__(BITS_PER_LONG/8)));
static inline void flowi4_init_output(struct flowi4 *fl4, int oif, @@ -169,6 +176,9 @@ struct flowidn { union flowi_uli uli; #define fld_sport uli.ports.sport #define fld_dport uli.ports.dport + + KABI_RESERVE(1) + KABI_RESERVE(2) } __attribute__((__aligned__(BITS_PER_LONG/8)));
struct flowi { diff --git a/include/net/genetlink.h b/include/net/genetlink.h index e55ec1597ce7..f927ba671e4b 100644 --- a/include/net/genetlink.h +++ b/include/net/genetlink.h @@ -5,6 +5,7 @@ #include <linux/genetlink.h> #include <net/netlink.h> #include <net/net_namespace.h> +#include <linux/kabi.h>
#define GENLMSG_DEFAULT_SIZE (NLMSG_DEFAULT_SIZE - GENL_HDRLEN)
@@ -67,6 +68,8 @@ struct genl_family { const struct genl_small_ops *small_ops; const struct genl_multicast_group *mcgrps; struct module *module; + + KABI_RESERVE(1) };
/** @@ -91,6 +94,8 @@ struct genl_info { possible_net_t _net; void * user_ptr[2]; struct netlink_ext_ack *extack; + + KABI_RESERVE(1) };
static inline struct net *genl_info_net(struct genl_info *info) @@ -158,6 +163,11 @@ struct genl_ops { u8 internal_flags; u8 flags; u8 validate; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
/** diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h index 0b1864a82d4a..04c7ddda2f37 100644 --- a/include/net/inet_connection_sock.h +++ b/include/net/inet_connection_sock.h @@ -20,6 +20,7 @@
#include <net/inet_sock.h> #include <net/request_sock.h> +#include <linux/kabi.h>
/* Cancel timers, when they are not required. */ #undef INET_CSK_CLEAR_TIMERS @@ -51,6 +52,8 @@ struct inet_connection_sock_af_ops { char __user *optval, int __user *optlen); void (*addr2sockaddr)(struct sock *sk, struct sockaddr *); void (*mtu_reduced)(struct sock *sk); + + KABI_RESERVE(1) };
/** inet_connection_sock - INET connection oriented sock @@ -134,6 +137,8 @@ struct inet_connection_sock { u32 icsk_probes_tstamp; u32 icsk_user_timeout;
+ KABI_RESERVE(1) + u64 icsk_ca_priv[104 / sizeof(u64)]; #define ICSK_CA_PRIV_SIZE (13 * sizeof(u64)) }; diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h index ac5ff3c3afb1..d19b3077a56c 100644 --- a/include/net/ip6_fib.h +++ b/include/net/ip6_fib.h @@ -67,6 +67,8 @@ struct fib6_config { struct nlattr *fc_encap; u16 fc_encap_type; bool fc_is_fdb; + + KABI_RESERVE(1) };
struct fib6_node { @@ -83,6 +85,8 @@ struct fib6_node { int fn_sernum; struct fib6_info __rcu *rr_ptr; struct rcu_head rcu; + + KABI_RESERVE(1) };
struct fib6_gc_args { @@ -199,6 +203,9 @@ struct fib6_info {
struct rcu_head rcu; struct nexthop *nh; + + KABI_RESERVE(1) + struct fib6_nh fib6_nh[]; };
@@ -218,6 +225,8 @@ struct rt6_info {
/* more non-fragment space at head required */ unsigned short rt6i_nfheader_len; + + KABI_RESERVE(1) };
struct fib6_result { diff --git a/include/net/l3mdev.h b/include/net/l3mdev.h index 031c661aa14d..ba8dc2523c59 100644 --- a/include/net/l3mdev.h +++ b/include/net/l3mdev.h @@ -9,6 +9,7 @@
#include <net/dst.h> #include <net/fib_rules.h> +#include <linux/kabi.h>
enum l3mdev_type { L3MDEV_TYPE_UNSPEC, @@ -43,6 +44,11 @@ struct l3mdev_ops { /* IPv6 ops */ struct dst_entry * (*l3mdev_link_scope_lookup)(const struct net_device *dev, struct flowi6 *fl6); + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
#ifdef CONFIG_NET_L3_MASTER_DEV diff --git a/include/net/lwtunnel.h b/include/net/lwtunnel.h index 05cfd6ff6528..13a5062a66f4 100644 --- a/include/net/lwtunnel.h +++ b/include/net/lwtunnel.h @@ -7,6 +7,7 @@ #include <linux/skbuff.h> #include <linux/types.h> #include <net/route.h> +#include <linux/kabi.h>
#define LWTUNNEL_HASH_BITS 7 #define LWTUNNEL_HASH_SIZE (1 << LWTUNNEL_HASH_BITS) @@ -30,6 +31,12 @@ struct lwtunnel_state { int (*orig_output)(struct net *net, struct sock *sk, struct sk_buff *skb); int (*orig_input)(struct sk_buff *); struct rcu_head rcu; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + __u8 data[]; };
diff --git a/include/net/neighbour.h b/include/net/neighbour.h index d5767e25509c..94ba37f4c902 100644 --- a/include/net/neighbour.h +++ b/include/net/neighbour.h @@ -29,6 +29,7 @@ #include <linux/sysctl.h> #include <linux/workqueue.h> #include <net/rtnetlink.h> +#include <linux/kabi.h>
/* * NUD stands for "neighbor unreachability detection" @@ -83,6 +84,8 @@ struct neigh_parms { int reachable_time; int data[NEIGH_VAR_DATA_MAX]; DECLARE_BITMAP(data_state, NEIGH_VAR_DATA_MAX); + + KABI_RESERVE(1) };
static inline void neigh_var_set(struct neigh_parms *p, int index, int val) @@ -157,6 +160,9 @@ struct neighbour { struct list_head gc_list; struct rcu_head rcu; struct net_device *dev; + + KABI_RESERVE(1) + u8 primary_key[0]; } __randomize_layout;
@@ -226,6 +232,8 @@ struct neigh_table { struct neigh_statistics __percpu *stats; struct neigh_hash_table __rcu *nht; struct pneigh_entry **phash_buckets; + + KABI_RESERVE(1) };
enum { diff --git a/include/net/netlink.h b/include/net/netlink.h index 7356f41d23ba..624a92313aaa 100644 --- a/include/net/netlink.h +++ b/include/net/netlink.h @@ -6,6 +6,7 @@ #include <linux/netlink.h> #include <linux/jiffies.h> #include <linux/in6.h> +#include <linux/kabi.h>
/* ======================================================================== * Netlink Messages and Attributes Interface (As Seen On TV) @@ -348,6 +349,10 @@ struct nla_policy { */ u16 strict_start_type; }; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) };
#define NLA_POLICY_ETH_ADDR NLA_POLICY_EXACT_LEN(ETH_ALEN) diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h index 8e4fcac4df72..e8bddb5790c0 100644 --- a/include/net/netns/ipv4.h +++ b/include/net/netns/ipv4.h @@ -10,6 +10,7 @@ #include <net/inet_frag.h> #include <linux/rcupdate.h> #include <linux/siphash.h> +#include <linux/kabi.h>
struct tcpm_hash_bucket; struct ctl_table_header; @@ -227,5 +228,12 @@ struct netns_ipv4 {
atomic_t rt_genid; siphash_key_t ip_id_key; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) }; #endif diff --git a/include/net/netns/ipv6.h b/include/net/netns/ipv6.h index 5ec054473d81..ce5ed87accda 100644 --- a/include/net/netns/ipv6.h +++ b/include/net/netns/ipv6.h @@ -9,6 +9,7 @@ #define __NETNS_IPV6_H__ #include <net/dst_ops.h> #include <uapi/linux/icmpv6.h> +#include <linux/kabi.h>
struct ctl_table_header;
@@ -115,6 +116,8 @@ struct netns_ipv6 { spinlock_t lock; u32 seq; } ip6addrlbl_table; + + KABI_RESERVE(1) };
#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6) diff --git a/include/net/netns/nftables.h b/include/net/netns/nftables.h index 6c0806bd8d1e..4d9c11e334fb 100644 --- a/include/net/netns/nftables.h +++ b/include/net/netns/nftables.h @@ -3,6 +3,7 @@ #define _NETNS_NFTABLES_H_
#include <linux/list.h> +#include <linux/kabi.h>
struct netns_nftables { struct list_head tables; @@ -13,6 +14,8 @@ struct netns_nftables { unsigned int base_seq; u8 gencursor; u8 validate_state; + + KABI_RESERVE(1) };
#endif diff --git a/include/net/netns/xfrm.h b/include/net/netns/xfrm.h index 22e1bc72b979..9144e0f09a30 100644 --- a/include/net/netns/xfrm.h +++ b/include/net/netns/xfrm.h @@ -8,6 +8,7 @@ #include <linux/rhashtable-types.h> #include <linux/xfrm.h> #include <net/dst_ops.h> +#include <linux/kabi.h>
struct ctl_table_header;
@@ -78,6 +79,8 @@ struct netns_xfrm {
spinlock_t xfrm_policy_lock; struct mutex xfrm_cfg_mutex; + + KABI_RESERVE(1) };
#endif diff --git a/include/net/page_pool.h b/include/net/page_pool.h index 3855f069627f..b9ecabff2032 100644 --- a/include/net/page_pool.h +++ b/include/net/page_pool.h @@ -33,6 +33,7 @@ #include <linux/mm.h> /* Needed by ptr_ring */ #include <linux/ptr_ring.h> #include <linux/dma-direction.h> +#include <linux/kabi.h>
#define PP_FLAG_DMA_MAP BIT(0) /* Should page_pool do the DMA * map/unmap @@ -132,6 +133,8 @@ struct page_pool { refcount_t user_cnt;
u64 destroy_cnt; + + KABI_RESERVE(1) };
struct page *page_pool_alloc_pages(struct page_pool *pool, gfp_t gfp); diff --git a/include/net/rtnetlink.h b/include/net/rtnetlink.h index 4da61c950e93..907d51e677db 100644 --- a/include/net/rtnetlink.h +++ b/include/net/rtnetlink.h @@ -4,6 +4,7 @@
#include <linux/rtnetlink.h> #include <net/netlink.h> +#include <linux/kabi.h>
typedef int (*rtnl_doit_func)(struct sk_buff *, struct nlmsghdr *, struct netlink_ext_ack *); @@ -112,6 +113,15 @@ struct rtnl_link_ops { int (*fill_linkxstats)(struct sk_buff *skb, const struct net_device *dev, int *prividx, int attr); + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) + KABI_RESERVE(7) + KABI_RESERVE(8) };
int __rtnl_link_register(struct rtnl_link_ops *ops); diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 9226a84dcc14..50dd8be91bf4 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h @@ -19,6 +19,7 @@ #include <net/gen_stats.h> #include <net/rtnetlink.h> #include <net/flow_offload.h> +#include <linux/kabi.h>
struct Qdisc_ops; struct qdisc_walker; @@ -114,6 +115,8 @@ struct Qdisc { bool empty; struct rcu_head rcu;
+ KABI_RESERVE(1) + /* private data */ long privdata[] ____cacheline_aligned; }; @@ -271,6 +274,8 @@ struct Qdisc_class_ops { struct sk_buff *skb, struct tcmsg*); int (*dump_stats)(struct Qdisc *, unsigned long, struct gnet_dump *); + + KABI_RESERVE(1) };
/* Qdisc_class_ops flag values */ @@ -316,6 +321,8 @@ struct Qdisc_ops { u32 (*egress_block_get)(struct Qdisc *sch);
struct module *owner; + + KABI_RESERVE(1) };
diff --git a/include/net/sock.h b/include/net/sock.h index 6270d1d9436b..16b085f6c0bc 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -68,6 +68,7 @@ #include <net/tcp_states.h> #include <linux/net_tstamp.h> #include <net/l3mdev.h> +#include <linux/kabi.h>
/* * This structure really needs to be cleaned up. @@ -522,6 +523,15 @@ struct sock { struct bpf_local_storage __rcu *sk_bpf_storage; #endif struct rcu_head sk_rcu; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) + KABI_RESERVE(7) + KABI_RESERVE(8) };
enum sk_pacing { @@ -1235,6 +1245,15 @@ struct proto { atomic_t socks; #endif int (*diag_destroy)(struct sock *sk, int err); + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) + KABI_RESERVE(7) + KABI_RESERVE(8) } __randomize_layout;
int proto_register(struct proto *prot, int alloc_slab); diff --git a/include/net/switchdev.h b/include/net/switchdev.h index 8528015590e4..4855db6bce5e 100644 --- a/include/net/switchdev.h +++ b/include/net/switchdev.h @@ -11,6 +11,7 @@ #include <linux/notifier.h> #include <linux/list.h> #include <net/ip_fib.h> +#include <linux/kabi.h>
#define SWITCHDEV_F_NO_RECURSE BIT(0) #define SWITCHDEV_F_SKIP_EOPNOTSUPP BIT(1) @@ -87,6 +88,11 @@ struct switchdev_obj { u32 flags; void *complete_priv; void (*complete)(struct net_device *dev, int err, void *priv); + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
/* SWITCHDEV_OBJ_ID_PORT_VLAN */ diff --git a/include/net/tls.h b/include/net/tls.h index 745b3bc6ce91..8e02a6ae247f 100644 --- a/include/net/tls.h +++ b/include/net/tls.h @@ -214,6 +214,11 @@ enum tls_context_flags { struct cipher_context { char *iv; char *rec_seq; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
union tls_crypto_context { diff --git a/include/net/xfrm.h b/include/net/xfrm.h index 6232a5f048bd..f2875c629d06 100644 --- a/include/net/xfrm.h +++ b/include/net/xfrm.h @@ -27,6 +27,7 @@ #include <net/gro_cells.h>
#include <linux/interrupt.h> +#include <linux/kabi.h>
#ifdef CONFIG_XFRM_STATISTICS #include <net/snmp.h> @@ -132,6 +133,11 @@ struct xfrm_state_offload { unsigned long offload_handle; unsigned int num_exthdrs; u8 flags; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
struct xfrm_mode {
From: Wang Hai wanghai38@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4HE7P?from=project-issue CVE: NA
--------
Reserve some fields beforehand for net can framework related structures prone to change.
---------
Signed-off-by: Wang Hai wanghai38@huawei.com Reviewed-by: Wei Yongjun weiyongjun1@huawei.com Reviewed-by: Yue Haibing yuehaibing@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/can/core.h | 4 ++++ include/linux/can/dev.h | 6 ++++++ include/linux/can/rx-offload.h | 4 ++++ include/linux/can/skb.h | 1 + include/net/netns/can.h | 3 +++ 5 files changed, 18 insertions(+)
diff --git a/include/linux/can/core.h b/include/linux/can/core.h index 5fb8d0e3f9c1..b939f271c108 100644 --- a/include/linux/can/core.h +++ b/include/linux/can/core.h @@ -17,6 +17,7 @@ #include <linux/can.h> #include <linux/skbuff.h> #include <linux/netdevice.h> +#include <linux/kabi.h>
#define DNAME(dev) ((dev) ? (dev)->name : "any")
@@ -32,6 +33,9 @@ struct can_proto { int protocol; const struct proto_ops *ops; struct proto *prot; + + KABI_RESERVE(1) + KABI_RESERVE(2) };
/* required_size diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h index 41ff31795320..ebac2eec365c 100644 --- a/include/linux/can/dev.h +++ b/include/linux/can/dev.h @@ -20,6 +20,7 @@ #include <linux/can/netlink.h> #include <linux/can/skb.h> #include <linux/netdevice.h> +#include <linux/kabi.h>
/* * CAN mode @@ -80,6 +81,11 @@ struct can_priv { struct led_trigger *rxtx_led_trig; char rxtx_led_trig_name[CAN_LED_NAME_SZ]; #endif + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
#define CAN_SYNC_SEG 1 diff --git a/include/linux/can/rx-offload.h b/include/linux/can/rx-offload.h index f1b38088b765..03b4aa348e9b 100644 --- a/include/linux/can/rx-offload.h +++ b/include/linux/can/rx-offload.h @@ -11,6 +11,7 @@
#include <linux/netdevice.h> #include <linux/can.h> +#include <linux/kabi.h>
struct can_rx_offload { struct net_device *dev; @@ -28,6 +29,9 @@ struct can_rx_offload { struct napi_struct napi;
bool inc; + + KABI_RESERVE(1) + KABI_RESERVE(2) };
int can_rx_offload_add_timestamp(struct net_device *dev, diff --git a/include/linux/can/skb.h b/include/linux/can/skb.h index ce7393d397e1..3323746ce2fd 100644 --- a/include/linux/can/skb.h +++ b/include/linux/can/skb.h @@ -34,6 +34,7 @@ struct can_skb_priv { int ifindex; int skbcnt; + struct can_frame cf[]; };
diff --git a/include/net/netns/can.h b/include/net/netns/can.h index 52fbd8291a96..e2783e3600fb 100644 --- a/include/net/netns/can.h +++ b/include/net/netns/can.h @@ -7,6 +7,7 @@ #define __NETNS_CAN_H__
#include <linux/spinlock.h> +#include <linux/kabi.h>
struct can_dev_rcv_lists; struct can_pkg_stats; @@ -35,6 +36,8 @@ struct netns_can {
/* CAN GW per-net gateway jobs */ struct hlist_head cgw_list; + + KABI_RESERVE(1) };
#endif /* __NETNS_CAN_H__ */
From: Wang Hai wanghai38@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4HE7P?from=project-issue CVE: NA
--------
Reserve some fields beforehand for net sunrpc framework related structures prone to change.
---------
Signed-off-by: Wang Hai wanghai38@huawei.com Reviewed-by: Wei Yongjun weiyongjun1@huawei.com Reviewed-by: Yue Haibing yuehaibing@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/sunrpc/cache.h | 4 ++++ include/linux/sunrpc/clnt.h | 10 ++++++++++ include/linux/sunrpc/sched.h | 14 ++++++++++++++ include/linux/sunrpc/stats.h | 5 +++++ include/linux/sunrpc/xprt.h | 17 +++++++++++++++++ 5 files changed, 50 insertions(+)
diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h index d0965e2997b0..0881ac19c0f9 100644 --- a/include/linux/sunrpc/cache.h +++ b/include/linux/sunrpc/cache.h @@ -15,6 +15,7 @@ #include <linux/slab.h> #include <linux/atomic.h> #include <linux/proc_fs.h> +#include <linux/kabi.h>
/* * Each cache requires: @@ -118,6 +119,9 @@ struct cache_detail { struct dentry *pipefs; }; struct net *net; + + KABI_RESERVE(1) + KABI_RESERVE(2) };
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index 02e7a5863d28..a28300e18fe3 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h @@ -27,6 +27,7 @@ #include <linux/path.h> #include <net/ipv6.h> #include <linux/sunrpc/xprtmultipath.h> +#include <linux/kabi.h>
struct rpc_inode;
@@ -79,6 +80,11 @@ struct rpc_clnt { struct work_struct cl_work; }; const struct cred *cl_cred; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
/* @@ -92,6 +98,8 @@ struct rpc_program { const struct rpc_version ** version; /* version array */ struct rpc_stat * stats; /* statistics */ const char * pipe_dir_name; /* path to rpc_pipefs dir */ + + KABI_RESERVE(1) };
struct rpc_version { @@ -133,6 +141,8 @@ struct rpc_create_args { char *client_name; struct svc_xprt *bc_xprt; /* NFSv4.1 backchannel */ const struct cred *cred; + + KABI_RESERVE(1) };
struct rpc_add_xprt_test { diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h index df696efdd675..4344151db807 100644 --- a/include/linux/sunrpc/sched.h +++ b/include/linux/sunrpc/sched.h @@ -17,6 +17,7 @@ #include <linux/wait_bit.h> #include <linux/workqueue.h> #include <linux/sunrpc/xdr.h> +#include <linux/kabi.h>
/* * This is the actual RPC procedure call info. @@ -27,6 +28,8 @@ struct rpc_message { void * rpc_argp; /* Arguments */ void * rpc_resp; /* Result */ const struct cred * rpc_cred; /* Credentials */ + + KABI_RESERVE(1) };
struct rpc_call_ops; @@ -92,6 +95,11 @@ struct rpc_task { tk_garb_retry : 2, tk_cred_retry : 2, tk_rebind_retry : 2; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
typedef void (*rpc_action)(struct rpc_task *); @@ -101,6 +109,9 @@ struct rpc_call_ops { void (*rpc_call_done)(struct rpc_task *, void *); void (*rpc_count_stats)(struct rpc_task *, void *); void (*rpc_release)(void *); + + KABI_RESERVE(1) + KABI_RESERVE(2) };
struct rpc_task_setup { @@ -114,6 +125,9 @@ struct rpc_task_setup { struct workqueue_struct *workqueue; unsigned short flags; signed char priority; + + KABI_RESERVE(1) + KABI_RESERVE(2) };
/* diff --git a/include/linux/sunrpc/stats.h b/include/linux/sunrpc/stats.h index d94d4f410507..52aa43d261e7 100644 --- a/include/linux/sunrpc/stats.h +++ b/include/linux/sunrpc/stats.h @@ -11,6 +11,7 @@ #define _LINUX_SUNRPC_STATS_H
#include <linux/proc_fs.h> +#include <linux/kabi.h>
struct rpc_stat { const struct rpc_program *program; @@ -24,6 +25,8 @@ struct rpc_stat { rpcretrans, rpcauthrefresh, rpcgarbage; + + KABI_RESERVE(1) };
struct svc_stat { @@ -37,6 +40,8 @@ struct svc_stat { rpcbadfmt, rpcbadauth, rpcbadclnt; + + KABI_RESERVE(1) };
struct net; diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h index e7b997d6f031..39dc06a6f10e 100644 --- a/include/linux/sunrpc/xprt.h +++ b/include/linux/sunrpc/xprt.h @@ -18,6 +18,7 @@ #include <linux/sunrpc/sched.h> #include <linux/sunrpc/xdr.h> #include <linux/sunrpc/msg_prot.h> +#include <linux/kabi.h>
#define RPC_MIN_SLOT_TABLE (2U) #define RPC_DEF_SLOT_TABLE (16U) @@ -39,6 +40,9 @@ struct rpc_timeout { to_increment; /* if !exponential */ unsigned int to_retries; /* max # of retries */ unsigned char to_exponential; + + KABI_RESERVE(1) + KABI_RESERVE(2) };
enum rpc_display_format_t { @@ -124,6 +128,11 @@ struct rpc_rqst { unsigned long rq_bc_pa_state; /* Backchannel prealloc state */ struct list_head rq_bc_pa_list; /* Backchannel prealloc list */ #endif /* CONFIG_SUNRPC_BACKCHANEL */ + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) }; #define rq_svec rq_snd_buf.head #define rq_slen rq_snd_buf.len @@ -287,6 +296,11 @@ struct rpc_xprt { atomic_t inject_disconnect; #endif struct rcu_head rcu; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
#if defined(CONFIG_SUNRPC_BACKCHANNEL) @@ -322,6 +336,9 @@ struct xprt_create { struct svc_xprt *bc_xprt; /* NFSv4.1 backchannel */ struct rpc_xprt_switch *bc_xps; unsigned int flags; + + KABI_RESERVE(1) + KABI_RESERVE(2) };
struct xprt_class {
From: Wang Hai wanghai38@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4HE7P?from=project-issue CVE: NA
--------
Reserve some fields beforehand for net rdma framework related structures prone to change.
---------
Signed-off-by: Wang Hai wanghai38@huawei.com Reviewed-by: Wei Yongjun weiyongjun1@huawei.com Reviewed-by: Yue Haibing yuehaibing@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/rdma/ib_addr.h | 3 +++ include/rdma/rdma_cm.h | 8 ++++++++ include/rdma/rdma_counter.h | 3 +++ include/rdma/rdma_netlink.h | 4 ++++ include/rdma/rdma_vt.h | 6 ++++++ include/rdma/rdmavt_qp.h | 5 +++++ 6 files changed, 29 insertions(+)
diff --git a/include/rdma/ib_addr.h b/include/rdma/ib_addr.h index b0e636ac6690..f315a3dce9e7 100644 --- a/include/rdma/ib_addr.h +++ b/include/rdma/ib_addr.h @@ -20,6 +20,7 @@ #include <rdma/ib_verbs.h> #include <rdma/ib_pack.h> #include <net/net_namespace.h> +#include <linux/kabi.h>
/** * struct rdma_dev_addr - Contains resolved RDMA hardware addresses @@ -43,6 +44,8 @@ struct rdma_dev_addr { const struct ib_gid_attr *sgid_attr; enum rdma_network_type network; int hoplimit; + + KABI_RESERVE(1) };
/** diff --git a/include/rdma/rdma_cm.h b/include/rdma/rdma_cm.h index 32a67af18415..4d703c848214 100644 --- a/include/rdma/rdma_cm.h +++ b/include/rdma/rdma_cm.h @@ -12,6 +12,7 @@ #include <rdma/ib_addr.h> #include <rdma/ib_sa.h> #include <uapi/rdma/rdma_user_cm.h> +#include <linux/kabi.h>
/* * Upon receiving a device removal event, users must destroy the associated @@ -67,6 +68,9 @@ struct rdma_conn_param { u8 srq; u32 qp_num; u32 qkey; + + KABI_RESERVE(1) + KABI_RESERVE(2) };
struct rdma_ud_param { @@ -85,6 +89,8 @@ struct rdma_cm_event { struct rdma_ud_param ud; } param; struct rdma_ucm_ece ece; + + KABI_RESERVE(1) };
struct rdma_cm_id; @@ -108,6 +114,8 @@ struct rdma_cm_id { enum rdma_ucm_port_space ps; enum ib_qp_type qp_type; u8 port_num; + + KABI_RESERVE(1) };
struct rdma_cm_id * diff --git a/include/rdma/rdma_counter.h b/include/rdma/rdma_counter.h index eb99856e8b30..74ee0392b238 100644 --- a/include/rdma/rdma_counter.h +++ b/include/rdma/rdma_counter.h @@ -11,6 +11,7 @@
#include <rdma/restrack.h> #include <rdma/rdma_netlink.h> +#include <linux/kabi.h>
struct ib_device; struct ib_qp; @@ -41,6 +42,8 @@ struct rdma_counter { struct mutex lock; struct rdma_hw_stats *stats; u8 port; + + KABI_RESERVE(1) };
void rdma_counter_init(struct ib_device *dev); diff --git a/include/rdma/rdma_netlink.h b/include/rdma/rdma_netlink.h index 2758d9df71ee..f8b3be61a841 100644 --- a/include/rdma/rdma_netlink.h +++ b/include/rdma/rdma_netlink.h @@ -5,6 +5,7 @@
#include <linux/netlink.h> #include <uapi/rdma/rdma_netlink.h> +#include <linux/kabi.h>
enum { RDMA_NLDEV_ATTR_EMPTY_STRING = 1, @@ -114,6 +115,9 @@ struct rdma_link_ops { struct list_head list; const char *type; int (*newlink)(const char *ibdev_name, struct net_device *ndev); + + KABI_RESERVE(1) + KABI_RESERVE(2) };
void rdma_link_register(struct rdma_link_ops *ops); diff --git a/include/rdma/rdma_vt.h b/include/rdma/rdma_vt.h index 9fd217b24916..5717236f1127 100644 --- a/include/rdma/rdma_vt.h +++ b/include/rdma/rdma_vt.h @@ -17,6 +17,7 @@ #include <rdma/ib_verbs.h> #include <rdma/ib_mad.h> #include <rdma/rdmavt_mr.h> +#include <linux/kabi.h>
#define RVT_MAX_PKEY_VALUES 16
@@ -105,6 +106,8 @@ struct rvt_ibport { */ struct trap_list trap_lists[RVT_MAX_TRAP_LISTS]; struct timer_list trap_timer; + + KABI_RESERVE(1) };
#define RVT_CQN_MAX 16 /* maximum length of cq name */ @@ -426,6 +429,9 @@ struct rvt_dev_info {
/* Memory Working Set Size */ struct rvt_wss *wss; + + KABI_RESERVE(1) + KABI_RESERVE(2) };
/** diff --git a/include/rdma/rdmavt_qp.h b/include/rdma/rdmavt_qp.h index 8275954f5ce6..5a58e7836780 100644 --- a/include/rdma/rdmavt_qp.h +++ b/include/rdma/rdmavt_qp.h @@ -11,6 +11,7 @@ #include <rdma/ib_verbs.h> #include <rdma/rdmavt_cq.h> #include <rdma/rvt-abi.h> +#include <linux/kabi.h> /* * Atomic bit definitions for r_aflags. */ @@ -441,6 +442,10 @@ struct rvt_qp {
atomic_t local_ops_pending; /* number of fast_reg/local_inv reqs */
+ + KABI_RESERVE(1) + KABI_RESERVE(2) + /* * This sge list MUST be last. Do not add anything below here. */
From: Wang Hai wanghai38@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4HE7P?from=project-issue CVE: NA
--------
Reserve some fields beforehand for net bpf framework related structures prone to change.
---------
Signed-off-by: Wang Hai wanghai38@huawei.com Reviewed-by: Wei Yongjun weiyongjun1@huawei.com Reviewed-by: Yue Haibing yuehaibing@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/skmsg.h | 11 +++++++++++ include/net/tcp.h | 6 ++++++ include/net/xdp.h | 6 ++++++ 3 files changed, 23 insertions(+)
diff --git a/include/linux/skmsg.h b/include/linux/skmsg.h index 822c048934e3..23d4e86a4395 100644 --- a/include/linux/skmsg.h +++ b/include/linux/skmsg.h @@ -12,6 +12,7 @@ #include <net/sock.h> #include <net/tcp.h> #include <net/strparser.h> +#include <linux/kabi.h>
#define MAX_MSG_FRAGS MAX_SKB_FRAGS #define NR_MSG_FRAG_IDS (MAX_MSG_FRAGS + 1) @@ -58,6 +59,11 @@ struct sk_psock_progs { struct bpf_prog *msg_parser; struct bpf_prog *skb_parser; struct bpf_prog *skb_verdict; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
enum sk_psock_state_bits { @@ -107,6 +113,11 @@ struct sk_psock { struct rcu_head rcu; struct work_struct gc; }; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
int sk_msg_alloc(struct sock *sk, struct sk_msg *msg, int len, diff --git a/include/net/tcp.h b/include/net/tcp.h index 334b8d1b5442..bbd8fb63f4c1 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -45,6 +45,7 @@ #include <linux/memcontrol.h> #include <linux/bpf-cgroup.h> #include <linux/siphash.h> +#include <linux/kabi.h>
extern struct inet_hashinfo tcp_hashinfo;
@@ -1084,6 +1085,11 @@ struct tcp_congestion_ops {
char name[TCP_CA_NAME_MAX]; struct module *owner; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
int tcp_register_congestion_control(struct tcp_congestion_ops *type); diff --git a/include/net/xdp.h b/include/net/xdp.h index 9dab2bc6f187..c7a2fadb9ba8 100644 --- a/include/net/xdp.h +++ b/include/net/xdp.h @@ -7,6 +7,7 @@ #define __LINUX_NET_XDP_H__
#include <linux/skbuff.h> /* skb_shared_info */ +#include <linux/kabi.h>
/** * DOC: XDP RX-queue information @@ -59,6 +60,11 @@ struct xdp_rxq_info { u32 queue_index; u32 reg_state; struct xdp_mem_info mem; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) } ____cacheline_aligned; /* perf critical, avoid false-sharing */
struct xdp_txq_info {
From: Wang Hai wanghai38@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4HE7P?from=project-issue CVE: NA
--------
Reserve some fields beforehand for net netfilter framework related structures prone to change.
---------
Signed-off-by: Wang Hai wanghai38@huawei.com Reviewed-by: Wei Yongjun weiyongjun1@huawei.com Reviewed-by: Yue Haibing yuehaibing@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/netfilter.h | 9 +++++++++ include/linux/netfilter/ipset/ip_set.h | 7 +++++++ include/linux/netfilter/nfnetlink.h | 5 +++++ include/linux/netfilter_ipv6.h | 3 +++ include/net/netfilter/nf_conntrack.h | 4 ++++ include/net/netns/netfilter.h | 3 +++ 6 files changed, 31 insertions(+)
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h index 0101747de549..a1a7ab244fdb 100644 --- a/include/linux/netfilter.h +++ b/include/linux/netfilter.h @@ -15,6 +15,7 @@ #include <linux/netdevice.h> #include <linux/sockptr.h> #include <net/net_namespace.h> +#include <linux/kabi.h>
static inline int NF_DROP_GETERR(int verdict) { @@ -171,6 +172,8 @@ struct nf_sockopt_ops { int (*get)(struct sock *sk, int optval, void __user *user, int *len); /* Use the module struct to lock set/get code in place */ struct module *owner; + + KABI_RESERVE(1) };
/* Function to register/unregister hook points. */ @@ -373,6 +376,8 @@ struct nf_nat_hook { unsigned int (*manip_pkt)(struct sk_buff *skb, struct nf_conn *ct, enum nf_nat_manip_type mtype, enum ip_conntrack_dir dir); + + KABI_RESERVE(1) };
extern struct nf_nat_hook __rcu *nf_nat_hook; @@ -457,6 +462,8 @@ struct nf_ct_hook { void (*destroy)(struct nf_conntrack *); bool (*get_tuple_skb)(struct nf_conntrack_tuple *, const struct sk_buff *); + + KABI_RESERVE(1) }; extern struct nf_ct_hook __rcu *nf_ct_hook;
@@ -474,6 +481,8 @@ struct nfnl_ct_hook { u32 portid, u32 report); void (*seq_adjust)(struct sk_buff *skb, struct nf_conn *ct, enum ip_conntrack_info ctinfo, s32 off); + + KABI_RESERVE(1) }; extern struct nfnl_ct_hook __rcu *nfnl_ct_hook;
diff --git a/include/linux/netfilter/ipset/ip_set.h b/include/linux/netfilter/ipset/ip_set.h index ab192720e2d6..8123503c4ac4 100644 --- a/include/linux/netfilter/ipset/ip_set.h +++ b/include/linux/netfilter/ipset/ip_set.h @@ -16,6 +16,7 @@ #include <linux/vmalloc.h> #include <net/netlink.h> #include <uapi/linux/netfilter/ipset/ip_set.h> +#include <linux/kabi.h>
#define _IP_SET_MODULE_DESC(a, b, c) \ MODULE_DESCRIPTION(a " type of IP sets, revisions " b "-" c) @@ -190,6 +191,8 @@ struct ip_set_type_variant { bool (*same_set)(const struct ip_set *a, const struct ip_set *b); /* Region-locking is used */ bool region_lock; + + KABI_RESERVE(1) };
struct ip_set_region { @@ -228,6 +231,8 @@ struct ip_set_type {
/* Set this to THIS_MODULE if you are a module, otherwise NULL */ struct module *me; + + KABI_RESERVE(1) };
/* register and unregister set type */ @@ -270,6 +275,8 @@ struct ip_set { size_t offset[IPSET_EXT_ID_MAX]; /* The type specific data */ void *data; + + KABI_RESERVE(1) };
static inline void diff --git a/include/linux/netfilter/nfnetlink.h b/include/linux/netfilter/nfnetlink.h index f6267e2883f2..90853fdaa971 100644 --- a/include/linux/netfilter/nfnetlink.h +++ b/include/linux/netfilter/nfnetlink.h @@ -6,6 +6,7 @@ #include <linux/capability.h> #include <net/netlink.h> #include <uapi/linux/netfilter/nfnetlink.h> +#include <linux/kabi.h>
struct nfnl_callback { int (*call)(struct net *net, struct sock *nl, struct sk_buff *skb, @@ -22,6 +23,8 @@ struct nfnl_callback { struct netlink_ext_ack *extack); const struct nla_policy *policy; /* netlink attribute policy */ const u_int16_t attr_count; /* number of nlattr's */ + + KABI_RESERVE(1) };
enum nfnl_abort_action { @@ -41,6 +44,8 @@ struct nfnetlink_subsystem { enum nfnl_abort_action action); void (*cleanup)(struct net *net); bool (*valid_genid)(struct net *net, u32 genid); + + KABI_RESERVE(1) };
int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n); diff --git a/include/linux/netfilter_ipv6.h b/include/linux/netfilter_ipv6.h index 48314ade1506..b1d0b6dee583 100644 --- a/include/linux/netfilter_ipv6.h +++ b/include/linux/netfilter_ipv6.h @@ -9,6 +9,7 @@
#include <uapi/linux/netfilter_ipv6.h> #include <net/tcp.h> +#include <linux/kabi.h>
/* Check for an extension */ static inline int @@ -65,6 +66,8 @@ struct nf_ipv6_ops { const struct nf_bridge_frag_data *data, struct sk_buff *)); #endif + + KABI_RESERVE(1) };
#ifdef CONFIG_NETFILTER diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index 439379ca9ffa..e37204d784cb 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h @@ -23,6 +23,7 @@ #include <linux/netfilter/nf_conntrack_proto_gre.h>
#include <net/netfilter/nf_conntrack_tuple.h> +#include <linux/kabi.h>
struct nf_ct_udp { unsigned long stream_ts; @@ -105,6 +106,9 @@ struct nf_conn {
/* Storage reserved for other modules, must be the last member */ union nf_conntrack_proto proto; + + KABI_RESERVE(1) + KABI_RESERVE(2) };
static inline struct nf_conn * diff --git a/include/net/netns/netfilter.h b/include/net/netns/netfilter.h index ca043342c0eb..1b01427a0d4a 100644 --- a/include/net/netns/netfilter.h +++ b/include/net/netns/netfilter.h @@ -3,6 +3,7 @@ #define __NETNS_NETFILTER_H
#include <linux/netfilter_defs.h> +#include <linux/kabi.h>
struct proc_dir_entry; struct nf_logger; @@ -34,5 +35,7 @@ struct netns_nf { #if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6) bool defrag_ipv6; #endif + + KABI_RESERVE(1) }; #endif
From: Yang Jihong yangjihong1@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4GFVG?from=project-issue CVE: NA
-------------------------------
Reserve space for the structures in perf subsystem.
Signed-off-by: Yang Jihong yangjihong1@huawei.com Reviewed-by: Kuohai Xu xukuohai@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/perf_event.h | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index c095e713cf08..5e50bd589394 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h @@ -57,6 +57,7 @@ struct perf_guest_info_callbacks { #include <linux/cgroup.h> #include <linux/refcount.h> #include <linux/security.h> +#include <linux/kabi.h> #include <asm/local.h>
struct perf_callchain_entry { @@ -513,6 +514,13 @@ struct pmu { * Check period value for PERF_EVENT_IOC_PERIOD ioctl. */ int (*check_period) (struct perf_event *event, u64 value); /* optional */ + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) };
enum perf_addr_filter_action_t {
From: Yang Yingliang yangyingliang@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4JBL0 CVE: NA
-------------------------------
Reserve space for struct cpu_stop_work. Changing this struct will affect set_cpus_allowed_ptr(), so reserve one kabi field.
Signed-off-by: Yang Yingliang yangyingliang@huawei.com Reviewed-by: Cheng Jian cj.chengjian@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/stop_machine.h | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/include/linux/stop_machine.h b/include/linux/stop_machine.h index 63ea9aff368f..08ec8e2fd9b2 100644 --- a/include/linux/stop_machine.h +++ b/include/linux/stop_machine.h @@ -6,6 +6,7 @@ #include <linux/cpumask.h> #include <linux/smp.h> #include <linux/list.h> +#include <linux/kabi.h>
/* * stop_cpu[s]() is simplistic per-cpu maximum priority cpu @@ -26,6 +27,7 @@ struct cpu_stop_work { cpu_stop_fn_t fn; void *arg; struct cpu_stop_done *done; + KABI_RESERVE(1) };
int stop_one_cpu(unsigned int cpu, cpu_stop_fn_t fn, void *arg);
From: Yang Yingliang yangyingliang@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4JBL0 CVE: NA
-------------------------------
Reserve space for struct dma_map_ops.
Signed-off-by: Yang Yingliang yangyingliang@huawei.com Reviewed-by: Xiongfeng Wang wangxiongfeng2@huawei.com Reviewed-by: Wei Li liwei391@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/dma-map-ops.h | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/include/linux/dma-map-ops.h b/include/linux/dma-map-ops.h index a5f89fc4d6df..bd82240dd0db 100644 --- a/include/linux/dma-map-ops.h +++ b/include/linux/dma-map-ops.h @@ -8,6 +8,7 @@
#include <linux/dma-mapping.h> #include <linux/pgtable.h> +#include <linux/kabi.h>
struct cma;
@@ -69,6 +70,12 @@ struct dma_map_ops { u64 (*get_required_mask)(struct device *dev); size_t (*max_mapping_size)(struct device *dev); unsigned long (*get_merge_boundary)(struct device *dev); + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) };
#ifdef CONFIG_DMA_OPS
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4JBL0 CVE: NA
------------------------------
Add KABI padding to the following cpuidle structures: struct cpuidle_state_usage struct cpuidle_state struct cpuidle_device struct cpuidle_driver
Changes in these structures will influence KABI compatibility of following interfaces: sched_setscheduler set_cpus_allowed_ptr set_user_nice wake_up_process
Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com Reviewed-by: Xiongfeng Wang wangxiongfeng2@huawei.com Reviewed-by: Cheng Jian cj.chengjian@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/cpuidle.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h index bd605b5585cf..12a94f3a957c 100644 --- a/include/linux/cpuidle.h +++ b/include/linux/cpuidle.h @@ -14,6 +14,7 @@ #include <linux/percpu.h> #include <linux/list.h> #include <linux/hrtimer.h> +#include <linux/kabi.h>
#define CPUIDLE_STATE_MAX 10 #define CPUIDLE_NAME_LEN 16 @@ -43,6 +44,10 @@ struct cpuidle_state_usage { unsigned long long s2idle_usage; unsigned long long s2idle_time; /* in US */ #endif + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
struct cpuidle_state { @@ -73,6 +78,10 @@ struct cpuidle_state { int (*enter_s2idle)(struct cpuidle_device *dev, struct cpuidle_driver *drv, int index); + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
/* Idle State Flags */ @@ -110,6 +119,10 @@ struct cpuidle_device { cpumask_t coupled_cpus; struct cpuidle_coupled *coupled; #endif + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
DECLARE_PER_CPU(struct cpuidle_device *, cpuidle_devices); @@ -135,6 +148,8 @@ struct cpuidle_driver {
/* preferred governor to switch at register time */ const char *governor; + KABI_RESERVE(1) + KABI_RESERVE(2) };
#ifdef CONFIG_CPU_IDLE
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4JBL0 CVE: NA
------------------------------
Although CONFIG_PARAVIRT_XXL is not enabled in openeuler_defconfig, we add KABI padding to the following x86/paravirt ops structures in advance for potential kabi break:
pv_irq_ops pv_mmu_ops pv_lock_ops
Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com Reviewed-by: Yang Yingliang yangyingliang@huawei.com Reviewed-by: Wei Li liwei391@huawei.com Reviewed-by: Cheng Jian cj.chengjian@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- arch/x86/include/asm/paravirt_types.h | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/arch/x86/include/asm/paravirt_types.h b/arch/x86/include/asm/paravirt_types.h index ab4f17eb1cb2..98eb135b1888 100644 --- a/arch/x86/include/asm/paravirt_types.h +++ b/arch/x86/include/asm/paravirt_types.h @@ -194,6 +194,9 @@ struct pv_irq_ops {
void (*safe_halt)(void); void (*halt)(void); + + KABI_RESERVE(1) + KABI_RESERVE(2) #endif } __no_randomize_layout;
@@ -280,6 +283,10 @@ struct pv_mmu_ops { an mfn. We can tell which is which from the index. */ void (*set_fixmap)(unsigned /* enum fixed_addresses */ idx, phys_addr_t phys, pgprot_t flags); + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) #endif } __no_randomize_layout;
@@ -298,6 +305,8 @@ struct pv_lock_ops { void (*kick)(int cpu);
struct paravirt_callee_save vcpu_is_preempted; + + KABI_RESERVE(1) } __no_randomize_layout;
/* This contains all the paravirt structures: we get a convenient
From: Wang ShaoBo bobo.shaobowang@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4KFY7?from=project-issue CVE: NA
-------------------------------
Reserve space for the structures in io subsystem.
Signed-off-by: Wang ShaoBo bobo.shaobowang@huawei.com Reviewed-by: Cheng Jian cj.chengjian@huawei.com Reviewed-by: Cheng Jian cj.chengjian@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/ioport.h | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/include/linux/ioport.h b/include/linux/ioport.h index eee569900c7d..3930f564f207 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h @@ -13,6 +13,7 @@ #include <linux/compiler.h> #include <linux/types.h> #include <linux/bits.h> +#include <linux/kabi.h> /* * Resources are tree-like, allowing * nesting etc.. @@ -24,6 +25,10 @@ struct resource { unsigned long flags; unsigned long desc; struct resource *parent, *sibling, *child; + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
/*
From: Wang ShaoBo bobo.shaobowang@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4KFY7?from=project-issue CVE: NA
-------------------------------
Reserve space for the structures in kobject subsystem.
Signed-off-by: Wang ShaoBo bobo.shaobowang@huawei.com Reviewed-by: Cheng Jian cj.chengjian@huawei.com Reviewed-by: Cheng Jian cj.chengjian@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/kobject.h | 13 +++++++++++++ 1 file changed, 13 insertions(+)
diff --git a/include/linux/kobject.h b/include/linux/kobject.h index ea30529fba08..f3c9ecb71642 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h @@ -15,6 +15,7 @@ #ifndef _KOBJECT_H_ #define _KOBJECT_H_
+#include <linux/kabi.h> #include <linux/types.h> #include <linux/list.h> #include <linux/sysfs.h> @@ -77,6 +78,10 @@ struct kobject { unsigned int state_add_uevent_sent:1; unsigned int state_remove_uevent_sent:1; unsigned int uevent_suppress:1; + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
extern __printf(2, 3) @@ -143,6 +148,10 @@ struct kobj_type { const struct kobj_ns_type_operations *(*child_ns_type)(struct kobject *kobj); const void *(*namespace)(struct kobject *kobj); void (*get_ownership)(struct kobject *kobj, kuid_t *uid, kgid_t *gid); + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
struct kobj_uevent_env { @@ -194,6 +203,10 @@ struct kset { spinlock_t list_lock; struct kobject kobj; const struct kset_uevent_ops *uevent_ops; + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) } __randomize_layout;
extern void kset_init(struct kset *kset);
From: Wang ShaoBo bobo.shaobowang@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4KFY7?from=project-issue CVE: NA
-------------------------------
Reserve space for struct module.
Signed-off-by: Wang ShaoBo bobo.shaobowang@huawei.com Reviewed-by: Cheng Jian cj.chengjian@huawei.com Reviewed-by: Cheng Jian cj.chengjian@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/module.h | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/include/linux/module.h b/include/linux/module.h index d7c6792d705b..54cdd20fc3de 100644 --- a/include/linux/module.h +++ b/include/linux/module.h @@ -553,6 +553,10 @@ struct module { struct error_injection_entry *ei_funcs; unsigned int num_ei_funcs; #endif + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) } ____cacheline_aligned __randomize_layout; #ifndef MODULE_ARCH_INIT #define MODULE_ARCH_INIT {}
From: Wang ShaoBo bobo.shaobowang@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4KFY7?from=project-issue CVE: NA
-------------------------------
reserve space for struct ptp_clock.
Signed-off-by: Wang ShaoBo bobo.shaobowang@huawei.com Reviewed-by: Cheng Jian cj.chengjian@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- drivers/ptp/ptp_private.h | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/drivers/ptp/ptp_private.h b/drivers/ptp/ptp_private.h index 6b97155148f1..4200f42a05b1 100644 --- a/drivers/ptp/ptp_private.h +++ b/drivers/ptp/ptp_private.h @@ -46,6 +46,10 @@ struct ptp_clock { const struct attribute_group *pin_attr_groups[2]; struct kthread_worker *kworker; struct kthread_delayed_work aux_work; + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
/*
From: Wang ShaoBo bobo.shaobowang@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4KFY7?from=project-issue CVE: NA
-------------------------------
reserve space for struct ptp_clock_info.
Signed-off-by: Wang ShaoBo bobo.shaobowang@huawei.com Reviewed-by: Cheng Jian cj.chengjian@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/ptp_clock_kernel.h | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/include/linux/ptp_clock_kernel.h b/include/linux/ptp_clock_kernel.h index 6d6b42143eff..17a7a6d0861a 100644 --- a/include/linux/ptp_clock_kernel.h +++ b/include/linux/ptp_clock_kernel.h @@ -144,6 +144,10 @@ struct ptp_clock_info { int (*verify)(struct ptp_clock_info *ptp, unsigned int pin, enum ptp_pin_function func, unsigned int chan); long (*do_aux_work)(struct ptp_clock_info *ptp); + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
struct ptp_clock;
From: Wang ShaoBo bobo.shaobowang@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4KFY7?from=project-issue CVE: NA
-------------------------------
reserve space for ptp_clock.h.
Signed-off-by: Wang ShaoBo bobo.shaobowang@huawei.com Reviewed-by: Cheng Jian cj.chengjian@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/uapi/linux/ptp_clock.h | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/include/uapi/linux/ptp_clock.h b/include/uapi/linux/ptp_clock.h index 1d108d597f66..5bd86524642d 100644 --- a/include/uapi/linux/ptp_clock.h +++ b/include/uapi/linux/ptp_clock.h @@ -132,6 +132,10 @@ struct ptp_perout_request { /* Reserved for future use. */ unsigned int rsv[4]; }; + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
#define PTP_MAX_SAMPLES 25 /* Maximum allowed offset measurement samples. */
From: Wang ShaoBo bobo.shaobowang@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4KFY7?from=project-issue CVE: NA
-------------------------------
reserve space for struct iommu_domain and iommu_ops.
Signed-off-by: Wang ShaoBo bobo.shaobowang@huawei.com Reviewed-by: Zhen Lei thunder.leizhen@huawei.com Reviewed-by: Cheng Jian cj.chengjian@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/iommu.h | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/include/linux/iommu.h b/include/linux/iommu.h index ed12f5cac0b4..591a6c5d2ddf 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -89,6 +89,10 @@ struct iommu_domain { void *iova_cookie; bool dirty_log_tracking; struct mutex switch_log_lock; + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
enum iommu_cap { @@ -353,6 +357,14 @@ struct iommu_ops {
unsigned long pgsize_bitmap; struct module *owner; + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) + KABI_RESERVE(7) + KABI_RESERVE(8) };
/**
From: Wang ShaoBo bobo.shaobowang@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4KFY7?from=project-issue CVE: NA
-------------------------------
reserve space for struct fwnode_handle and fwnode_operations.
Signed-off-by: Wang ShaoBo bobo.shaobowang@huawei.com Reviewed-by: Cheng Jian cj.chengjian@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/fwnode.h | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/include/linux/fwnode.h b/include/linux/fwnode.h index 9506f8ec0974..06eeb7266401 100644 --- a/include/linux/fwnode.h +++ b/include/linux/fwnode.h @@ -10,6 +10,7 @@ #define _LINUX_FWNODE_H_
#include <linux/types.h> +#include <linux/kabi.h>
struct fwnode_operations; struct device; @@ -18,6 +19,8 @@ struct fwnode_handle { struct fwnode_handle *secondary; const struct fwnode_operations *ops; struct device *dev; + KABI_RESERVE(1) + KABI_RESERVE(2) };
/** @@ -147,6 +150,10 @@ struct fwnode_operations { struct fwnode_endpoint *endpoint); int (*add_links)(const struct fwnode_handle *fwnode, struct device *dev); + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
#define fwnode_has_op(fwnode, op) \
From: Alexey Gladkov legion@kernel.org
mainline inclusion from mainline-v5.14-rc1 commit f9c82a4ea89c384d49ce03768ba88d049ed3f1f0 category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4MYYH CVE: N/A
-----------------------------------------
RLIMIT_MSGQUEUE and RLIMIT_MEMLOCK use unsigned long to store their counters. As a preparation for moving rlimits based on ucounts, we need to increase the size of the variable to long.
Signed-off-by: Alexey Gladkov legion@kernel.org Link: https://lkml.kernel.org/r/257aa5fb1a7d81cf0f4c34f39ada2320c4284771.161909442... Signed-off-by: Eric W. Biederman ebiederm@xmission.com Signed-off-by: GONG, Ruiqi gongruiqi1@huawei.com Reviewed-by: Xiu Jianfeng xiujianfeng@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/user_namespace.h | 4 ++-- kernel/ucount.c | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h index 7616c7bf4b24..ea2f4dc95445 100644 --- a/include/linux/user_namespace.h +++ b/include/linux/user_namespace.h @@ -89,7 +89,7 @@ struct user_namespace { struct ctl_table_header *sysctls; #endif struct ucounts *ucounts; - int ucount_max[UCOUNT_COUNTS]; + long ucount_max[UCOUNT_COUNTS]; } __randomize_layout;
struct ucounts { @@ -97,7 +97,7 @@ struct ucounts { struct user_namespace *ns; kuid_t uid; int count; - atomic_t ucount[UCOUNT_COUNTS]; + atomic_long_t ucount[UCOUNT_COUNTS]; };
extern struct user_namespace init_user_ns; diff --git a/kernel/ucount.c b/kernel/ucount.c index 11b1596e2542..04c561751af1 100644 --- a/kernel/ucount.c +++ b/kernel/ucount.c @@ -175,14 +175,14 @@ static void put_ucounts(struct ucounts *ucounts) kfree(ucounts); }
-static inline bool atomic_inc_below(atomic_t *v, int u) +static inline bool atomic_long_inc_below(atomic_long_t *v, int u) { - int c, old; - c = atomic_read(v); + long c, old; + c = atomic_long_read(v); for (;;) { if (unlikely(c >= u)) return false; - old = atomic_cmpxchg(v, c, c+1); + old = atomic_long_cmpxchg(v, c, c+1); if (likely(old == c)) return true; c = old; @@ -196,17 +196,17 @@ struct ucounts *inc_ucount(struct user_namespace *ns, kuid_t uid, struct user_namespace *tns; ucounts = get_ucounts(ns, uid); for (iter = ucounts; iter; iter = tns->ucounts) { - int max; + long max; tns = iter->ns; max = READ_ONCE(tns->ucount_max[type]); - if (!atomic_inc_below(&iter->ucount[type], max)) + if (!atomic_long_inc_below(&iter->ucount[type], max)) goto fail; } return ucounts; fail: bad = iter; for (iter = ucounts; iter != bad; iter = iter->ns->ucounts) - atomic_dec(&iter->ucount[type]); + atomic_long_dec(&iter->ucount[type]);
put_ucounts(ucounts); return NULL; @@ -216,7 +216,7 @@ void dec_ucount(struct ucounts *ucounts, enum ucount_type type) { struct ucounts *iter; for (iter = ucounts; iter; iter = iter->ns->ucounts) { - int dec = atomic_dec_if_positive(&iter->ucount[type]); + long dec = atomic_long_dec_if_positive(&iter->ucount[type]); WARN_ON_ONCE(dec < 0); } put_ucounts(ucounts);
From: "GONG, Ruiqi" gongruiqi1@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4MYYH CVE: N/A
-----------------------
Reserve space in struct cred and struct user_namespace in advance to prepare for merging a promising new feature [1] from kernel 5.14 and some others in the future.
[1]: https://lkml.kernel.org/r/94d1dbecab060a6b116b0a2d1accd8ca1bbb4f5f.161909442...
Signed-off-by: GONG, Ruiqi gongruiqi1@huawei.com Reviewed-by: Xiu Jianfeng xiujianfeng@huawei.com Reviewed-by: weiyang wang wangweiyang2@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/cred.h | 2 ++ include/linux/user_namespace.h | 20 ++++++++++++++++++++ kernel/ucount.c | 16 ++++++++++++++++ 3 files changed, 38 insertions(+)
diff --git a/include/linux/cred.h b/include/linux/cred.h index 18639c069263..280e86c4d768 100644 --- a/include/linux/cred.h +++ b/include/linux/cred.h @@ -15,6 +15,7 @@ #include <linux/uidgid.h> #include <linux/sched.h> #include <linux/sched/user.h> +#include <linux/kabi.h>
struct cred; struct inode; @@ -150,6 +151,7 @@ struct cred { int non_rcu; /* Can we skip RCU deletion? */ struct rcu_head rcu; /* RCU deletion hook */ }; + KABI_RESERVE(1) /* reserved for ucounts */ } __randomize_layout;
extern void __put_cred(struct cred *); diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h index ea2f4dc95445..d7d02654a49e 100644 --- a/include/linux/user_namespace.h +++ b/include/linux/user_namespace.h @@ -50,6 +50,26 @@ enum ucount_type { UCOUNT_INOTIFY_INSTANCES, UCOUNT_INOTIFY_WATCHES, #endif + /* These 15 members are reserved (with extra margin) for the future + * enlargement of enum ucount_type, as how RH8.1 did it. This number + * should be enough, as 6 of them are very likely to be used in the near + * future. + */ + UCOUNT_KABI_RESERVE1, + UCOUNT_KABI_RESERVE2, + UCOUNT_KABI_RESERVE3, + UCOUNT_KABI_RESERVE4, + UCOUNT_KABI_RESERVE5, + UCOUNT_KABI_RESERVE6, + UCOUNT_KABI_RESERVE7, + UCOUNT_KABI_RESERVE8, + UCOUNT_KABI_RESERVE9, + UCOUNT_KABI_RESERVE10, + UCOUNT_KABI_RESERVE11, + UCOUNT_KABI_RESERVE12, + UCOUNT_KABI_RESERVE13, + UCOUNT_KABI_RESERVE14, + UCOUNT_KABI_RESERVE15, UCOUNT_COUNTS, };
diff --git a/kernel/ucount.c b/kernel/ucount.c index 04c561751af1..dff1d9b739d2 100644 --- a/kernel/ucount.c +++ b/kernel/ucount.c @@ -74,6 +74,22 @@ static struct ctl_table user_table[] = { UCOUNT_ENTRY("max_inotify_instances"), UCOUNT_ENTRY("max_inotify_watches"), #endif + /* These corresponds to the reservation in enum ucount_type */ + { }, // UCOUNT_KABI_RESERVE1 + { }, // UCOUNT_KABI_RESERVE2 + { }, // UCOUNT_KABI_RESERVE3 + { }, // UCOUNT_KABI_RESERVE4 + { }, // UCOUNT_KABI_RESERVE5 + { }, // UCOUNT_KABI_RESERVE6 + { }, // UCOUNT_KABI_RESERVE7 + { }, // UCOUNT_KABI_RESERVE8 + { }, // UCOUNT_KABI_RESERVE9 + { }, // UCOUNT_KABI_RESERVE10 + { }, // UCOUNT_KABI_RESERVE11 + { }, // UCOUNT_KABI_RESERVE12 + { }, // UCOUNT_KABI_RESERVE13 + { }, // UCOUNT_KABI_RESERVE14 + { }, // UCOUNT_KABI_RESERVE15 { } }; #endif /* CONFIG_SYSCTL */
From: Guo Zihua guozihua@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4GK6B CVE: NA ---------------------------
Reserving some fields for future IMA IPE development.
Signed-off-by: Guo Zihua guozihua@huawei.com Reviewed-by: weiyang wang wangweiyang2@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/blk_types.h | 2 ++ include/linux/lsm_hooks.h | 2 ++ 2 files changed, 4 insertions(+)
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index d9b69bbde5cc..f33725f03525 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h @@ -9,6 +9,7 @@ #include <linux/types.h> #include <linux/bvec.h> #include <linux/ktime.h> +#include <linux/kabi.h>
struct bio_set; struct bio; @@ -46,6 +47,7 @@ struct block_device { int bd_fsfreeze_count; /* Mutex for freeze */ struct mutex bd_fsfreeze_mutex; + KABI_RESERVE(1) } __randomize_layout;
/* diff --git a/include/linux/lsm_hooks.h b/include/linux/lsm_hooks.h index a8531b37e6f5..4d49255a0921 100644 --- a/include/linux/lsm_hooks.h +++ b/include/linux/lsm_hooks.h @@ -28,6 +28,7 @@ #include <linux/security.h> #include <linux/init.h> #include <linux/rculist.h> +#include <linux/kabi.h>
/** * union security_list_options - Linux Security Module hook function list @@ -1566,6 +1567,7 @@ struct lsm_blob_sizes { int lbs_ipc; int lbs_msg_msg; int lbs_task; + KABI_RESERVE(1) };
/*
From: Guan Jing guanjing6@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4KAP1?from=project-issue CVE: NA
-------- We reserve some fields beforehand for sched structures prone to change, therefore, we can hot add/change features of sched with this enhancement. After reserving, normally cache does not matter as the reserved fields are not accessed at all.
Signed-off-by: Guan Jing guanjing6@huawei.com Reviewed-by: Chen Hui judy.chenhui@huawei.com Reviewed-by: Cheng Jian cj.chengjian@huawei.com Reviewed-by: Cheng Jian cj.chengjian@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/delayacct.h | 4 ++++ include/linux/sched.h | 30 ++++++++++++++++++++++++++++++ include/linux/sched/signal.h | 6 ++++++ include/linux/sched/topology.h | 4 ++++ include/linux/sched/user.h | 4 ++++ kernel/sched/sched.h | 18 ++++++++++++++++++ 6 files changed, 66 insertions(+)
diff --git a/include/linux/delayacct.h b/include/linux/delayacct.h index 2d3bdcccf5eb..6c45a14c3eb2 100644 --- a/include/linux/delayacct.h +++ b/include/linux/delayacct.h @@ -8,6 +8,7 @@ #define _LINUX_DELAYACCT_H
#include <uapi/linux/taskstats.h> +#include <linux/kabi.h>
/* * Per-task flags relevant to delay accounting @@ -53,6 +54,9 @@ struct task_delay_info {
u32 freepages_count; /* total count of memory reclaim */ u32 thrashing_count; /* total count of thrash waits */ + + KABI_RESERVE(1) + KABI_RESERVE(2) }; #endif
diff --git a/include/linux/sched.h b/include/linux/sched.h index d0312bdc00a0..3bc2f15df252 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -35,6 +35,7 @@ #include <linux/seqlock.h> #include <linux/kcsan.h> #include <linux/thread_bits.h> +#include <linux/kabi.h>
/* task_struct member predeclarations (sorted alphabetically): */ struct audit_context; @@ -307,6 +308,10 @@ struct sched_info { /* When were we last queued to run? */ unsigned long long last_queued;
+ KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) #endif /* CONFIG_SCHED_INFO */ };
@@ -455,6 +460,11 @@ struct sched_statistics { u64 nr_wakeups_affine_attempts; u64 nr_wakeups_passive; u64 nr_wakeups_idle; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) #endif };
@@ -494,6 +504,11 @@ struct sched_entity { */ struct sched_avg avg; #endif + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
struct sched_rt_entity { @@ -512,6 +527,9 @@ struct sched_rt_entity { /* rq "owned" by this entity/group: */ struct rt_rq *my_q; #endif + + KABI_RESERVE(1) + KABI_RESERVE(2) } __randomize_layout;
struct sched_dl_entity { @@ -589,6 +607,9 @@ struct sched_dl_entity { */ struct sched_dl_entity *pi_se; #endif + + KABI_RESERVE(1) + KABI_RESERVE(2) };
#ifdef CONFIG_UCLAMP_TASK @@ -1369,6 +1390,15 @@ struct task_struct { */ randomized_struct_fields_end
+ KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) + KABI_RESERVE(7) + KABI_RESERVE(8) + /* CPU-specific state of this task: */ struct thread_struct thread;
diff --git a/include/linux/sched/signal.h b/include/linux/sched/signal.h index 657640015b33..940be421d263 100644 --- a/include/linux/sched/signal.h +++ b/include/linux/sched/signal.h @@ -12,6 +12,7 @@ #include <linux/posix-timers.h> #include <linux/mm_types.h> #include <asm/ptrace.h> +#include <linux/kabi.h>
/* * Types defining task->signal and task->sighand and APIs using them: @@ -235,6 +236,11 @@ struct signal_struct { * and may have inconsistent * permissions. */ + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) } __randomize_layout;
/* diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h index a80826bfef44..bff39305271d 100644 --- a/include/linux/sched/topology.h +++ b/include/linux/sched/topology.h @@ -5,6 +5,7 @@ #include <linux/topology.h>
#include <linux/sched/idle.h> +#include <linux/kabi.h>
/* * sched-domains (multiprocessor balancing) declarations: @@ -152,6 +153,9 @@ struct sched_domain { }; struct sched_domain_shared *shared;
+ KABI_RESERVE(1) + KABI_RESERVE(2) + unsigned int span_weight; /* * Span of all CPUs in this domain. diff --git a/include/linux/sched/user.h b/include/linux/sched/user.h index a8ec3b6093fc..98cc770a9d2c 100644 --- a/include/linux/sched/user.h +++ b/include/linux/sched/user.h @@ -6,6 +6,7 @@ #include <linux/atomic.h> #include <linux/refcount.h> #include <linux/ratelimit.h> +#include <linux/kabi.h>
/* * Some day this will be a full-fledged user tracking system.. @@ -42,6 +43,9 @@ struct user_struct {
/* Miscellaneous per-user rate limit */ struct ratelimit_state ratelimit; + + KABI_RESERVE(1) + KABI_RESERVE(2) };
extern int uids_sysfs_init(void); diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index ca7572c052f8..451440e36318 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -384,6 +384,8 @@ struct cfs_bandwidth { int nr_periods; int nr_throttled; u64 throttled_time; + + KABI_RESERVE(1) #endif };
@@ -618,6 +620,9 @@ struct cfs_rq { struct list_head throttled_list; #endif /* CONFIG_CFS_BANDWIDTH */ #endif /* CONFIG_FAIR_GROUP_SCHED */ + + KABI_RESERVE(1) + KABI_RESERVE(2) };
static inline int rt_bandwidth_enabled(void) @@ -843,6 +848,11 @@ struct root_domain { * CPUs of the rd. Protected by RCU. */ struct perf_domain __rcu *pd; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
extern void init_defrootdomain(void); @@ -1078,6 +1088,9 @@ struct rq { /* Must be inspected within a rcu lock section */ struct cpuidle_state *idle_state; #endif + + KABI_RESERVE(1) + KABI_RESERVE(2) };
#ifdef CONFIG_FAIR_GROUP_SCHED @@ -1519,6 +1532,8 @@ struct sched_group { struct sched_group_capacity *sgc; int asym_prefer_cpu; /* CPU of highest priority in group */
+ KABI_RESERVE(1) + KABI_RESERVE(2) /* * The CPUs this group covers. * @@ -1870,6 +1885,9 @@ struct sched_class { #ifdef CONFIG_FAIR_GROUP_SCHED void (*task_change_group)(struct task_struct *p, int type); #endif + + KABI_RESERVE(1) + KABI_RESERVE(2) } __aligned(STRUCT_ALIGNMENT); /* STRUCT_ALIGN(), vmlinux.lds.h */
static inline void put_prev_task(struct rq *rq, struct task_struct *prev)
From: Zhihao Cheng chengzhihao1@huawei.com
hulk inclusion category: feature bugzilla: 185747 https://gitee.com/openeuler/kernel/issues/I4OUFN CVE: NA
-------------------------------
Introduce kabi for storage module.
Signed-off-by: Zhihao Cheng chengzhihao1@huawei.com Reviewed-by: Jason Yan yanaijie@huawei.com Acked-by: Xie XiuQi xiexiuqi@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- block/blk-mq-tag.h | 7 +++++ drivers/nvme/host/nvme.h | 6 ++++ include/linux/backing-dev-defs.h | 11 +++++++ include/linux/bio.h | 10 +++++++ include/linux/blk-cgroup.h | 11 +++++++ include/linux/blk-mq.h | 30 +++++++++++++++++++ include/linux/blk_types.h | 10 +++++++ include/linux/blkdev.h | 16 +++++++++++ include/linux/cred.h | 12 +++++++- include/linux/dcache.h | 9 ++++++ include/linux/device.h | 9 ++++++ include/linux/device/class.h | 1 + include/linux/device/driver.h | 6 ++++ include/linux/elevator.h | 15 ++++++++++ include/linux/exportfs.h | 4 +++ include/linux/fs.h | 48 +++++++++++++++++++++++++++++++ include/linux/fsnotify_backend.h | 3 ++ include/linux/genhd.h | 14 +++++++++ include/linux/iomap.h | 6 ++++ include/linux/ioport.h | 1 + include/linux/jbd2.h | 6 ++++ include/linux/kernfs.h | 9 ++++++ include/linux/mm.h | 1 + include/linux/mount.h | 3 ++ include/linux/ns_common.h | 4 +++ include/linux/quota.h | 7 +++++ include/linux/sbitmap.h | 3 ++ include/linux/swap.h | 1 + include/linux/sysfs.h | 3 ++ include/linux/user_namespace.h | 12 ++++++++ include/linux/writeback.h | 4 +++ include/linux/xattr.h | 3 ++ include/scsi/scsi_cmnd.h | 6 ++++ include/scsi/scsi_device.h | 15 ++++++++++ include/scsi/scsi_host.h | 13 +++++++++ include/scsi/scsi_transport_fc.h | 25 ++++++++++++++++ include/target/target_core_base.h | 7 +++++ 37 files changed, 350 insertions(+), 1 deletion(-)
diff --git a/block/blk-mq-tag.h b/block/blk-mq-tag.h index f887988e5ef6..674b0d80f4d2 100644 --- a/block/blk-mq-tag.h +++ b/block/blk-mq-tag.h @@ -2,6 +2,8 @@ #ifndef INT_BLK_MQ_TAG_H #define INT_BLK_MQ_TAG_H
+#include <linux/kabi.h> + /* * Tag address space map. */ @@ -26,6 +28,11 @@ struct blk_mq_tags { * request pool */ spinlock_t lock; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
extern struct blk_mq_tags *blk_mq_init_tags(unsigned int nr_tags, diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index ad46208eac76..94cee2c566d3 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -6,6 +6,7 @@ #ifndef _NVME_H #define _NVME_H
+#include <linux/kabi.h> #include <linux/nvme.h> #include <linux/cdev.h> #include <linux/pci.h> @@ -346,6 +347,11 @@ struct nvme_ctrl { unsigned long discard_page_busy;
struct nvme_fault_inject fault_inject; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
enum nvme_iopolicy { diff --git a/include/linux/backing-dev-defs.h b/include/linux/backing-dev-defs.h index fff9367a6348..907a8a8021c3 100644 --- a/include/linux/backing-dev-defs.h +++ b/include/linux/backing-dev-defs.h @@ -2,6 +2,7 @@ #ifndef __LINUX_BACKING_DEV_DEFS_H #define __LINUX_BACKING_DEV_DEFS_H
+#include <linux/kabi.h> #include <linux/list.h> #include <linux/radix-tree.h> #include <linux/rbtree.h> @@ -160,6 +161,11 @@ struct bdi_writeback { struct rcu_head rcu; }; #endif + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
struct backing_dev_info { @@ -198,6 +204,11 @@ struct backing_dev_info { #ifdef CONFIG_DEBUG_FS struct dentry *debug_dir; #endif + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
enum { diff --git a/include/linux/bio.h b/include/linux/bio.h index 23b7a73cd757..e895c84be0bc 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -5,6 +5,7 @@ #ifndef __LINUX_BIO_H #define __LINUX_BIO_H
+#include <linux/kabi.h> #include <linux/highmem.h> #include <linux/mempool.h> #include <linux/ioprio.h> @@ -321,6 +322,10 @@ struct bio_integrity_payload { struct work_struct bip_work; /* I/O completion */
struct bio_vec *bip_vec; + + KABI_RESERVE(1) + KABI_RESERVE(2) + struct bio_vec bip_inline_vecs[];/* embedded bvec array */ };
@@ -694,6 +699,11 @@ struct bio_set { struct bio_list rescue_list; struct work_struct rescue_work; struct workqueue_struct *rescue_workqueue; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
struct biovec_slab { diff --git a/include/linux/blk-cgroup.h b/include/linux/blk-cgroup.h index c8fc9792ac77..b44db9835489 100644 --- a/include/linux/blk-cgroup.h +++ b/include/linux/blk-cgroup.h @@ -14,6 +14,7 @@ * Nauman Rafique nauman@google.com */
+#include <linux/kabi.h> #include <linux/cgroup.h> #include <linux/percpu.h> #include <linux/percpu_counter.h> @@ -58,6 +59,11 @@ struct blkcg { #ifdef CONFIG_CGROUP_WRITEBACK struct list_head cgwb_list; #endif + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
struct blkg_iostat { @@ -169,6 +175,11 @@ struct blkcg_policy { blkcg_pol_free_pd_fn *pd_free_fn; blkcg_pol_reset_pd_stats_fn *pd_reset_stats_fn; blkcg_pol_stat_pd_fn *pd_stat_fn; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
extern struct blkcg blkcg_root; diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h index eee2c8a16601..3134aaf9032a 100644 --- a/include/linux/blk-mq.h +++ b/include/linux/blk-mq.h @@ -2,6 +2,7 @@ #ifndef BLK_MQ_H #define BLK_MQ_H
+#include <linux/kabi.h> #include <linux/blkdev.h> #include <linux/sbitmap.h> #include <linux/srcu.h> @@ -175,6 +176,15 @@ struct blk_mq_hw_ctx { */ struct list_head hctx_list;
+ KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) + KABI_RESERVE(7) + KABI_RESERVE(8) + /** * @srcu: Sleepable RCU. Use as lock when type of the hardware queue is * blocking (BLK_MQ_F_BLOCKING). Must be the last member - see also @@ -267,6 +277,15 @@ struct blk_mq_tag_set {
struct mutex tag_list_lock; struct list_head tag_list; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) + KABI_RESERVE(7) + KABI_RESERVE(8) };
/** @@ -278,6 +297,8 @@ struct blk_mq_tag_set { struct blk_mq_queue_data { struct request *rq; bool last; + + KABI_RESERVE(1) };
typedef bool (busy_iter_fn)(struct blk_mq_hw_ctx *, struct request *, void *, @@ -387,6 +408,15 @@ struct blk_mq_ops { */ void (*show_rq)(struct seq_file *m, struct request *rq); #endif + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) + KABI_RESERVE(7) + KABI_RESERVE(8) };
enum { diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h index f33725f03525..11b9505b14c6 100644 --- a/include/linux/blk_types.h +++ b/include/linux/blk_types.h @@ -6,6 +6,7 @@ #ifndef __LINUX_BLK_TYPES_H #define __LINUX_BLK_TYPES_H
+#include <linux/kabi.h> #include <linux/types.h> #include <linux/bvec.h> #include <linux/ktime.h> @@ -48,6 +49,10 @@ struct block_device { /* Mutex for freeze */ struct mutex bd_fsfreeze_mutex; KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) } __randomize_layout;
/* @@ -259,6 +264,11 @@ struct bio {
struct bio_set *bi_pool;
+ KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + /* * We can inline a number of vecs at the end of the bio, to avoid * double allocations for a small number of bio_vecs. This member diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 6627e3c6cb43..eae4a046037e 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -2,6 +2,7 @@ #ifndef _LINUX_BLKDEV_H #define _LINUX_BLKDEV_H
+#include <linux/kabi.h> #include <linux/sched.h> #include <linux/sched/clock.h> #include <linux/major.h> @@ -354,6 +355,8 @@ struct queue_limits { unsigned char discard_misaligned; unsigned char raid_partial_stripes_expensive; enum blk_zoned_model zoned; + + KABI_RESERVE(1) };
typedef int (*report_zones_cb)(struct blk_zone *zone, unsigned int idx, @@ -598,6 +601,11 @@ struct request_queue {
#define BLK_MAX_WRITE_HINTS 5 u64 write_hints[BLK_MAX_WRITE_HINTS]; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
/* Keep blk_queue_flag_name[] in sync with the definitions below */ @@ -1700,6 +1708,9 @@ struct blk_integrity_profile { integrity_prepare_fn *prepare_fn; integrity_complete_fn *complete_fn; const char *name; + + KABI_RESERVE(1) + KABI_RESERVE(2) };
extern void blk_integrity_register(struct gendisk *, struct blk_integrity *); @@ -1893,6 +1904,11 @@ struct block_device_operations { char *(*devnode)(struct gendisk *disk, umode_t *mode); struct module *owner; const struct pr_ops *pr_ops; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
#ifdef CONFIG_COMPAT diff --git a/include/linux/cred.h b/include/linux/cred.h index 280e86c4d768..cd1b5fc47d52 100644 --- a/include/linux/cred.h +++ b/include/linux/cred.h @@ -8,6 +8,7 @@ #ifndef _LINUX_CRED_H #define _LINUX_CRED_H
+#include <linux/kabi.h> #include <linux/capability.h> #include <linux/init.h> #include <linux/key.h> @@ -151,7 +152,16 @@ struct cred { int non_rcu; /* Can we skip RCU deletion? */ struct rcu_head rcu; /* RCU deletion hook */ }; - KABI_RESERVE(1) /* reserved for ucounts */ + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) + KABI_RESERVE(7) + KABI_RESERVE(8) + KABI_RESERVE(9) + KABI_RESERVE(10) } __randomize_layout;
extern void __put_cred(struct cred *); diff --git a/include/linux/dcache.h b/include/linux/dcache.h index edb5efeff11a..4bb8b1759438 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h @@ -2,6 +2,7 @@ #ifndef __LINUX_DCACHE_H #define __LINUX_DCACHE_H
+#include <linux/kabi.h> #include <linux/atomic.h> #include <linux/list.h> #include <linux/rculist.h> @@ -121,6 +122,9 @@ struct dentry { } d_u; /* negative dentry under this dentry, if it's dir */ atomic_t d_neg_dnum; + + KABI_RESERVE(1) + KABI_RESERVE(2) } __randomize_layout;
/* @@ -150,6 +154,11 @@ struct dentry_operations { struct vfsmount *(*d_automount)(struct path *); int (*d_manage)(const struct path *, bool); struct dentry *(*d_real)(struct dentry *, const struct inode *); + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) } ____cacheline_aligned;
/* diff --git a/include/linux/device.h b/include/linux/device.h index f14c248df848..2e95153942d1 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -12,6 +12,7 @@ #ifndef _DEVICE_H_ #define _DEVICE_H_
+#include <linux/kabi.h> #include <linux/dev_printk.h> #include <linux/energy_model.h> #include <linux/ioport.h> @@ -568,6 +569,14 @@ struct device { KABI_RESERVE(6) KABI_RESERVE(7) KABI_RESERVE(8) + KABI_RESERVE(9) + KABI_RESERVE(10) + KABI_RESERVE(11) + KABI_RESERVE(12) + KABI_RESERVE(13) + KABI_RESERVE(14) + KABI_RESERVE(15) + KABI_RESERVE(16) };
/** diff --git a/include/linux/device/class.h b/include/linux/device/class.h index 20d954100cc7..d152ddce543a 100644 --- a/include/linux/device/class.h +++ b/include/linux/device/class.h @@ -14,6 +14,7 @@ #ifndef _DEVICE_CLASS_H_ #define _DEVICE_CLASS_H_
+#include <linux/kabi.h> #include <linux/kobject.h> #include <linux/klist.h> #include <linux/pm.h> diff --git a/include/linux/device/driver.h b/include/linux/device/driver.h index ee7ba5b5417e..9473256006e5 100644 --- a/include/linux/device/driver.h +++ b/include/linux/device/driver.h @@ -14,6 +14,7 @@ #ifndef _DEVICE_DRIVER_H_ #define _DEVICE_DRIVER_H_
+#include <linux/kabi.h> #include <linux/kobject.h> #include <linux/klist.h> #include <linux/pm.h> @@ -118,6 +119,11 @@ struct device_driver { void (*coredump) (struct device *dev);
struct driver_private *p; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
diff --git a/include/linux/elevator.h b/include/linux/elevator.h index 0bb7489e0cfb..820563e85c41 100644 --- a/include/linux/elevator.h +++ b/include/linux/elevator.h @@ -2,6 +2,7 @@ #ifndef _LINUX_ELEVATOR_H #define _LINUX_ELEVATOR_H
+#include <linux/kabi.h> #include <linux/percpu.h> #include <linux/hashtable.h>
@@ -50,6 +51,15 @@ struct elevator_mq_ops { struct request *(*next_request)(struct request_queue *, struct request *); void (*init_icq)(struct io_cq *); void (*exit_icq)(struct io_cq *); + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) + KABI_RESERVE(7) + KABI_RESERVE(8) };
#define ELV_NAME_MAX (16) @@ -86,6 +96,11 @@ struct elevator_type /* managed by elevator core */ char icq_cache_name[ELV_NAME_MAX + 6]; /* elvname + "_io_cq" */ struct list_head list; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
#define ELV_HASH_BITS 6 diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h index 3ceb72b67a7a..32eb1a67a7b1 100644 --- a/include/linux/exportfs.h +++ b/include/linux/exportfs.h @@ -2,6 +2,7 @@ #ifndef LINUX_EXPORTFS_H #define LINUX_EXPORTFS_H 1
+#include <linux/kabi.h> #include <linux/types.h>
struct dentry; @@ -213,6 +214,9 @@ struct export_operations { bool write, u32 *device_generation); int (*commit_blocks)(struct inode *inode, struct iomap *iomaps, int nr_iomaps, struct iattr *iattr); + + KABI_RESERVE(1) + KABI_RESERVE(2) };
extern int exportfs_encode_inode_fh(struct inode *inode, struct fid *fid, diff --git a/include/linux/fs.h b/include/linux/fs.h index ce2cab22d942..cdba7ef87553 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2,6 +2,7 @@ #ifndef _LINUX_FS_H #define _LINUX_FS_H
+#include <linux/kabi.h> #include <linux/linkage.h> #include <linux/wait_bit.h> #include <linux/kdev_t.h> @@ -417,6 +418,11 @@ struct address_space_operations { int (*swap_activate)(struct swap_info_struct *sis, struct file *file, sector_t *span); void (*swap_deactivate)(struct file *file); + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
extern const struct address_space_operations empty_aops; @@ -470,6 +476,11 @@ struct address_space { spinlock_t private_lock; struct list_head private_list; void *private_data; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) } __attribute__((aligned(sizeof(long)))) __randomize_layout; /* * On most architectures that alignment is already the case; but @@ -720,6 +731,9 @@ struct inode { #endif
void *i_private; /* fs or device private pointer */ + + KABI_RESERVE(1) + KABI_RESERVE(2) } __randomize_layout;
struct timespec64 timestamp_truncate(struct timespec64 t, struct inode *inode); @@ -1013,6 +1027,9 @@ struct file_lock; struct file_lock_operations { void (*fl_copy_lock)(struct file_lock *, struct file_lock *); void (*fl_release_private)(struct file_lock *); + + KABI_RESERVE(1) + KABI_RESERVE(2) };
struct lock_manager_operations { @@ -1024,6 +1041,9 @@ struct lock_manager_operations { int (*lm_change)(struct file_lock *, int, struct list_head *); void (*lm_setup)(struct file_lock *, void **); bool (*lm_breaker_owns_lease)(struct file_lock *); + + KABI_RESERVE(1) + KABI_RESERVE(2) };
struct lock_manager { @@ -1863,6 +1883,11 @@ struct file_operations { struct file *file_out, loff_t pos_out, loff_t len, unsigned int remap_flags); int (*fadvise)(struct file *, loff_t, loff_t, int); + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) } __randomize_layout;
struct inode_operations { @@ -1893,6 +1918,19 @@ struct inode_operations { umode_t create_mode); int (*tmpfile) (struct inode *, struct dentry *, umode_t); int (*set_acl)(struct inode *, struct posix_acl *, int); + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) + KABI_RESERVE(7) + KABI_RESERVE(8) + KABI_RESERVE(9) + KABI_RESERVE(10) + KABI_RESERVE(11) + KABI_RESERVE(12) } ____cacheline_aligned;
static inline ssize_t call_read_iter(struct file *file, struct kiocb *kio, @@ -1968,6 +2006,11 @@ struct super_operations { struct shrink_control *); long (*free_cached_objects)(struct super_block *, struct shrink_control *); + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
/* @@ -2255,6 +2298,11 @@ struct file_system_type { struct lock_class_key i_lock_key; struct lock_class_key i_mutex_key; struct lock_class_key i_mutex_dir_key; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
#define MODULE_ALIAS_FS(NAME) MODULE_ALIAS("fs-" NAME) diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h index a2e42d3cd87c..1599db3cc4de 100644 --- a/include/linux/fsnotify_backend.h +++ b/include/linux/fsnotify_backend.h @@ -10,6 +10,7 @@
#ifdef __KERNEL__
+#include <linux/kabi.h> #include <linux/idr.h> /* inotify uses this */ #include <linux/fs.h> /* struct inode */ #include <linux/list.h> @@ -158,6 +159,8 @@ struct fsnotify_ops { void (*free_event)(struct fsnotify_event *event); /* called on final put+free to free memory */ void (*free_mark)(struct fsnotify_mark *mark); + + KABI_RESERVE(1) };
/* diff --git a/include/linux/genhd.h b/include/linux/genhd.h index 9116e41f4cc9..47ee862a7c56 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h @@ -10,6 +10,7 @@ * drew@colorado.edu */
+#include <linux/kabi.h> #include <linux/types.h> #include <linux/kdev_t.h> #include <linux/rcupdate.h> @@ -74,6 +75,11 @@ struct hd_struct { int make_it_fail; #endif struct rcu_work rcu_work; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
/** @@ -163,6 +169,9 @@ struct blk_integrity { unsigned char tuple_size; unsigned char interval_exp; unsigned char tag_size; + + KABI_RESERVE(1) + KABI_RESERVE(2) };
struct gendisk { @@ -210,6 +219,11 @@ struct gendisk { int node_id; struct badblocks *bb; struct lockdep_map lockdep_map; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
#if IS_REACHABLE(CONFIG_CDROM) diff --git a/include/linux/iomap.h b/include/linux/iomap.h index 5bd3cac4df9c..d84fc7e55e21 100644 --- a/include/linux/iomap.h +++ b/include/linux/iomap.h @@ -2,6 +2,7 @@ #ifndef LINUX_IOMAP_H #define LINUX_IOMAP_H 1
+#include <linux/kabi.h> #include <linux/atomic.h> #include <linux/bitmap.h> #include <linux/blk_types.h> @@ -141,6 +142,11 @@ struct iomap_ops { */ int (*iomap_end)(struct inode *inode, loff_t pos, loff_t length, ssize_t written, unsigned flags, struct iomap *iomap); + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
/* diff --git a/include/linux/ioport.h b/include/linux/ioport.h index 3930f564f207..fc7e99ba6420 100644 --- a/include/linux/ioport.h +++ b/include/linux/ioport.h @@ -10,6 +10,7 @@ #define _LINUX_IOPORT_H
#ifndef __ASSEMBLY__ +#include <linux/kabi.h> #include <linux/compiler.h> #include <linux/types.h> #include <linux/bits.h> diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index 9afcfef64a2b..5fd415c0af98 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h @@ -19,6 +19,7 @@ #define JBD2_DEBUG #else
+#include <linux/kabi.h> #include <linux/types.h> #include <linux/buffer_head.h> #include <linux/journal-head.h> @@ -1302,6 +1303,11 @@ struct journal_s struct buffer_head *bh, enum passtype pass, int off, tid_t expected_commit_id); + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
#define jbd2_might_wait_for_commit(j) \ diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h index 89f6a4214a70..7240d00ace86 100644 --- a/include/linux/kernfs.h +++ b/include/linux/kernfs.h @@ -6,6 +6,7 @@ #ifndef __LINUX_KERNFS_H #define __LINUX_KERNFS_H
+#include <linux/kabi.h> #include <linux/kernel.h> #include <linux/err.h> #include <linux/list.h> @@ -175,6 +176,11 @@ struct kernfs_syscall_ops { const char *new_name); int (*show_path)(struct seq_file *sf, struct kernfs_node *kn, struct kernfs_root *root); + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
struct kernfs_root { @@ -268,6 +274,9 @@ struct kernfs_ops { #ifdef CONFIG_DEBUG_LOCK_ALLOC struct lock_class_key lockdep_key; #endif + + KABI_RESERVE(1) + KABI_RESERVE(2) };
/* diff --git a/include/linux/mm.h b/include/linux/mm.h index 439e550f242c..4831348f31e9 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -6,6 +6,7 @@
#ifdef __KERNEL__
+#include <linux/kabi.h> #include <linux/mmdebug.h> #include <linux/gfp.h> #include <linux/bug.h> diff --git a/include/linux/mount.h b/include/linux/mount.h index aaf343b38671..87132efeaa60 100644 --- a/include/linux/mount.h +++ b/include/linux/mount.h @@ -10,6 +10,7 @@ #ifndef _LINUX_MOUNT_H #define _LINUX_MOUNT_H
+#include <linux/kabi.h> #include <linux/types.h> #include <linux/list.h> #include <linux/nodemask.h> @@ -72,6 +73,8 @@ struct vfsmount { struct dentry *mnt_root; /* root of the mounted tree */ struct super_block *mnt_sb; /* pointer to superblock */ int mnt_flags; + + KABI_RESERVE(1) } __randomize_layout;
struct file; /* forward dec */ diff --git a/include/linux/ns_common.h b/include/linux/ns_common.h index 5fbc4000358f..631f99865c43 100644 --- a/include/linux/ns_common.h +++ b/include/linux/ns_common.h @@ -2,12 +2,16 @@ #ifndef _LINUX_NS_COMMON_H #define _LINUX_NS_COMMON_H
+#include <linux/kabi.h> + struct proc_ns_operations;
struct ns_common { atomic_long_t stashed; const struct proc_ns_operations *ops; unsigned int inum; + + KABI_RESERVE(1) };
#endif diff --git a/include/linux/quota.h b/include/linux/quota.h index 27aab84fcbaa..2b9602c8012a 100644 --- a/include/linux/quota.h +++ b/include/linux/quota.h @@ -32,6 +32,7 @@ #ifndef _LINUX_QUOTA_ #define _LINUX_QUOTA_
+#include <linux/kabi.h> #include <linux/list.h> #include <linux/mutex.h> #include <linux/rwsem.h> @@ -316,6 +317,9 @@ struct quota_format_ops { int (*commit_dqblk)(struct dquot *dquot); /* Write structure for one user */ int (*release_dqblk)(struct dquot *dquot); /* Called when last reference to dquot is being dropped */ int (*get_next_id)(struct super_block *sb, struct kqid *qid); /* Get next ID with existing structure in the quota file */ + + KABI_RESERVE(1) + KABI_RESERVE(2) };
/* Operations working with dquots */ @@ -335,6 +339,9 @@ struct dquot_operations { int (*get_inode_usage) (struct inode *, qsize_t *); /* Get next ID with active quota structure */ int (*get_next_id) (struct super_block *sb, struct kqid *qid); + + KABI_RESERVE(1) + KABI_RESERVE(2) };
struct path; diff --git a/include/linux/sbitmap.h b/include/linux/sbitmap.h index e40d019c3d9d..86004ddc60bd 100644 --- a/include/linux/sbitmap.h +++ b/include/linux/sbitmap.h @@ -9,6 +9,7 @@ #ifndef __LINUX_SCALE_BITMAP_H #define __LINUX_SCALE_BITMAP_H
+#include <linux/kabi.h> #include <linux/kernel.h> #include <linux/slab.h>
@@ -65,6 +66,8 @@ struct sbitmap { * @map: Allocated bitmap. */ struct sbitmap_word *map; + + KABI_RESERVE(1) };
#define SBQ_WAIT_QUEUES 8 diff --git a/include/linux/swap.h b/include/linux/swap.h index f2aa72ec0e57..2b68047db2d9 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -2,6 +2,7 @@ #ifndef _LINUX_SWAP_H #define _LINUX_SWAP_H
+#include <linux/kabi.h> #include <linux/spinlock.h> #include <linux/linkage.h> #include <linux/mmzone.h> diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index 2caa34c1ca1a..c67649e65679 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h @@ -13,6 +13,7 @@ #ifndef _SYSFS_H_ #define _SYSFS_H_
+#include <linux/kabi.h> #include <linux/kernfs.h> #include <linux/compiler.h> #include <linux/errno.h> @@ -175,6 +176,8 @@ struct bin_attribute { char *, loff_t, size_t); int (*mmap)(struct file *, struct kobject *, struct bin_attribute *attr, struct vm_area_struct *vma); + + KABI_RESERVE(1) };
/** diff --git a/include/linux/user_namespace.h b/include/linux/user_namespace.h index d7d02654a49e..f79abb16a874 100644 --- a/include/linux/user_namespace.h +++ b/include/linux/user_namespace.h @@ -2,6 +2,7 @@ #ifndef _LINUX_USER_NAMESPACE_H #define _LINUX_USER_NAMESPACE_H
+#include <linux/kabi.h> #include <linux/kref.h> #include <linux/nsproxy.h> #include <linux/ns_common.h> @@ -110,6 +111,17 @@ struct user_namespace { #endif struct ucounts *ucounts; long ucount_max[UCOUNT_COUNTS]; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) + KABI_RESERVE(7) + KABI_RESERVE(8) + KABI_RESERVE(9) + KABI_RESERVE(10) } __randomize_layout;
struct ucounts { diff --git a/include/linux/writeback.h b/include/linux/writeback.h index 9ef50176f3a1..b17b416263e0 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h @@ -12,6 +12,7 @@ #include <linux/backing-dev-defs.h> #include <linux/blk_types.h> #include <linux/blk-cgroup.h> +#include <linux/kabi.h>
struct bio;
@@ -92,6 +93,9 @@ struct writeback_control { size_t wb_lcand_bytes; /* bytes written by last candidate */ size_t wb_tcand_bytes; /* bytes written by this candidate */ #endif + + KABI_RESERVE(1) + KABI_RESERVE(2) };
static inline int wbc_to_write_flags(struct writeback_control *wbc) diff --git a/include/linux/xattr.h b/include/linux/xattr.h index 10b4dc2709f0..28e97277d0ab 100644 --- a/include/linux/xattr.h +++ b/include/linux/xattr.h @@ -12,6 +12,7 @@ #define _LINUX_XATTR_H
+#include <linux/kabi.h> #include <linux/slab.h> #include <linux/types.h> #include <linux/spinlock.h> @@ -37,6 +38,8 @@ struct xattr_handler { int (*set)(const struct xattr_handler *, struct dentry *dentry, struct inode *inode, const char *name, const void *buffer, size_t size, int flags); + + KABI_RESERVE(1) };
const char *xattr_full_name(const struct xattr_handler *, const char *); diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index 69ade4fb71aa..96643e48bd52 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -2,6 +2,7 @@ #ifndef _SCSI_SCSI_CMND_H #define _SCSI_SCSI_CMND_H
+#include <linux/kabi.h> #include <linux/dma-mapping.h> #include <linux/blkdev.h> #include <linux/t10-pi.h> @@ -142,6 +143,11 @@ struct scsi_cmnd {
unsigned char tag; /* SCSI-II queued command tag */ unsigned int extra_len; /* length of alignment and padding */ + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
/* diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index 2b8c3df03f13..8b9d1aac62d1 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -2,6 +2,7 @@ #ifndef _SCSI_SCSI_DEVICE_H #define _SCSI_SCSI_DEVICE_H
+#include <linux/kabi.h> #include <linux/list.h> #include <linux/spinlock.h> #include <linux/workqueue.h> @@ -238,6 +239,14 @@ struct scsi_device { struct mutex state_mutex; enum scsi_device_state sdev_state; struct task_struct *quiesced_by; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) + unsigned long sdev_data[]; } __attribute__((aligned(sizeof(unsigned long))));
@@ -322,6 +331,12 @@ struct scsi_target { char scsi_level; enum scsi_target_state state; void *hostdata; /* available to low-level driver */ + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + unsigned long starget_data[]; /* for the transport */ /* starget_data must be the last element!!!! */ } __attribute__((aligned(sizeof(unsigned long)))); diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 701f178b20ae..19f595b6a5ca 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -2,6 +2,7 @@ #ifndef _SCSI_SCSI_HOST_H #define _SCSI_SCSI_HOST_H
+#include <linux/kabi.h> #include <linux/device.h> #include <linux/list.h> #include <linux/types.h> @@ -486,6 +487,11 @@ struct scsi_host_template {
/* Delay for runtime autosuspend */ int rpm_autosuspend_delay; + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) };
/* @@ -692,6 +698,13 @@ struct Scsi_Host { */ struct device *dma_dev;
+ KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) + /* * We should ensure that this is aligned, both for better performance * and also because some compilers (m68k) don't automatically force diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h index 1c7dd35cb7a0..533bab18f462 100644 --- a/include/scsi/scsi_transport_fc.h +++ b/include/scsi/scsi_transport_fc.h @@ -10,6 +10,7 @@ #ifndef SCSI_TRANSPORT_FC_H #define SCSI_TRANSPORT_FC_H
+#include <linux/kabi.h> #include <linux/sched.h> #include <linux/bsg-lib.h> #include <asm/unaligned.h> @@ -351,6 +352,27 @@ struct fc_rport { /* aka fc_starget_attrs */ struct work_struct stgt_delete_work; struct work_struct rport_delete_work; struct request_queue *rqst_q; /* bsg support */ + + KABI_RESERVE(1) + KABI_RESERVE(2) + KABI_RESERVE(3) + KABI_RESERVE(4) + KABI_RESERVE(5) + KABI_RESERVE(6) + KABI_RESERVE(7) + KABI_RESERVE(8) + KABI_RESERVE(9) + KABI_RESERVE(10) + KABI_RESERVE(11) + KABI_RESERVE(12) + KABI_RESERVE(13) + KABI_RESERVE(14) + KABI_RESERVE(15) + KABI_RESERVE(16) + KABI_RESERVE(17) + KABI_RESERVE(18) + KABI_RESERVE(19) + KABI_RESERVE(20) } __attribute__((aligned(sizeof(unsigned long))));
/* bit field values for struct fc_rport "flags" field: */ @@ -437,6 +459,9 @@ struct fc_host_statistics { u64 fc_seq_not_found; /* seq is not found for exchange */ u64 fc_non_bls_resp; /* a non BLS response frame with a sequence responder in new exch */ + + KABI_RESERVE(1) + KABI_RESERVE(2) };
diff --git a/include/target/target_core_base.h b/include/target/target_core_base.h index 549947d407cf..bdbbf482aa97 100644 --- a/include/target/target_core_base.h +++ b/include/target/target_core_base.h @@ -2,6 +2,7 @@ #ifndef TARGET_CORE_BASE_H #define TARGET_CORE_BASE_H
+#include <linux/kabi.h> #include <linux/configfs.h> /* struct config_group */ #include <linux/dma-direction.h> /* enum dma_data_direction */ #include <linux/sbitmap.h> @@ -542,6 +543,9 @@ struct se_cmd { sense_reason_t pi_err; sector_t bad_sector; int cpuid; + + KABI_RESERVE(1) + KABI_RESERVE(2) };
struct se_ua { @@ -839,6 +843,9 @@ struct se_device { /* For se_lun->lun_se_dev RCU read-side critical access */ u32 hba_index; struct rcu_head rcu_head; + + KABI_RESERVE(1) + KABI_RESERVE(2) };
struct se_hba {
From: "Gustavo A. R. Silva" gustavoars@kernel.org
mainline inclusion from mainline-v5.16-rc1 category: feature bugzilla: 185747 https://gitee.com/openeuler/kernel/issues/I4OUFN CVE: NA
-------------------------------
There is a regular need in the kernel to provide a way to declare having a dynamically sized set of trailing elements in a structure. Kernel code should always use “flexible array members”[1] for these cases. The older style of one-element or zero-length arrays should no longer be used[2].
Use an anonymous union with a couple of anonymous structs in order to keep userspace unchanged:
$ pahole -C nfs_fhbase_new fs/nfsd/nfsfh.o struct nfs_fhbase_new { union { struct { __u8 fb_version_aux; /* 0 1 */ __u8 fb_auth_type_aux; /* 1 1 */ __u8 fb_fsid_type_aux; /* 2 1 */ __u8 fb_fileid_type_aux; /* 3 1 */ __u32 fb_auth[1]; /* 4 4 */ }; /* 0 8 */ struct { __u8 fb_version; /* 0 1 */ __u8 fb_auth_type; /* 1 1 */ __u8 fb_fsid_type; /* 2 1 */ __u8 fb_fileid_type; /* 3 1 */ __u32 fb_auth_flex[0]; /* 4 0 */ }; /* 0 4 */ }; /* 0 8 */
/* size: 8, cachelines: 1, members: 1 */ /* last cacheline: 8 bytes */ };
Also, this helps with the ongoing efforts to enable -Warray-bounds by fixing the following warnings:
fs/nfsd/nfsfh.c: In function ‘nfsd_set_fh_dentry’: fs/nfsd/nfsfh.c:191:41: warning: array subscript 1 is above array bounds of ‘__u32[1]’ {aka ‘unsigned int[1]’} [-Warray-bounds] 191 | ntohl((__force __be32)fh->fh_fsid[1]))); | ~~~~~~~~~~~^~~ ./include/linux/kdev_t.h:12:46: note: in definition of macro ‘MKDEV’ 12 | #define MKDEV(ma,mi) (((ma) << MINORBITS) | (mi)) | ^~ ./include/uapi/linux/byteorder/little_endian.h:40:26: note: in expansion of macro ‘__swab32’ 40 | #define __be32_to_cpu(x) __swab32((__force __u32)(__be32)(x)) | ^~~~~~~~ ./include/linux/byteorder/generic.h:136:21: note: in expansion of macro ‘__be32_to_cpu’ 136 | #define ___ntohl(x) __be32_to_cpu(x) | ^~~~~~~~~~~~~ ./include/linux/byteorder/generic.h:140:18: note: in expansion of macro ‘___ntohl’ 140 | #define ntohl(x) ___ntohl(x) | ^~~~~~~~ fs/nfsd/nfsfh.c:191:8: note: in expansion of macro ‘ntohl’ 191 | ntohl((__force __be32)fh->fh_fsid[1]))); | ^~~~~ fs/nfsd/nfsfh.c:192:32: warning: array subscript 2 is above array bounds of ‘__u32[1]’ {aka ‘unsigned int[1]’} [-Warray-bounds] 192 | fh->fh_fsid[1] = fh->fh_fsid[2]; | ~~~~~~~~~~~^~~ fs/nfsd/nfsfh.c:192:15: warning: array subscript 1 is above array bounds of ‘__u32[1]’ {aka ‘unsigned int[1]’} [-Warray-bounds] 192 | fh->fh_fsid[1] = fh->fh_fsid[2]; | ~~~~~~~~~~~^~~
[1] https://en.wikipedia.org/wiki/Flexible_array_member [2] https://www.kernel.org/doc/html/v5.10/process/deprecated.html#zero-length-an...
Link: https://github.com/KSPP/linux/issues/79 Link: https://github.com/KSPP/linux/issues/109 Signed-off-by: Gustavo A. R. Silva gustavoars@kernel.org Signed-off-by: Chuck Lever chuck.lever@oracle.com Signed-off-by: Zhihao Cheng chengzhihao1@huawei.com Reviewed-by: Jason Yan yanaijie@huawei.com Acked-by: Xie XiuQi xiexiuqi@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/uapi/linux/nfsd/nfsfh.h | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-)
diff --git a/include/uapi/linux/nfsd/nfsfh.h b/include/uapi/linux/nfsd/nfsfh.h index ff0ca88b1c8f..427294dd56a1 100644 --- a/include/uapi/linux/nfsd/nfsfh.h +++ b/include/uapi/linux/nfsd/nfsfh.h @@ -64,13 +64,24 @@ struct nfs_fhbase_old { * in include/linux/exportfs.h for currently registered values. */ struct nfs_fhbase_new { - __u8 fb_version; /* == 1, even => nfs_fhbase_old */ - __u8 fb_auth_type; - __u8 fb_fsid_type; - __u8 fb_fileid_type; - __u32 fb_auth[1]; -/* __u32 fb_fsid[0]; floating */ -/* __u32 fb_fileid[0]; floating */ + union { + struct { + __u8 fb_version_aux; /* == 1, even => nfs_fhbase_old */ + __u8 fb_auth_type_aux; + __u8 fb_fsid_type_aux; + __u8 fb_fileid_type_aux; + __u32 fb_auth[1]; + /* __u32 fb_fsid[0]; floating */ + /* __u32 fb_fileid[0]; floating */ + }; + struct { + __u8 fb_version; /* == 1, even => nfs_fhbase_old */ + __u8 fb_auth_type; + __u8 fb_fsid_type; + __u8 fb_fileid_type; + __u32 fb_auth_flex[]; /* flexible-array member */ + }; + }; };
struct knfsd_fh { @@ -97,7 +108,7 @@ struct knfsd_fh { #define fh_fsid_type fh_base.fh_new.fb_fsid_type #define fh_auth_type fh_base.fh_new.fb_auth_type #define fh_fileid_type fh_base.fh_new.fb_fileid_type -#define fh_fsid fh_base.fh_new.fb_auth +#define fh_fsid fh_base.fh_new.fb_auth_flex
/* Do not use, provided for userspace compatiblity. */ #define fh_auth fh_base.fh_new.fb_auth