diff --git a/fcst/ft_sess.c b/fcst/ft_sess.c index 0419b53df..ef5991e90 100644 --- a/fcst/ft_sess.c +++ b/fcst/ft_sess.c @@ -49,7 +49,8 @@ static struct ft_tport *ft_tport_create(struct fc_lport *lport) ft_format_wwn(name, sizeof(name), lport->wwpn); FT_SESS_DBG("create %s\n", name); - tport = rcu_dereference_protected(lport->prov[FC_TYPE_FCP], + tport = rcu_dereference_protected((void __force __rcu *) + lport->prov[FC_TYPE_FCP], lockdep_is_held(&ft_lport_lock)); if (tport) { FT_SESS_DBG("tport alloc %s - already setup\n", name); @@ -74,7 +75,8 @@ static struct ft_tport *ft_tport_create(struct fc_lport *lport) for (i = 0; i < FT_SESS_HASH_SIZE; i++) INIT_HLIST_HEAD(&tport->hash[i]); - rcu_assign_pointer(lport->prov[FC_TYPE_FCP], tport); + rcu_assign_pointer(*(void __force __rcu **)&lport->prov[FC_TYPE_FCP], + tport); FT_SESS_DBG("register_target %s succeeded\n", name); return tport; } @@ -106,7 +108,8 @@ static void ft_tport_delete(struct ft_tport *tport) scst_unregister_target(tgt); lport = tport->lport; BUG_ON(tport != lport->prov[FC_TYPE_FCP]); - rcu_assign_pointer(lport->prov[FC_TYPE_FCP], NULL); + rcu_assign_pointer(*(void __force __rcu **)&lport->prov[FC_TYPE_FCP], + NULL); tport->lport = NULL; #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) kfree_rcu(tport, rcu); @@ -183,7 +186,8 @@ static struct ft_sess *ft_sess_get(struct fc_lport *lport, u32 port_id) struct ft_sess *sess; rcu_read_lock(); - tport = rcu_dereference_protected(lport->prov[FC_TYPE_FCP], true); + tport = rcu_dereference_protected((void __force __rcu *) + lport->prov[FC_TYPE_FCP], true); if (!tport) goto out; @@ -398,7 +402,7 @@ static int ft_prli_locked(struct fc_rport_priv *rdata, u32 spp_len, if (!(fcp_parm & FCP_SPPF_INIT_FCN)) return FC_SPP_RESP_CONF; - tport = rcu_dereference_protected( + tport = rcu_dereference_protected((void __force __rcu *) rdata->local_port->prov[FC_TYPE_FCP], lockdep_is_held(&ft_lport_lock)); if (!tport) { @@ -480,7 +484,8 @@ static void ft_prlo(struct fc_rport_priv *rdata) struct ft_tport *tport; mutex_lock(&ft_lport_lock); - tport = rcu_dereference_protected(rdata->local_port->prov[FC_TYPE_FCP], + tport = rcu_dereference_protected((void __force __rcu *) + rdata->local_port->prov[FC_TYPE_FCP], lockdep_is_held(&ft_lport_lock)); if (!tport) { mutex_unlock(&ft_lport_lock); diff --git a/nightly/conf/nightly.conf b/nightly/conf/nightly.conf index 7d011ecf3..5681f701d 100644 --- a/nightly/conf/nightly.conf +++ b/nightly/conf/nightly.conf @@ -3,30 +3,30 @@ ABT_DETAILS="x86_64" ABT_JOBS=5 ABT_KERNELS=" \ -5.6.11 \ +5.6.12 \ 5.5.19-nc \ -5.4.39-nc \ +5.4.40-nc \ 5.3.18-nc \ 5.2.21-nc \ 5.1.21-nc \ 5.0.21-nc \ 4.20.17-nc \ -4.19.121-nc \ +4.19.122-nc \ 4.18.20-nc \ 4.17.19-nc \ 4.16.18-nc \ 4.15.18-nc \ -4.14.179-nc \ +4.14.180-nc \ 4.13.16-nc \ 4.12.14-nc \ 4.11.12-nc \ 4.10.17-nc \ -4.9.222-nc \ +4.9.223-nc \ 4.8.17-nc \ 4.7.10-nc \ 4.6.7-nc \ 4.5.7-nc \ -4.4.222-nc \ +4.4.223-nc \ 4.3.6-nc \ 4.2.8-nc \ 4.1.52-nc \ @@ -59,4 +59,12 @@ ABT_KERNELS=" \ 2.6.34.7-nc \ 2.6.33.7-nc \ 2.6.32.27-nc \ -2.6.31.14-nc" +2.6.31.14-nc \ +4.18.0-147.5.1.el8_1^CentOS^8.1.1911-nc \ +4.18.0-80.11.2.el8_0^CentOS^8.0.1905-nc \ +3.10.0-1127.el7^CentOS^7.8.2003-nc \ +3.10.0-1062.18.1.el7^CentOS^7.7.1908-nc \ +3.10.0-957.27.2.el7^CentOS^7.6.1810-nc \ +3.10.0-862.14.4.el7^CentOS^7.5.1804-nc \ +2.6.32-754.29.1.el6^CentOS^6.10-nc \ +" diff --git a/scripts/kernel-functions b/scripts/kernel-functions index 704761339..8c78ea7d3 100644 --- a/scripts/kernel-functions +++ b/scripts/kernel-functions @@ -127,8 +127,8 @@ function extract_kernel_tree { # Patch a kernel tree where $1 is the kernel version. function patch_kernel { - if [ "$1" = "2.6.29" ] || [ "$1" = "2.6.29.1" ] || [ "$1" = "2.6.29.2" ] || [ "$1" = "2.6.29.3" ] - then + if [ "$1" = "2.6.29" ] || [ "$1" = "2.6.29.1" ] || [ "$1" = "2.6.29.2" ] || + [ "$1" = "2.6.29.3" ]; then patch -f -s -p1 <<'EOF' Make sure that branch profiling does not trigger sparse warnings. See also http://bugzilla.kernel.org/show_bug.cgi?id=12925 @@ -148,8 +148,8 @@ See also http://lkml.org/lkml/2009/4/5/120 #define likely_notrace(x) __builtin_expect(!!(x), 1) EOF fi - if [ "${1#2.6.31}" != "$1" ] - then + + if [ "${1#2.6.31}" != "$1" ]; then patch -f -s -p1 <<'EOF' Checking a 2.6.31.1 kernel configured with allyesconfig/allmodconfig with sparse (make C=2) triggers a sparse warning on code that uses the @@ -203,6 +203,7 @@ Get rid of sparse errors on sk_buff.protocol. #if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE) EOF fi + if [ "${1#3.13}" != "$1" ]; then if [ "$1" = "3.13" ] || [ "${1#3.13.}" -lt 6 ]; then patch -f -s -p1 <<'EOF' @@ -244,6 +245,7 @@ index 3f2793d..96e45ea 100644 EOF fi fi + if [ "${1#4.15}" != "$1" ]; then patch -f -s -p1 <<'EOF' From ad343a98e74e85aa91d844310e797f96fee6983b Mon Sep 17 00:00:00 2001 @@ -334,6 +336,7 @@ index d6d65537b0d9..6aad8308a0ac 100644 } EOF fi + case "$1" in 2.6.3[6-9]*|3.[0-9]|3.[0-9].*|3.1[01345]|3.1[01345].*|3.1[789]|3.1[789].*|4.[023567]|4.[023567].*) patch -p1 <<'EOF' @@ -399,6 +402,9 @@ index 0ed6ce300543..c324b43712f0 100644 KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds EOF ;; + # The patch below does not apply on the CentOS 6 kernel. + 2.6.32-*) + ;; 2.6.3[1-5]*) patch -p1 <<'EOF' diff --git a/Makefile b/Makefile @@ -425,6 +431,113 @@ EOF ;; esac + case "$1" in + 4.18.0-*) # CentOS 8.x + patch -p1 <<'EOF' +From a6e60d84989fa0e91db7f236eda40453b0e44afa Mon Sep 17 00:00:00 2001 +From: Miguel Ojeda +Date: Sat, 19 Jan 2019 20:59:34 +0100 +Subject: [PATCH] include/linux/module.h: copy __init/__exit attrs to + init/cleanup_module + +The upcoming GCC 9 release extends the -Wmissing-attributes warnings +(enabled by -Wall) to C and aliases: it warns when particular function +attributes are missing in the aliases but not in their target. + +In particular, it triggers for all the init/cleanup_module +aliases in the kernel (defined by the module_init/exit macros), +ending up being very noisy. + +These aliases point to the __init/__exit functions of a module, +which are defined as __cold (among other attributes). However, +the aliases themselves do not have the __cold attribute. + +Since the compiler behaves differently when compiling a __cold +function as well as when compiling paths leading to calls +to __cold functions, the warning is trying to point out +the possibly-forgotten attribute in the alias. + +In order to keep the warning enabled, we decided to silence +this case. Ideally, we would mark the aliases directly +as __init/__exit. However, there are currently around 132 modules +in the kernel which are missing __init/__exit in their init/cleanup +functions (either because they are missing, or for other reasons, +e.g. the functions being called from somewhere else); and +a section mismatch is a hard error. + +A conservative alternative was to mark the aliases as __cold only. +However, since we would like to eventually enforce __init/__exit +to be always marked, we chose to use the new __copy function +attribute (introduced by GCC 9 as well to deal with this). +With it, we copy the attributes used by the target functions +into the aliases. This way, functions that were not marked +as __init/__exit won't have their aliases marked either, +and therefore there won't be a section mismatch. + +Note that the warning would go away marking either the extern +declaration, the definition, or both. However, we only mark +the definition of the alias, since we do not want callers +(which only see the declaration) to be compiled as if the function +was __cold (and therefore the paths leading to those calls +would be assumed to be unlikely). + +Link: https://lore.kernel.org/lkml/20190123173707.GA16603@gmail.com/ +Link: https://lore.kernel.org/lkml/20190206175627.GA20399@gmail.com/ +Suggested-by: Martin Sebor +Acked-by: Jessica Yu +Signed-off-by: Miguel Ojeda +--- + include/linux/module.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/include/linux/module.h b/include/linux/module.h +index 8fa38d3e7538..f5bc4c046461 100644 +--- a/include/linux/module.h ++++ b/include/linux/module.h +@@ -129,13 +129,13 @@ extern void cleanup_module(void); + #define module_init(initfn) \ + static inline initcall_t __maybe_unused __inittest(void) \ + { return initfn; } \ +- int init_module(void) __attribute__((alias(#initfn))); ++ int init_module(void) __attribute__((__copy__(initfn))) __attribute__((alias(#initfn))); + + /* This is only required if you want to be unloadable. */ + #define module_exit(exitfn) \ + static inline exitcall_t __maybe_unused __exittest(void) \ + { return exitfn; } \ +- void cleanup_module(void) __attribute__((alias(#exitfn))); ++ void cleanup_module(void) __attribute__((__copy__(exitfn))) __attribute__((alias(#exitfn))); + + #endif + +EOF + ;; + *) # CentOS 6.x and 7.x + patch -p1 <<'EOF' +--- linux-3.10.0-1127.el7/include/linux/init.h.orig 2020-05-09 20:55:48.638956513 -0700 ++++ linux-3.10.0-1127.el7/include/linux/init.h 2020-05-09 20:56:46.947612445 -0700 +@@ -309,13 +309,15 @@ + #define module_init(initfn) \ + static inline initcall_t __inittest(void) \ + { return initfn; } \ +- int init_module(void) __attribute__((alias(#initfn))); ++ int init_module(void) __attribute__((__copy__(initfn))) \ ++ __attribute__((alias(#initfn))); + + /* This is only required if you want to be unloadable. */ + #define module_exit(exitfn) \ + static inline exitcall_t __exittest(void) \ + { return exitfn; } \ +- void cleanup_module(void) __attribute__((alias(#exitfn))); ++ void cleanup_module(void) __attribute__((__copy__(exitfn)))\ ++ __attribute__((alias(#exitfn))); + + #define __setup_param(str, unique_id, fn) /* nothing */ + #define __setup(str, func) /* nothing */ +EOF + ;; + esac + # Use sed to patch the ____ilog2_NaN() prototype. sed -i 's/__attribute__((const, noreturn))/__attribute__((noreturn))/' \ include/linux/log2.h tools/include/linux/log2.h 2>/dev/null diff --git a/scripts/specialize-patch b/scripts/specialize-patch index 19a43ec22..611ce595a 100755 --- a/scripts/specialize-patch +++ b/scripts/specialize-patch @@ -92,7 +92,7 @@ function evaluate(stmnt, pattern, arg, op, result) { gsub("defined\\(IB_CLIENT_REMOVE_TAKES_TWO_ARGS\\)", "(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0) || " \ - "RHEL_RELEASE_CODE -0 >= 7 * 256 + 6)", stmnt) + "RHEL_RELEASE_CODE -0 >= 7 * 256 + 5)", stmnt) gsub("defined\\(IB_QUERY_GID_HAS_ATTR_ARG\\)", "(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 4, 0) || " \ @@ -139,7 +139,7 @@ function evaluate(stmnt, pattern, arg, op, result) { gsub("defined\\(MAD_HANDLER_TAKES_SEND_BUF\\)", "(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0) || " \ - "RHEL_RELEASE_CODE -0 >= 7 * 256 + 6)", stmnt) + "RHEL_RELEASE_CODE -0 >= 7 * 256 + 5)", stmnt) gsub("defined\\(HAVE_IB_SET_CPI_RESP_TIME\\)", "(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0) || " \ @@ -608,7 +608,8 @@ function dump_lines() { for (i = 0; i < lines; i++) { modifier = (LINUX_VERSION_CODE < version_code("4.19.0") && (RHEL_MAJOR == "" || - RHEL_MAJOR * 256 + RHEL_MINOR < 7 * 256 + 8) ? + RHEL_MAJOR * 256 + RHEL_MINOR < 7 * 256 + 7 || + RHEL_MAJOR * 256 + RHEL_MINOR == 8 * 256 + 0) ? "" : "const"); gsub("BAD_WR_MODIFIER", modifier, line[i]) gsub("CM_HANDLER_EVENT_MODIFIER", modifier, line[i])