lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Sun,  9 Dec 2018 11:27:15 +0800
From:   Xiaozhou Liu <liuxiaozhou@...edance.com>
To:     miguel.ojeda.sandonis@...il.com
Cc:     linux-kernel@...r.kernel.org, torvalds@...ux-foundation.org,
        Xiaozhou Liu <liuxiaozhou@...edance.com>
Subject: [PATCH v2] Compiler Attributes: don't pollute userspace with macro definitions

Macros 'inline' and '__gnu_inline' used to be defined within __KERNEL__.
Commit 815f0ddb346c ("include/linux/compiler*.h: make compiler-*.h mutually
exclusive") had them exposed to userspace (unintentionally).

Then commit a3f8a30f3f00 ("Compiler Attributes: use feature checks instead
of version checks") moved __gnu_inline back into __KERNEL__ and inline
was left behind. Since inline depends on __gnu_inline, compiling error
showing "unknown type name ‘__gnu_inline’" will pop up, if userspace
somehow includes <linux/compiler.h>.

Other macros like __must_check, notrace, etc. used to be defined within
__KERNEL__ too. So just move these macros back into __KERNEL__.

v2: update commit message.

Signed-off-by: Xiaozhou Liu <liuxiaozhou@...edance.com>
---
 include/linux/compiler_types.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h
index 4a3f9c09c92d..9e23ec015221 100644
--- a/include/linux/compiler_types.h
+++ b/include/linux/compiler_types.h
@@ -161,6 +161,8 @@ struct ftrace_likely_data {
 #define __diag_error(compiler, version, option, comment) \
 	__diag_ ## compiler(version, error, option)
 
+#ifdef __KERNEL__
+
 #ifdef CONFIG_ENABLE_MUST_CHECK
 #define __must_check		__attribute__((__warn_unused_result__))
 #else
@@ -215,4 +217,6 @@ struct ftrace_likely_data {
  */
 #define noinline_for_stack noinline
 
+#endif /* __KERNEL */
+
 #endif /* __LINUX_COMPILER_TYPES_H */
-- 
2.11.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ