* [PATCH] UML: don't discard .text.exit section
[not found] <CAFLxGvzB=WGNEdNJVvPpQLpwCqT6oNcvEQnyT2xk0Jv2L3FBaA@mail.gmail.com>
@ 2016-08-17 15:10 ` Andrey Ryabinin
2016-08-17 17:11 ` Dmitry Vyukov
0 siblings, 1 reply; 11+ messages in thread
From: Andrey Ryabinin @ 2016-08-17 15:10 UTC (permalink / raw)
To: Jeff Dike, Richard Weinberger
Cc: user-mode-linux-devel, linux-kernel, Stefan Traby, Dmitry Vyukov,
stable, Andrey Ryabinin
Commit e41f501d3912 ("vmlinux.lds: account for destructor sections")
added '.text.exit' to EXIT_TEXT which is discarded at link time by default.
This breaks compilation of UML:
`.text.exit' referenced in section `.fini_array' of
/usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libc.a(sdlerror.o):
defined in discarded section `.text.exit' of
/usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libc.a(sdlerror.o)
Apparently UML doesn't want to discard exit text, so let's place all EXIT_TEXT
sections in .exit.text.
Fixes: e41f501d3912 ("vmlinux.lds: account for destructor sections")
Reported-by: Stefan Traby <stefan@hello-penguin.com>
Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
Cc: <stable@vger.kernel.org> # 4.0+
---
arch/um/include/asm/common.lds.S | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/um/include/asm/common.lds.S b/arch/um/include/asm/common.lds.S
index 1dd5bd8..1330553 100644
--- a/arch/um/include/asm/common.lds.S
+++ b/arch/um/include/asm/common.lds.S
@@ -81,7 +81,7 @@
.altinstr_replacement : { *(.altinstr_replacement) }
/* .exit.text is discard at runtime, not link time, to deal with references
from .altinstructions and .eh_frame */
- .exit.text : { *(.exit.text) }
+ .exit.text : { EXIT_TEXT }
.exit.data : { *(.exit.data) }
.preinit_array : {
--
2.7.3
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] UML: don't discard .text.exit section
2016-08-17 15:10 ` [PATCH] UML: don't discard .text.exit section Andrey Ryabinin
@ 2016-08-17 17:11 ` Dmitry Vyukov
2016-08-18 10:08 ` Andrey Ryabinin
0 siblings, 1 reply; 11+ messages in thread
From: Dmitry Vyukov @ 2016-08-17 17:11 UTC (permalink / raw)
To: Andrey Ryabinin
Cc: Jeff Dike, Richard Weinberger, user-mode-linux-devel, LKML,
Stefan Traby, stable
On Wed, Aug 17, 2016 at 8:10 AM, Andrey Ryabinin
<aryabinin@virtuozzo.com> wrote:
> Commit e41f501d3912 ("vmlinux.lds: account for destructor sections")
> added '.text.exit' to EXIT_TEXT which is discarded at link time by default.
> This breaks compilation of UML:
> `.text.exit' referenced in section `.fini_array' of
> /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libc.a(sdlerror.o):
> defined in discarded section `.text.exit' of
> /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libc.a(sdlerror.o)
>
> Apparently UML doesn't want to discard exit text, so let's place all EXIT_TEXT
> sections in .exit.text.
>
> Fixes: e41f501d3912 ("vmlinux.lds: account for destructor sections")
> Reported-by: Stefan Traby <stefan@hello-penguin.com>
> Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
> Cc: <stable@vger.kernel.org> # 4.0+
> ---
> arch/um/include/asm/common.lds.S | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/um/include/asm/common.lds.S b/arch/um/include/asm/common.lds.S
> index 1dd5bd8..1330553 100644
> --- a/arch/um/include/asm/common.lds.S
> +++ b/arch/um/include/asm/common.lds.S
> @@ -81,7 +81,7 @@
> .altinstr_replacement : { *(.altinstr_replacement) }
> /* .exit.text is discard at runtime, not link time, to deal with references
> from .altinstructions and .eh_frame */
> - .exit.text : { *(.exit.text) }
> + .exit.text : { EXIT_TEXT }
> .exit.data : { *(.exit.data) }
>
> .preinit_array : {
> --
> 2.7.3
>
Sorry for delays, I am travelling.
Do we need ".fini_array" section? It's also destructors that we don't
run. Or does UML use them? Does discarding ".fini_array" help?
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] UML: don't discard .text.exit section
2016-08-17 17:11 ` Dmitry Vyukov
@ 2016-08-18 10:08 ` Andrey Ryabinin
2016-08-19 0:14 ` Dmitry Vyukov
0 siblings, 1 reply; 11+ messages in thread
From: Andrey Ryabinin @ 2016-08-18 10:08 UTC (permalink / raw)
To: Dmitry Vyukov
Cc: Jeff Dike, Richard Weinberger, user-mode-linux-devel, LKML,
Stefan Traby, stable
On 08/17/2016 08:11 PM, Dmitry Vyukov wrote:
> On Wed, Aug 17, 2016 at 8:10 AM, Andrey Ryabinin
> <aryabinin@virtuozzo.com> wrote:
>> Commit e41f501d3912 ("vmlinux.lds: account for destructor sections")
>> added '.text.exit' to EXIT_TEXT which is discarded at link time by default.
>> This breaks compilation of UML:
>> `.text.exit' referenced in section `.fini_array' of
>> /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libc.a(sdlerror.o):
>> defined in discarded section `.text.exit' of
>> /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libc.a(sdlerror.o)
>>
>> Apparently UML doesn't want to discard exit text, so let's place all EXIT_TEXT
>> sections in .exit.text.
>>
>> Fixes: e41f501d3912 ("vmlinux.lds: account for destructor sections")
>> Reported-by: Stefan Traby <stefan@hello-penguin.com>
>> Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
>> Cc: <stable@vger.kernel.org> # 4.0+
>> ---
>> arch/um/include/asm/common.lds.S | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/um/include/asm/common.lds.S b/arch/um/include/asm/common.lds.S
>> index 1dd5bd8..1330553 100644
>> --- a/arch/um/include/asm/common.lds.S
>> +++ b/arch/um/include/asm/common.lds.S
>> @@ -81,7 +81,7 @@
>> .altinstr_replacement : { *(.altinstr_replacement) }
>> /* .exit.text is discard at runtime, not link time, to deal with references
>> from .altinstructions and .eh_frame */
>> - .exit.text : { *(.exit.text) }
>> + .exit.text : { EXIT_TEXT }
>> .exit.data : { *(.exit.data) }
>>
>> .preinit_array : {
>> --
>> 2.7.3
>>
>
>
> Sorry for delays, I am travelling.
> Do we need ".fini_array" section? It's also destructors that we don't
> run. Or does UML use them? Does discarding ".fini_array" help?
>
libc has desctructors and use them for whatever purpose it needs.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] UML: don't discard .text.exit section
2016-08-18 10:08 ` Andrey Ryabinin
@ 2016-08-19 0:14 ` Dmitry Vyukov
2016-08-19 10:48 ` Andrey Ryabinin
0 siblings, 1 reply; 11+ messages in thread
From: Dmitry Vyukov @ 2016-08-19 0:14 UTC (permalink / raw)
To: Andrey Ryabinin
Cc: Jeff Dike, Richard Weinberger, user-mode-linux-devel, LKML,
Stefan Traby, stable
On Thu, Aug 18, 2016 at 3:08 AM, Andrey Ryabinin
<aryabinin@virtuozzo.com> wrote:
>
>
> On 08/17/2016 08:11 PM, Dmitry Vyukov wrote:
>> On Wed, Aug 17, 2016 at 8:10 AM, Andrey Ryabinin
>> <aryabinin@virtuozzo.com> wrote:
>>> Commit e41f501d3912 ("vmlinux.lds: account for destructor sections")
>>> added '.text.exit' to EXIT_TEXT which is discarded at link time by default.
>>> This breaks compilation of UML:
>>> `.text.exit' referenced in section `.fini_array' of
>>> /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libc.a(sdlerror.o):
>>> defined in discarded section `.text.exit' of
>>> /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/libc.a(sdlerror.o)
>>>
>>> Apparently UML doesn't want to discard exit text, so let's place all EXIT_TEXT
>>> sections in .exit.text.
>>>
>>> Fixes: e41f501d3912 ("vmlinux.lds: account for destructor sections")
>>> Reported-by: Stefan Traby <stefan@hello-penguin.com>
>>> Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
>>> Cc: <stable@vger.kernel.org> # 4.0+
>>> ---
>>> arch/um/include/asm/common.lds.S | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/arch/um/include/asm/common.lds.S b/arch/um/include/asm/common.lds.S
>>> index 1dd5bd8..1330553 100644
>>> --- a/arch/um/include/asm/common.lds.S
>>> +++ b/arch/um/include/asm/common.lds.S
>>> @@ -81,7 +81,7 @@
>>> .altinstr_replacement : { *(.altinstr_replacement) }
>>> /* .exit.text is discard at runtime, not link time, to deal with references
>>> from .altinstructions and .eh_frame */
>>> - .exit.text : { *(.exit.text) }
>>> + .exit.text : { EXIT_TEXT }
>>> .exit.data : { *(.exit.data) }
>>>
>>> .preinit_array : {
>>> --
>>> 2.7.3
>>>
>>
>>
>> Sorry for delays, I am travelling.
>> Do we need ".fini_array" section? It's also destructors that we don't
>> run. Or does UML use them? Does discarding ".fini_array" help?
>>
>
> libc has desctructors and use them for whatever purpose it needs.
Does UML actually gracefully exit running global destructors? That
would also require gracefully shutting down all threads/cpus. Doesn't
it just _exit (or syscall(SYS_exit_group))?
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] UML: don't discard .text.exit section
2016-08-19 0:14 ` Dmitry Vyukov
@ 2016-08-19 10:48 ` Andrey Ryabinin
2016-08-19 11:16 ` Richard Weinberger
0 siblings, 1 reply; 11+ messages in thread
From: Andrey Ryabinin @ 2016-08-19 10:48 UTC (permalink / raw)
To: Dmitry Vyukov
Cc: Jeff Dike, Richard Weinberger, user-mode-linux-devel, LKML,
Stefan Traby, stable
On 08/19/2016 03:14 AM, Dmitry Vyukov wrote:
> On Thu, Aug 18, 2016 at 3:08 AM, Andrey Ryabinin
> <aryabinin@virtuozzo.com> wrote:
>>
>>>
>>> Sorry for delays, I am travelling.
>>> Do we need ".fini_array" section? It's also destructors that we don't
>>> run. Or does UML use them? Does discarding ".fini_array" help?
>>>
>>
>> libc has desctructors and use them for whatever purpose it needs.
>
>
> Does UML actually gracefully exit running global destructors? That
> would also require gracefully shutting down all threads/cpus. Doesn't
> it just _exit (or syscall(SYS_exit_group))?
>
Sigh, I dunno, I didn't look that far. My intention was to fix build and keep old behavior unaffected.
If you want to wipe destructors, and think that this is ok, go ahead.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] UML: don't discard .text.exit section
2016-08-19 10:48 ` Andrey Ryabinin
@ 2016-08-19 11:16 ` Richard Weinberger
2016-08-19 13:06 ` Andrey Ryabinin
0 siblings, 1 reply; 11+ messages in thread
From: Richard Weinberger @ 2016-08-19 11:16 UTC (permalink / raw)
To: Andrey Ryabinin, Dmitry Vyukov
Cc: Jeff Dike, user-mode-linux-devel, LKML, Stefan Traby, stable
On 19.08.2016 12:48, Andrey Ryabinin wrote:
> On 08/19/2016 03:14 AM, Dmitry Vyukov wrote:
>> On Thu, Aug 18, 2016 at 3:08 AM, Andrey Ryabinin
>> <aryabinin@virtuozzo.com> wrote:
>>>
>>>>
>>>> Sorry for delays, I am travelling.
>>>> Do we need ".fini_array" section? It's also destructors that we don't
>>>> run. Or does UML use them? Does discarding ".fini_array" help?
>>>>
>>>
>>> libc has desctructors and use them for whatever purpose it needs.
>>
>>
>> Does UML actually gracefully exit running global destructors? That
>> would also require gracefully shutting down all threads/cpus. Doesn't
>> it just _exit (or syscall(SYS_exit_group))?
>>
>
> Sigh, I dunno, I didn't look that far. My intention was to fix build and keep old behavior unaffected.
> If you want to wipe destructors, and think that this is ok, go ahead.
UML exits like any regular C program does.
The main() function is in arch/um/os-Linux/main.c, when the kernel terminates,
hence linux_main() returns back to main() it just returns the exit code.
At this point libc's destructors will run, right?
Thanks,
//richard
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] UML: don't discard .text.exit section
2016-08-19 11:16 ` Richard Weinberger
@ 2016-08-19 13:06 ` Andrey Ryabinin
2016-08-19 15:24 ` Dmitry Vyukov
0 siblings, 1 reply; 11+ messages in thread
From: Andrey Ryabinin @ 2016-08-19 13:06 UTC (permalink / raw)
To: Richard Weinberger, Dmitry Vyukov
Cc: Jeff Dike, user-mode-linux-devel, LKML, Stefan Traby, stable
On 08/19/2016 02:16 PM, Richard Weinberger wrote:
> On 19.08.2016 12:48, Andrey Ryabinin wrote:
>> On 08/19/2016 03:14 AM, Dmitry Vyukov wrote:
>>> On Thu, Aug 18, 2016 at 3:08 AM, Andrey Ryabinin
>>> <aryabinin@virtuozzo.com> wrote:
>>>>
>>>>>
>>>>> Sorry for delays, I am travelling.
>>>>> Do we need ".fini_array" section? It's also destructors that we don't
>>>>> run. Or does UML use them? Does discarding ".fini_array" help?
>>>>>
>>>>
>>>> libc has desctructors and use them for whatever purpose it needs.
>>>
>>>
>>> Does UML actually gracefully exit running global destructors? That
>>> would also require gracefully shutting down all threads/cpus. Doesn't
>>> it just _exit (or syscall(SYS_exit_group))?
>>>
>>
>> Sigh, I dunno, I didn't look that far. My intention was to fix build and keep old behavior unaffected.
>> If you want to wipe destructors, and think that this is ok, go ahead.
>
> UML exits like any regular C program does.
> The main() function is in arch/um/os-Linux/main.c, when the kernel terminates,
> hence linux_main() returns back to main() it just returns the exit code.
> At this point libc's destructors will run, right?
>
Sounds right to me.
> Thanks,
> //richard
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] UML: don't discard .text.exit section
2016-08-19 13:06 ` Andrey Ryabinin
@ 2016-08-19 15:24 ` Dmitry Vyukov
2016-08-22 20:10 ` Richard Weinberger
0 siblings, 1 reply; 11+ messages in thread
From: Dmitry Vyukov @ 2016-08-19 15:24 UTC (permalink / raw)
To: Andrey Ryabinin
Cc: Richard Weinberger, Jeff Dike, user-mode-linux-devel, LKML,
Stefan Traby, stable
On Fri, Aug 19, 2016 at 6:06 AM, Andrey Ryabinin
<aryabinin@virtuozzo.com> wrote:
>
>
> On 08/19/2016 02:16 PM, Richard Weinberger wrote:
>> On 19.08.2016 12:48, Andrey Ryabinin wrote:
>>> On 08/19/2016 03:14 AM, Dmitry Vyukov wrote:
>>>> On Thu, Aug 18, 2016 at 3:08 AM, Andrey Ryabinin
>>>> <aryabinin@virtuozzo.com> wrote:
>>>>>
>>>>>>
>>>>>> Sorry for delays, I am travelling.
>>>>>> Do we need ".fini_array" section? It's also destructors that we don't
>>>>>> run. Or does UML use them? Does discarding ".fini_array" help?
>>>>>>
>>>>>
>>>>> libc has desctructors and use them for whatever purpose it needs.
>>>>
>>>>
>>>> Does UML actually gracefully exit running global destructors? That
>>>> would also require gracefully shutting down all threads/cpus. Doesn't
>>>> it just _exit (or syscall(SYS_exit_group))?
>>>>
>>>
>>> Sigh, I dunno, I didn't look that far. My intention was to fix build and keep old behavior unaffected.
>>> If you want to wipe destructors, and think that this is ok, go ahead.
>>
>> UML exits like any regular C program does.
>> The main() function is in arch/um/os-Linux/main.c, when the kernel terminates,
>> hence linux_main() returns back to main() it just returns the exit code.
>> At this point libc's destructors will run, right?
>>
> Sounds right to me.
If it exits then
Acked-by: Dmitry Vyukov <dvyukov@google.com>
Thanks for taking care of it.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] UML: don't discard .text.exit section
2016-08-19 15:24 ` Dmitry Vyukov
@ 2016-08-22 20:10 ` Richard Weinberger
2016-08-23 9:59 ` Andrey Ryabinin
0 siblings, 1 reply; 11+ messages in thread
From: Richard Weinberger @ 2016-08-22 20:10 UTC (permalink / raw)
To: Dmitry Vyukov, Andrey Ryabinin
Cc: Jeff Dike, user-mode-linux-devel, LKML, Stefan Traby, stable
On 19.08.2016 17:24, Dmitry Vyukov wrote:
> If it exits then
>
> Acked-by: Dmitry Vyukov <dvyukov@google.com>
Andrey, shall I carry this patch through the UML tree or
do you have something else in mind?
Thanks,
//richard
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] UML: don't discard .text.exit section
2016-08-22 20:10 ` Richard Weinberger
@ 2016-08-23 9:59 ` Andrey Ryabinin
2016-08-23 21:40 ` Richard Weinberger
0 siblings, 1 reply; 11+ messages in thread
From: Andrey Ryabinin @ 2016-08-23 9:59 UTC (permalink / raw)
To: Richard Weinberger, Dmitry Vyukov
Cc: Jeff Dike, user-mode-linux-devel, LKML, Stefan Traby, stable
On 08/22/2016 11:10 PM, Richard Weinberger wrote:
> On 19.08.2016 17:24, Dmitry Vyukov wrote:
>> If it exits then
>>
>> Acked-by: Dmitry Vyukov <dvyukov@google.com>
>
> Andrey, shall I carry this patch through the UML tree or
> do you have something else in mind?
>
Take it in the UML tree please.
> Thanks,
> //richard
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] UML: don't discard .text.exit section
2016-08-23 9:59 ` Andrey Ryabinin
@ 2016-08-23 21:40 ` Richard Weinberger
0 siblings, 0 replies; 11+ messages in thread
From: Richard Weinberger @ 2016-08-23 21:40 UTC (permalink / raw)
To: Andrey Ryabinin, Dmitry Vyukov
Cc: Jeff Dike, user-mode-linux-devel, LKML, Stefan Traby, stable
On 23.08.2016 11:59, Andrey Ryabinin wrote:
>> Andrey, shall I carry this patch through the UML tree or
>> do you have something else in mind?
>>
>
> Take it in the UML tree please.
Ok! Applied to -next.
Thanks,
//richard
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2016-08-23 21:48 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CAFLxGvzB=WGNEdNJVvPpQLpwCqT6oNcvEQnyT2xk0Jv2L3FBaA@mail.gmail.com>
2016-08-17 15:10 ` [PATCH] UML: don't discard .text.exit section Andrey Ryabinin
2016-08-17 17:11 ` Dmitry Vyukov
2016-08-18 10:08 ` Andrey Ryabinin
2016-08-19 0:14 ` Dmitry Vyukov
2016-08-19 10:48 ` Andrey Ryabinin
2016-08-19 11:16 ` Richard Weinberger
2016-08-19 13:06 ` Andrey Ryabinin
2016-08-19 15:24 ` Dmitry Vyukov
2016-08-22 20:10 ` Richard Weinberger
2016-08-23 9:59 ` Andrey Ryabinin
2016-08-23 21:40 ` Richard Weinberger
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).