From: Masahiro Yamada <yamada.masahiro@socionext.com>
To: Gabriel C <nix.or.die@gmail.com>
Cc: "Kirill A. Shutemov" <kirill@shutemov.name>,
Benjamin Gilbert <bgilbert@redhat.com>,
linux-x86_64@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Ingo Molnar <mingo@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
"H. Peter Anvin" <hpa@zytor.com>, X86 ML <x86@kernel.org>,
bero@lindev.ch, Andi Kleen <ak@linux.intel.com>,
Michal Marek <michal.lkml@markovi.net>
Subject: Re: 4.17.x won't boot due to "x86/boot/compressed/64: Handle 5-level paging boot if kernel is above 4G"
Date: Sat, 7 Jul 2018 09:55:58 +0900 [thread overview]
Message-ID: <CAK7LNASt3E178H8Ho0+bh3mTvE=3UF6Fj9AX=vWCZ=mWX-72jg@mail.gmail.com> (raw)
In-Reply-To: <CAEJqkgiSDdu7a6VyhsrA=rnjevyz2VZZdRVRHBgYHkmHjvAULw@mail.gmail.com>
2018-07-06 23:39 GMT+09:00 Gabriel C <nix.or.die@gmail.com>:
> 2018-07-06 16:13 GMT+02:00 Masahiro Yamada <yamada.masahiro@socionext.com>:
>> Hi.
>>
>> 2018-07-06 19:41 GMT+09:00 Kirill A. Shutemov <kirill@shutemov.name>:
>>> On Fri, Jul 06, 2018 at 03:37:58PM +0900, Masahiro Yamada wrote:
>>>> >> > > Also see https://bugzilla.kernel.org/show_bug.cgi?id=200385 ,
>>>> >> > >
>>>> >> > > 0a1756bd2897951c03c1cb671bdfd40729ac2177 is acting up
>>>> >> > > too with the same symptoms
>>>> >> >
>>>> >> > I tracked it down to -flto in LDFLAGS. I'll look more into this.
>>>> >>
>>>> >> -flto in LDFLAGS screws up this part of paging_prepare():
>>>> >
>>>> > +Masahiro, Michal.
>>>> >
>>>> > I've got it wrong. *Any* LDFLAGS option passed to make this way:
>>>> >
>>>> > make LDFLAGS="..."
>>>> >
>>>> > would cause a issue. Even empty.
>>>> >
>>>> > It overrides all assignments to the variable in the makefile.
>>>> > As result the image is built without -pie and linker doesn't generate
>>>> > position independed code.
>>>> >
>>>> > Looks like the patch below helps, but my make-fu is poor.
>>>> > I don't see many override directives in kernel makefiles.
>>>> > It makes me think that there's a better way to fix this.
>>>> >
>>>> > Hm?
>>>>
>>>>
>>>> LDFLAGS is for internal-use.
>>>> Please do not override it from the command line.
>>>
>>> Can we generate a build error if a user try to override LDFLAGS, CFLAGS or
>>> other critical internal-use-only variables?
>>
>> Yes, Make can check where variables came from.
>>
>>
>>> This breakage was rather hard to debug. We need to have some kind of
>>> fail-safe for the future.
>>>
>>>> You want to pass your own linker flags
>>>> for building vmlinux and modules,
>>>> but do not want to pass them to
>>>> the decompressor (arch/x86/boot/compressed).
>>>>
>>>> Correct?
>>>
>>> I personally don't think that changing compiler/linker options for kernel
>>> build is good idea in general.
>>>
>>>> Kbuild provides a way for users
>>>> to pass additional linker flags to modules.
>>>> (LDFLAGS_MODULE)
>>>>
>>>>
>>>> But, there is no way to do that for vmlinux.
>>>>
>>>> It is easy to support it, though.
>>>>
>>>> https://patchwork.kernel.org/patch/10510833/
>>>>
>>>> If this is the one you want, I can merge this.
>>>>
>>>>
>>>> make LDFLAGS_KERNEL=... LDFLAGS_MODULE=...
>>>> will allow you to append linker flags.
>>>
>>> Okay. It makes me wounder if we should taint kernel in such cases?
>>> Custom compiler/linker flags are risky and can lead to weird bugs.
>>
>> OK.
>> So, what problem are we discussing?
>>
>>
>>> I've got it wrong. *Any* LDFLAGS option passed to make this way:
>>>
>>> make LDFLAGS="..."
>>
>> In your previous mail, I thought you were asking me how to pass
>> custom linker flags.
>>
>> If not, we do not need to think about that case.
>> Just say "Do not do that".
>
> I am sorry but I have a hard time to get your logic here.
>
> You are saying : the *env* variable LDFLAGS as well passing
> LDFLAGS to make , which your build allows should not be use
> because is for 'internal usage' .. ?
>
> Well that logic you have here is wrong and wrong for any project
> not just for the kernel,
Why 'my logic'?
LDFLAGS has been long used internally since the old days,
before I ever worked on the kernel.
I shared my knowledge about the kernel build system.
The current situation is not nice,
but why are you blaming me for the code I did not add ?
Note:
I have never said 'the *env* variable LDFLAGS'
> If you know 'parts' need have particular flags then 'you' have to
> ensure nothing
> overrides these or nothing at all can chage these.
>
> So swap your logic and apped LDFLAGS to your private
> 'call_it_whatever_you_wish_KERNEL_NEED_BE_THERE_ANY_KIND_FLAGS'
> and don't allow these to be changed at all , when you
> *know* they have be there.
>
>
> Teling users to not use LD/C/CXX flags is not really going to work right ?
>
>
> BR
--
Best Regards
Masahiro Yamada
next prev parent reply other threads:[~2018-07-07 0:57 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAF=P+=5c-baQp-CK1ViG8h=mMRv6d3EgEsN_U4rbBx-Pwv_Krw@mail.gmail.com>
2018-07-01 21:32 ` 4.17.x won't boot due to "x86/boot/compressed/64: Handle 5-level paging boot if kernel is above 4G" Benjamin Gilbert
2018-07-02 9:34 ` Kirill A. Shutemov
2018-07-02 19:01 ` Benjamin Gilbert
2018-07-03 8:30 ` Kirill A. Shutemov
2018-07-03 8:59 ` Thomas Gleixner
2018-07-03 11:01 ` Kirill A. Shutemov
2018-07-03 11:24 ` Gabriel C
2018-07-03 12:44 ` Kirill A. Shutemov
2018-07-03 14:02 ` Thomas Gleixner
2018-07-03 14:07 ` Bernhard Rosenkraenzer
2018-07-03 14:19 ` Thomas Gleixner
2018-07-03 14:21 ` Kirill A. Shutemov
2018-07-03 14:27 ` Thomas Gleixner
2018-07-03 18:03 ` Andi Kleen
2018-07-03 20:26 ` Kirill A. Shutemov
2018-07-03 21:00 ` Andi Kleen
2018-07-04 3:10 ` Benjamin Gilbert
2018-07-04 13:21 ` Kirill A. Shutemov
2018-07-04 15:08 ` Kirill A. Shutemov
2018-07-04 20:42 ` Benjamin Gilbert
2018-07-06 6:37 ` Masahiro Yamada
2018-07-06 10:41 ` Kirill A. Shutemov
2018-07-06 14:13 ` Masahiro Yamada
2018-07-06 14:39 ` Gabriel C
2018-07-06 16:33 ` Kirill A. Shutemov
2018-07-06 17:31 ` Gabriel C
2018-07-07 0:55 ` Masahiro Yamada [this message]
2018-07-06 16:29 ` Kirill A. Shutemov
2018-07-06 18:11 ` Andi Kleen
2018-07-06 19:34 ` Benjamin Gilbert
2018-07-07 1:21 ` Masahiro Yamada
2018-07-09 10:10 ` Kirill A. Shutemov
2018-07-09 10:37 ` Masahiro Yamada
2018-07-25 17:26 Dmitry Malkin
2018-07-25 21:21 ` Kirill A. Shutemov
2018-07-26 8:10 ` Dmitry Malkin
2018-07-26 14:50 ` Kirill A. Shutemov
2018-07-26 16:21 ` Dmitry Malkin
2018-07-27 13:46 ` Kirill A. Shutemov
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='CAK7LNASt3E178H8Ho0+bh3mTvE=3UF6Fj9AX=vWCZ=mWX-72jg@mail.gmail.com' \
--to=yamada.masahiro@socionext.com \
--cc=ak@linux.intel.com \
--cc=bero@lindev.ch \
--cc=bgilbert@redhat.com \
--cc=hpa@zytor.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=kirill@shutemov.name \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-x86_64@vger.kernel.org \
--cc=michal.lkml@markovi.net \
--cc=mingo@kernel.org \
--cc=nix.or.die@gmail.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).