linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Kees Cook <keescook@chromium.org>
Cc: kbuild test robot <fengguang.wu@intel.com>,
	kbuild-all@01.org, Mel Gorman <mgorman@suse.de>,
	Thomas Garnier <thgarnie@google.com>,
	Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: [mel:mm-vmscan-node-lru-v7r3 38/200] slub.c:undefined reference to `cache_random_seq_create'
Date: Wed, 15 Jun 2016 14:26:28 -0700	[thread overview]
Message-ID: <20160615142628.75bf404e7b48e239759f6994@linux-foundation.org> (raw)
In-Reply-To: <CAGXu5jJ-ga0pXVtkCFSS6tGnsuhhNxOOguexUU14_4fwa3Uaeg@mail.gmail.com>

On Wed, 15 Jun 2016 10:43:34 -0700 Kees Cook <keescook@chromium.org> wrote:

> >> I don't even get that far with that .config.  With gcc-4.4.4 I get
> >>
> >> init/built-in.o: In function `initcall_blacklisted':
> >> main.c:(.text+0x41): undefined reference to `__stack_chk_guard'
> >> main.c:(.text+0xbe): undefined reference to `__stack_chk_guard'
> >> init/built-in.o: In function `do_one_initcall':
> >> (.text+0xeb): undefined reference to `__stack_chk_guard'
> >> init/built-in.o: In function `do_one_initcall':
> >> (.text+0x22b): undefined reference to `__stack_chk_guard'
> >> init/built-in.o: In function `name_to_dev_t':
> >> (.text+0x320): undefined reference to `__stack_chk_guard'
> >> init/built-in.o:(.text+0x52e): more undefined references to `__stack_chk_guard'
> >
> > This, I don't. I'm scratching my head about how that's possible. The
> > __stack_chk_guard is a compiler alias on x86...
> >
> >> Kees touched it last :)
> >
> > I'll take a closer look tomorrow...
> 
> Stupid question: were you doing a build for x86?

Yes, x86_64.  Using Fengguang's .config.gz

> This error really
> shouldn't be possible since gcc defaults to tls for the guard on x86.
> I don't have gcc 4.4.4 easily available, but I don't think it even has
> the -mstack-protector-guard option to force this to change. (And I see
> no reference to this option in the kernel tree.) AFAICT this error
> should only happen when building with either
> -mstack-protector-guard=global or an architecture that forces that,
> along with some new code that triggers the stack protector but lacks
> the symbol at link time, which also seems impossible. :P

With gcc-4.8.4:

make V=1 init/main.o
...
  gcc -Wp,-MD,init/.main.o.d  -nostdinc -isystem /usr/lib/gcc/x86_64-linux-gnu/4.8/include -I./arch/x86/include -Iarch/x86/include/generated/uapi -Iarch/x86/include/generated  -Iinclude -I./arch/x86/include/uapi -Iarch/x86/include/generated/uapi -I./include/uapi -Iinclude/generated/uapi -include ./include/linux/kconfig.h -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mpreferred-stack-boundary=3 -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -DCONFIG_X86_X32_ABI -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_FXSAVEQ=1 -DCONFIG_AS_SSSE3=1 -DCONFIG_AS_CRC32=1 -DCONFIG_AS_AVX=1 -DCONFIG_AS_AVX2=1 -DCONFIG_AS_SHA1_NI=1 -DCONFIG_AS_SHA256_NI=1 -pipe -Wno-sign-compare -fn
 o-asynchronous-unwind-tables -fno-delete-null-pointer-checks -O2 --param=allow-store-data-races=0 -fno-reorder-blocks -fno-ipa-cp-clone -fno-partial-inlining -Wframe-larger-than=2048 -fstack-protector -Wno-unused-but-set-variable -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-var-tracking-assignments -fno-inline-functions-called-once -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -Werror=implicit-int -Werror=strict-prototypes -DCC_HAVE_ASM_GOTO      -DKBUILD_BASENAME='"main"'  -DKBUILD_MODNAME='"main"' -c -o init/.tmp_main.o init/main.c

(note: -fstack-protector)

akpm3:/usr/src/25> nm init/main.o | grep chk
                 U __stack_chk_fail



With gcc-4.4.4:

  /opt/crosstool/gcc-4.4.4-nolibc/x86_64-linux/bin/x86_64-linux-gcc -Wp,-MD,init/.main.o.d  -nostdinc -isystem /opt/crosstool/gcc-4.4.4-nolibc/x86_64-linux/bin/../lib/gcc/x86_64-linux/4.4.4/include -I./arch/x86/include -Iarch/x86/include/generated/uapi -Iarch/x86/include/generated  -Iinclude -I./arch/x86/include/uapi -Iarch/x86/include/generated/uapi -I./include/uapi -Iinclude/generated/uapi -include ./include/linux/kconfig.h -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -std=gnu89 -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m64 -falign-jumps=1 -falign-loops=1 -mno-80387 -mno-fp-ret-in-387 -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -DCONFIG_AS_CFI_SECTIONS=1 -DCONFIG_AS_FXSAVEQ=1 -DCONFIG_AS_SSSE3=1 -DCONFIG_AS_CRC32=1 -DCONFIG_AS_AVX=1 -pipe -Wno-sign-compare -fno-asynch
 ronous-unwind-tables -fno-delete-null-pointer-checks -O2 -fno-reorder-blocks -fno-ipa-cp-clone -Wframe-larger-than=2048 -fstack-protector -fno-omit-frame-pointer -fno-optimize-sibling-calls -fno-inline-functions-called-once -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -Werror=implicit-int -Werror=strict-prototypes      -DKBUILD_BASENAME='"main"'  -DKBUILD_MODNAME='"main"' -c -o init/.tmp_main.o init/main.c
arch/x86/Makefile:133: stack-protector enabled but compiler support broken
arch/x86/Makefile:148: CONFIG_X86_X32 enabled but no binutils support
Makefile:687: Cannot use CONFIG_KCOV: -fsanitize-coverage=trace-pc is not supported by compiler
Makefile:1041: "Cannot use CONFIG_STACK_VALIDATION, please install libelf-dev or elfutils-libelf-devel"

We still have -fstack-proector but at least we got a build-time warning
this time.

akpm3:/usr/src/25> nm init/main.o | grep chk
                 U __stack_chk_fail
                 U __stack_chk_guard

The build system should be handling this automatically - we shouldn't
be failing the build and then requiring the user to go fiddle Kconfig.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2016-06-15 21:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-13 19:37 kbuild test robot
2016-06-13 21:11 ` Andrew Morton
2016-06-13 23:51   ` Kees Cook
2016-06-15 17:43     ` Kees Cook
2016-06-15 21:26       ` Andrew Morton [this message]
2016-06-15 22:37         ` Kees Cook
2016-06-15 22:44           ` Andrew Morton
2016-06-15 22:53             ` Kees Cook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160615142628.75bf404e7b48e239759f6994@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=fengguang.wu@intel.com \
    --cc=kbuild-all@01.org \
    --cc=keescook@chromium.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=thgarnie@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox