Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'kbuild-fixes-v4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild

Pull Kbuild fixes from Masahiro Yamada:

- introduce __diag_* macros and suppress -Wattribute-alias warnings
from GCC 8

- fix stack protector test script for x86_64

- fix line number handling in Kconfig

- document that '#' starts a comment in Kconfig

- handle P_SYMBOL property in dump debugging of Kconfig

- correct help message of LD_DEAD_CODE_DATA_ELIMINATION

- fix occasional segmentation faults in Kconfig

* tag 'kbuild-fixes-v4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
kconfig: loop boundary condition fix
kbuild: reword help of LD_DEAD_CODE_DATA_ELIMINATION
kconfig: handle P_SYMBOL in print_symbol()
kconfig: document Kconfig source file comments
kconfig: fix line numbers for if-entries in menu tree
stack-protector: Fix test with 32-bit userland and CONFIG_64BIT=y
powerpc: Remove -Wattribute-alias pragmas
disable -Wattribute-alias warning for SYSCALL_DEFINEx()
kbuild: add macro for controlling warnings to linux/compiler.h

+74 -41
+6
Documentation/kbuild/kconfig-language.txt
··· 430 430 to use it. It should be placed at the top of the configuration, before any 431 431 other statement. 432 432 433 + '#' Kconfig source file comment: 434 + 435 + An unquoted '#' character anywhere in a source file line indicates 436 + the beginning of a source file comment. The remainder of that line 437 + is a comment. 438 + 433 439 434 440 Kconfig hints 435 441 -------------
-4
arch/powerpc/kernel/pci_32.c
··· 285 285 * Note that the returned IO or memory base is a physical address 286 286 */ 287 287 288 - #pragma GCC diagnostic push 289 - #pragma GCC diagnostic ignored "-Wpragmas" 290 - #pragma GCC diagnostic ignored "-Wattribute-alias" 291 288 SYSCALL_DEFINE3(pciconfig_iobase, long, which, 292 289 unsigned long, bus, unsigned long, devfn) 293 290 { ··· 310 313 311 314 return result; 312 315 } 313 - #pragma GCC diagnostic pop
-4
arch/powerpc/kernel/pci_64.c
··· 203 203 #define IOBASE_ISA_IO 3 204 204 #define IOBASE_ISA_MEM 4 205 205 206 - #pragma GCC diagnostic push 207 - #pragma GCC diagnostic ignored "-Wpragmas" 208 - #pragma GCC diagnostic ignored "-Wattribute-alias" 209 206 SYSCALL_DEFINE3(pciconfig_iobase, long, which, unsigned long, in_bus, 210 207 unsigned long, in_devfn) 211 208 { ··· 256 259 257 260 return -EOPNOTSUPP; 258 261 } 259 - #pragma GCC diagnostic pop 260 262 261 263 #ifdef CONFIG_NUMA 262 264 int pcibus_to_node(struct pci_bus *bus)
-4
arch/powerpc/kernel/rtas.c
··· 1051 1051 } 1052 1052 1053 1053 /* We assume to be passed big endian arguments */ 1054 - #pragma GCC diagnostic push 1055 - #pragma GCC diagnostic ignored "-Wpragmas" 1056 - #pragma GCC diagnostic ignored "-Wattribute-alias" 1057 1054 SYSCALL_DEFINE1(rtas, struct rtas_args __user *, uargs) 1058 1055 { 1059 1056 struct rtas_args args; ··· 1137 1140 1138 1141 return 0; 1139 1142 } 1140 - #pragma GCC diagnostic pop 1141 1143 1142 1144 /* 1143 1145 * Call early during boot, before mem init, to retrieve the RTAS
-8
arch/powerpc/kernel/signal_32.c
··· 1038 1038 } 1039 1039 #endif 1040 1040 1041 - #pragma GCC diagnostic push 1042 - #pragma GCC diagnostic ignored "-Wpragmas" 1043 - #pragma GCC diagnostic ignored "-Wattribute-alias" 1044 1041 #ifdef CONFIG_PPC64 1045 1042 COMPAT_SYSCALL_DEFINE3(swapcontext, struct ucontext __user *, old_ctx, 1046 1043 struct ucontext __user *, new_ctx, int, ctx_size) ··· 1131 1134 set_thread_flag(TIF_RESTOREALL); 1132 1135 return 0; 1133 1136 } 1134 - #pragma GCC diagnostic pop 1135 1137 1136 1138 #ifdef CONFIG_PPC64 1137 1139 COMPAT_SYSCALL_DEFINE0(rt_sigreturn) ··· 1227 1231 return 0; 1228 1232 } 1229 1233 1230 - #pragma GCC diagnostic push 1231 - #pragma GCC diagnostic ignored "-Wpragmas" 1232 - #pragma GCC diagnostic ignored "-Wattribute-alias" 1233 1234 #ifdef CONFIG_PPC32 1234 1235 SYSCALL_DEFINE3(debug_setcontext, struct ucontext __user *, ctx, 1235 1236 int, ndbg, struct sig_dbg_op __user *, dbg) ··· 1330 1337 return 0; 1331 1338 } 1332 1339 #endif 1333 - #pragma GCC diagnostic pop 1334 1340 1335 1341 /* 1336 1342 * OK, we're invoking a handler
-4
arch/powerpc/kernel/signal_64.c
··· 625 625 /* 626 626 * Handle {get,set,swap}_context operations 627 627 */ 628 - #pragma GCC diagnostic push 629 - #pragma GCC diagnostic ignored "-Wpragmas" 630 - #pragma GCC diagnostic ignored "-Wattribute-alias" 631 628 SYSCALL_DEFINE3(swapcontext, struct ucontext __user *, old_ctx, 632 629 struct ucontext __user *, new_ctx, long, ctx_size) 633 630 { ··· 690 693 set_thread_flag(TIF_RESTOREALL); 691 694 return 0; 692 695 } 693 - #pragma GCC diagnostic pop 694 696 695 697 696 698 /*
-4
arch/powerpc/kernel/syscalls.c
··· 62 62 return ret; 63 63 } 64 64 65 - #pragma GCC diagnostic push 66 - #pragma GCC diagnostic ignored "-Wpragmas" 67 - #pragma GCC diagnostic ignored "-Wattribute-alias" 68 65 SYSCALL_DEFINE6(mmap2, unsigned long, addr, size_t, len, 69 66 unsigned long, prot, unsigned long, flags, 70 67 unsigned long, fd, unsigned long, pgoff) ··· 75 78 { 76 79 return do_mmap2(addr, len, prot, flags, fd, offset, PAGE_SHIFT); 77 80 } 78 - #pragma GCC diagnostic pop 79 81 80 82 #ifdef CONFIG_PPC32 81 83 /*
-4
arch/powerpc/mm/subpage-prot.c
··· 186 186 * in a 2-bit field won't allow writes to a page that is otherwise 187 187 * write-protected. 188 188 */ 189 - #pragma GCC diagnostic push 190 - #pragma GCC diagnostic ignored "-Wpragmas" 191 - #pragma GCC diagnostic ignored "-Wattribute-alias" 192 189 SYSCALL_DEFINE3(subpage_prot, unsigned long, addr, 193 190 unsigned long, len, u32 __user *, map) 194 191 { ··· 269 272 up_write(&mm->mmap_sem); 270 273 return err; 271 274 } 272 - #pragma GCC diagnostic pop
+7 -1
include/linux/compat.h
··· 72 72 */ 73 73 #ifndef COMPAT_SYSCALL_DEFINEx 74 74 #define COMPAT_SYSCALL_DEFINEx(x, name, ...) \ 75 + __diag_push(); \ 76 + __diag_ignore(GCC, 8, "-Wattribute-alias", \ 77 + "Type aliasing is used to sanitize syscall arguments");\ 75 78 asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \ 76 79 asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \ 77 80 __attribute__((alias(__stringify(__se_compat_sys##name)))); \ ··· 83 80 asmlinkage long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \ 84 81 asmlinkage long __se_compat_sys##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \ 85 82 { \ 86 - return __do_compat_sys##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__));\ 83 + long ret = __do_compat_sys##name(__MAP(x,__SC_DELOUSE,__VA_ARGS__));\ 84 + __MAP(x,__SC_TEST,__VA_ARGS__); \ 85 + return ret; \ 87 86 } \ 87 + __diag_pop(); \ 88 88 static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) 89 89 #endif /* COMPAT_SYSCALL_DEFINEx */ 90 90
+25
include/linux/compiler-gcc.h
··· 347 347 #if GCC_VERSION >= 50100 348 348 #define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1 349 349 #endif 350 + 351 + /* 352 + * Turn individual warnings and errors on and off locally, depending 353 + * on version. 354 + */ 355 + #define __diag_GCC(version, severity, s) \ 356 + __diag_GCC_ ## version(__diag_GCC_ ## severity s) 357 + 358 + /* Severity used in pragma directives */ 359 + #define __diag_GCC_ignore ignored 360 + #define __diag_GCC_warn warning 361 + #define __diag_GCC_error error 362 + 363 + /* Compilers before gcc-4.6 do not understand "#pragma GCC diagnostic push" */ 364 + #if GCC_VERSION >= 40600 365 + #define __diag_str1(s) #s 366 + #define __diag_str(s) __diag_str1(s) 367 + #define __diag(s) _Pragma(__diag_str(GCC diagnostic s)) 368 + #endif 369 + 370 + #if GCC_VERSION >= 80000 371 + #define __diag_GCC_8(s) __diag(s) 372 + #else 373 + #define __diag_GCC_8(s) 374 + #endif
+18
include/linux/compiler_types.h
··· 271 271 # define __native_word(t) (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long)) 272 272 #endif 273 273 274 + #ifndef __diag 275 + #define __diag(string) 276 + #endif 277 + 278 + #ifndef __diag_GCC 279 + #define __diag_GCC(version, severity, string) 280 + #endif 281 + 282 + #define __diag_push() __diag(push) 283 + #define __diag_pop() __diag(pop) 284 + 285 + #define __diag_ignore(compiler, version, option, comment) \ 286 + __diag_ ## compiler(version, ignore, option) 287 + #define __diag_warn(compiler, version, option, comment) \ 288 + __diag_ ## compiler(version, warn, option) 289 + #define __diag_error(compiler, version, option, comment) \ 290 + __diag_ ## compiler(version, error, option) 291 + 274 292 #endif /* __LINUX_COMPILER_TYPES_H */
+4
include/linux/syscalls.h
··· 231 231 */ 232 232 #ifndef __SYSCALL_DEFINEx 233 233 #define __SYSCALL_DEFINEx(x, name, ...) \ 234 + __diag_push(); \ 235 + __diag_ignore(GCC, 8, "-Wattribute-alias", \ 236 + "Type aliasing is used to sanitize syscall arguments");\ 234 237 asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \ 235 238 __attribute__((alias(__stringify(__se_sys##name)))); \ 236 239 ALLOW_ERROR_INJECTION(sys##name, ERRNO); \ ··· 246 243 __PROTECT(x, ret,__MAP(x,__SC_ARGS,__VA_ARGS__)); \ 247 244 return ret; \ 248 245 } \ 246 + __diag_pop(); \ 249 247 static inline long __do_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) 250 248 #endif /* __SYSCALL_DEFINEx */ 251 249
+3 -4
init/Kconfig
··· 1051 1051 depends on HAVE_LD_DEAD_CODE_DATA_ELIMINATION 1052 1052 depends on EXPERT 1053 1053 help 1054 - Select this if the architecture wants to do dead code and 1055 - data elimination with the linker by compiling with 1056 - -ffunction-sections -fdata-sections, and linking with 1057 - --gc-sections. 1054 + Enable this if you want to do dead code and data elimination with 1055 + the linker by compiling with -ffunction-sections -fdata-sections, 1056 + and linking with --gc-sections. 1058 1057 1059 1058 This can reduce on disk and in-memory size of the kernel 1060 1059 code and static data, particularly for small configs and
+1 -1
scripts/gcc-x86_64-has-stack-protector.sh
··· 1 1 #!/bin/sh 2 2 # SPDX-License-Identifier: GPL-2.0 3 3 4 - echo "int foo(void) { char X[200]; return 3; }" | $* -S -x c -c -O0 -mcmodel=kernel -fno-PIE -fstack-protector - -o - 2> /dev/null | grep -q "%gs" 4 + echo "int foo(void) { char X[200]; return 3; }" | $* -S -x c -c -m64 -O0 -mcmodel=kernel -fno-PIE -fstack-protector - -o - 2> /dev/null | grep -q "%gs"
+3
scripts/kconfig/expr.h
··· 171 171 * config BAZ 172 172 * int "BAZ Value" 173 173 * range 1..255 174 + * 175 + * Please, also check zconf.y:print_symbol() when modifying the 176 + * list of property types! 174 177 */ 175 178 enum prop_type { 176 179 P_UNKNOWN,
+1 -1
scripts/kconfig/preprocess.c
··· 156 156 nread--; 157 157 158 158 /* remove trailing new lines */ 159 - while (buf[nread - 1] == '\n') 159 + while (nread > 0 && buf[nread - 1] == '\n') 160 160 nread--; 161 161 162 162 buf[nread] = 0;
+6 -2
scripts/kconfig/zconf.y
··· 31 31 static struct menu *current_menu, *current_entry; 32 32 33 33 %} 34 - %expect 32 34 + %expect 31 35 35 36 36 %union 37 37 { ··· 337 337 338 338 /* if entry */ 339 339 340 - if_entry: T_IF expr nl 340 + if_entry: T_IF expr T_EOL 341 341 { 342 342 printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno()); 343 343 menu_add_entry(NULL); ··· 716 716 fputs( " menu ", out); 717 717 print_quoted_string(out, prop->text); 718 718 fputc('\n', out); 719 + break; 720 + case P_SYMBOL: 721 + fputs( " symbol ", out); 722 + fprintf(out, "%s\n", prop->sym->name); 719 723 break; 720 724 default: 721 725 fprintf(out, " unknown prop %d!\n", prop->type);