Skip to contentSkip to conversation

x86/vdso: drop implicit common-page-size linker flag

PATCH In review [email protected] 6 participants 17 messages Dec 6, 2018 – Dec 11, 2018

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/vdso: drop implicit common-page-size linker flag

These are implied by the target architecture and for x86_64 match the max-page-size. The default for non-NaCl x86_64 is 0x1000 (4096).

In bfd the common page size is defined as 0x1000 (4096) for non-NaCl x86_64 targets:

bfd/elf64-x86-64.c:
4998:#define ELF_COMMONPAGESIZE 0x1000

For gold, the common page size is defined as 0x1000 (4096) for non-NaCl x86_64 targets:

gold/x86_64.cc:
1413: 0x1000, // common_pagesize (overridable by -z common-page-size) 1442: 0x1000, // common_pagesize (overridable by -z common-page-size)

(ELF_COMMONPAGESIZE also defaults to ELF_MAXPAGESIZE when not set explicitly for a target architecture in bfd/elfxx-target.h, but that's not relevant for x86_64).

Because it's implied by the target architecture, it's of questionable use to implement in LLD. This patch resolves one of the issues towards using LLD to link an x86_64 kernel.

Fixes commit 2aae950b21e4 ("x86_64: Add vDSO for x86-64 with gettimeofday/clock_gettime/getcpu")

---
 arch/x86/entry/vdso/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/entry/vdso/Makefile +2 -2
index 141d415a8c80..0624bf2266fd 100644
@@ -47,7 +47,7 @@ targets += $(vdso_img_sodbg) $(vdso_img-y:%=vdso%.so)
 CPPFLAGS_vdso.lds += -P -C
 
 VDSO_LDFLAGS_vdso.lds = -m elf_x86_64 -soname linux-vdso.so.1 --no-undefined \
-			-z max-page-size=4096 -z common-page-size=4096
+			-z max-page-size=4096
 
 $(obj)/vdso64.so.dbg: $(obj)/vdso.lds $(vobjs) FORCE
 	$(call if_changed,vdso)
@@ -98,7 +98,7 @@ CFLAGS_REMOVE_vvar.o = -pg
 
 CPPFLAGS_vdsox32.lds = $(CPPFLAGS_vdso.lds)
 VDSO_LDFLAGS_vdsox32.lds = -m elf32_x86_64 -soname linux-vdso.so.1 \
-			   -z max-page-size=4096 -z common-page-size=4096
+			   -z max-page-size=4096
 
 # x32-rebranded versions
 vobjx32s-y := $(vobjs-y:.o=-x32.o)
Signature · 1 line
2.20.0.rc1.387.gf8505762e3-goog
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 17 lines · On Thu, Dec 6, 2018 at 11:12 AM <[email protected]> wrote:

These are implied by the target architecture and for x86_64 match the max-page-size. The default for non-NaCl x86_64 is 0x1000 (4096).

In bfd the common page size is defined as 0x1000 (4096) for non-NaCl x86_64 targets:

bfd/elf64-x86-64.c:
4998:#define ELF_COMMONPAGESIZE 0x1000

For gold, the common page size is defined as 0x1000 (4096) for non-NaCl x86_64 targets:

gold/x86_64.cc:
1413: 0x1000, // common_pagesize (overridable by -z common-page-size) 1442: 0x1000, // common_pagesize (overridable by -z common-page-size)

Quoted 7 lines

(ELF_COMMONPAGESIZE also defaults to ELF_MAXPAGESIZE when not set explicitly for a target architecture in bfd/elfxx-target.h, but that's not relevant for x86_64).

Because it's implied by the target architecture, it's of questionable use to implement in LLD. This patch resolves one of the issues towards using LLD to link an x86_64 kernel.

Sure.

maintainer
#2 lore raw
In reply to [email protected]
Quoted 4 lines · On Thu, Dec 06, 2018 at 11:12:31AM -0800, [email protected] wrote:

These are implied by the target architecture and for x86_64 match the max-page-size. The default for non-NaCl x86_64 is 0x1000 (4096).

In bfd the common page size is defined as 0x1000 (4096) for non-NaCl

Sodium Chloride?

Quoted 12 lines

x86_64 targets:

bfd/elf64-x86-64.c:
4998:#define ELF_COMMONPAGESIZE 0x1000

For gold, the common page size is defined as 0x1000 (4096) for non-NaCl x86_64 targets:

gold/x86_64.cc:
1413: 0x1000, // common_pagesize (overridable by -z common-page-size) 1442: 0x1000, // common_pagesize (overridable by -z common-page-size)

Quoted 7 lines

(ELF_COMMONPAGESIZE also defaults to ELF_MAXPAGESIZE when not set explicitly for a target architecture in bfd/elfxx-target.h, but that's not relevant for x86_64).

Because it's implied by the target architecture, it's of questionable use to implement in LLD. This patch resolves one of the issues towards using LLD to link an x86_64 kernel.

LLD?

I can only guess what this commit message is about and have to look at the patch itself and then look at the LD(1) man page and rhyme up what it is aiming to do.

How about rewriting it for mere mortals?

Thx.

Signature · 4 lines
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.
#3 lore raw
Quoted 8 lines · Borislav Petkov
Quoted 4 lines · On Thu, Dec 06, 2018 at 11:12:31AM -0800, [email protected] wrote:

These are implied by the target architecture and for x86_64 match the max-page-size. The default for non-NaCl x86_64 is 0x1000 (4096).

In bfd the common page size is defined as 0x1000 (4096) for non-NaCl

Sodium Chloride?

Google's Native Client, a technology for running native code in a web browser. It's since been superseded by Portable Native Client (pNaCl) and to an extent Web Assembly. It seems that BFD still contains code for NaCl.

Quoted 17 lines
Quoted 17 lines

x86_64 targets:

bfd/elf64-x86-64.c:
4998:#define ELF_COMMONPAGESIZE 0x1000

For gold, the common page size is defined as 0x1000 (4096) for non-NaCl x86_64 targets:

gold/x86_64.cc:
1413: 0x1000, // common_pagesize (overridable by -z common-page-size) 1442: 0x1000, // common_pagesize (overridable by -z common-page-size)

(ELF_COMMONPAGESIZE also defaults to ELF_MAXPAGESIZE when not set explicitly for a target architecture in bfd/elfxx-target.h, but that's not relevant for x86_64).

Quoted 5 lines
Quoted 3 lines

Because it's implied by the target architecture, it's of questionable use to implement in LLD. This patch resolves one of the issues towards using LLD to link an x86_64 kernel.

LLD?

LLD is LLVM's linker.
https://lld.llvm.org/

Quoted 6 lines

I can only guess what this commit message is about and have to look at the patch itself and then look at the LD(1) man page and rhyme up what it is aiming to do.

How about rewriting it for mere mortals?

How does this sound:
TL;DR
-z common-page-size's default value is based on the target architecture. arch/x86/entry/vdso/Makefile sets it to the architecture default, which is implicit and redundant. Drop it.

Signature · 2 lines
Thanks,
~Nick Desaulniers
maintainer
#4 lore raw
Quoted 4 lines · Nick Desaulniers

Google's Native Client, a technology for running native code in a web browser. It's since been superseded by Portable Native Client (pNaCl) and to an extent Web Assembly. It seems that BFD still contains code for NaCl.

Yeah, found the wikipedia page. :)

Quoted 5 lines

How does this sound:
TL;DR
-z common-page-size's default value is based on the target architecture. arch/x86/entry/vdso/Makefile sets it to the architecture default, which is implicit and redundant. Drop it.

Sure. Although the longer explanation gives more insight into the whole deal but that's fine too - the longer explanation is on the ML and we have the Link: tags.

So no need to resend - I'll simply take the three-liner above.

Thx.

Signature · 4 lines
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.
#5 lore raw
Quoted 15 lines · Borislav Petkov
Quoted 4 lines · Nick Desaulniers

Google's Native Client, a technology for running native code in a web browser. It's since been superseded by Portable Native Client (pNaCl) and to an extent Web Assembly. It seems that BFD still contains code for NaCl.

Yeah, found the wikipedia page. :)

Quoted 5 lines

How does this sound:
TL;DR
-z common-page-size's default value is based on the target architecture. arch/x86/entry/vdso/Makefile sets it to the architecture default, which is implicit and redundant. Drop it.

Quoted 5 lines

Sure. Although the longer explanation gives more insight into the whole deal but that's fine too - the longer explanation is on the ML and we have the Link: tags.

So no need to resend - I'll simply take the three-liner above.

Thanks, it's being set to the default value again for x86 usermode linux, arm, and for sparc. I'll send additional clean ups for those three.

Signature · 2 lines
Thanks,
~Nick Desaulniers
#6 lore raw

[tip:x86/urgent] x86/vdso: Drop implicit common-page-size linker flag

In reply to [email protected]
x86/vdso: Drop implicit common-page-size linker flag
Commit-ID:  ac3e233d29f7f77f28243af0132057d378d3ea58
Gitweb:     https://git.kernel.org/tip/ac3e233d29f7f77f28243af0132057d378d3ea58
Author:     Nick Desaulniers <[email protected]>
AuthorDate: Thu, 6 Dec 2018 11:12:31 -0800
Committer:  Borislav Petkov <[email protected]>
CommitDate: Fri, 7 Dec 2018 18:57:38 +0100

x86/vdso: Drop implicit common-page-size linker flag

GNU linker's -z common-page-size's default value is based on the target architecture. arch/x86/entry/vdso/Makefile sets it to the architecture default, which is implicit and redundant. Drop it.

---
 arch/x86/entry/vdso/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/entry/vdso/Makefile +2 -2
index 141d415a8c80..0624bf2266fd 100644
@@ -47,7 +47,7 @@ targets += $(vdso_img_sodbg) $(vdso_img-y:%=vdso%.so)
 CPPFLAGS_vdso.lds += -P -C
 
 VDSO_LDFLAGS_vdso.lds = -m elf_x86_64 -soname linux-vdso.so.1 --no-undefined \
-			-z max-page-size=4096 -z common-page-size=4096
+			-z max-page-size=4096
 
 $(obj)/vdso64.so.dbg: $(obj)/vdso.lds $(vobjs) FORCE
 	$(call if_changed,vdso)
@@ -98,7 +98,7 @@ CFLAGS_REMOVE_vvar.o = -pg
 
 CPPFLAGS_vdsox32.lds = $(CPPFLAGS_vdso.lds)
 VDSO_LDFLAGS_vdsox32.lds = -m elf32_x86_64 -soname linux-vdso.so.1 \
-			   -z max-page-size=4096 -z common-page-size=4096
+			   -z max-page-size=4096
 
 # x32-rebranded versions
 vobjx32s-y := $(vobjs-y:.o=-x32.o)
#7 lore raw

[tip:x86/build] x86/um/vdso: Drop implicit common-page-size linker flag

In reply to [email protected]
x86/um/vdso: Drop implicit common-page-size linker flag
Commit-ID:  f4313ba52f9caccfda6a55f991c84aba6726b88f
Gitweb:     https://git.kernel.org/tip/f4313ba52f9caccfda6a55f991c84aba6726b88f
Author:     [email protected] <[email protected]>
AuthorDate: Mon, 10 Dec 2018 14:27:16 -0800
Committer:  Borislav Petkov <[email protected]>
CommitDate: Tue, 11 Dec 2018 13:58:57 +0100

x86/um/vdso: Drop implicit common-page-size linker flag

GNU linker's -z common-page-size's default value is based on the target architecture. arch/x86/um/vdso/Makefile sets it to the architecture default, which is implicit and redundant. Drop it so that one more LLVM build issue gets addressed.

---
 arch/x86/um/vdso/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/um/vdso/Makefile +1 -1
index 822ccdba93ad..bf94060fc06f 100644
@@ -26,7 +26,7 @@ targets += vdso.so vdso.so.dbg vdso.lds $(vobjs-y)
 CPPFLAGS_vdso.lds += -P -C
 
 VDSO_LDFLAGS_vdso.lds = -m64 -Wl,-soname=linux-vdso.so.1 \
-       -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096
+       -Wl,-z,max-page-size=4096
 
 $(obj)/vdso.o: $(src)/vdso.S $(obj)/vdso.so
 
#8 lore raw

Re: [tip:x86/build] x86/um/vdso: Drop implicit common-page-size linker flag

Quoted 10 lines · On Tue, Dec 11, 2018 at 5:12 AM tip-bot for [email protected]…
Commit-ID:  f4313ba52f9caccfda6a55f991c84aba6726b88f
Gitweb:     https://git.kernel.org/tip/f4313ba52f9caccfda6a55f991c84aba6726b88f
Author:     [email protected] <[email protected]>
AuthorDate: Mon, 10 Dec 2018 14:27:16 -0800
Committer:  Borislav Petkov <[email protected]>
CommitDate: Tue, 11 Dec 2018 13:58:57 +0100

x86/um/vdso: Drop implicit common-page-size linker flag

Quoted 8 lines

GNU linker's -z common-page-size's default value is based on the target architecture. arch/x86/um/vdso/Makefile sets it to the architecture default, which is implicit and redundant. Drop it so that one more LLVM build issue gets addressed.

I missed Richard's ACK. Did it occur off list? I just want to confirm there's nothing wrong with my email client. Thank you for taking the patch either way.

Quoted 25 lines
---
 arch/x86/um/vdso/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/um/vdso/Makefile +1 -1
index 822ccdba93ad..bf94060fc06f 100644
@@ -26,7 +26,7 @@ targets += vdso.so vdso.so.dbg vdso.lds $(vobjs-y)
 CPPFLAGS_vdso.lds += -P -C
 
 VDSO_LDFLAGS_vdso.lds = -m64 -Wl,-soname=linux-vdso.so.1 \
-       -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096
+       -Wl,-z,max-page-size=4096
 
 $(obj)/vdso.o: $(src)/vdso.S $(obj)/vdso.so
 
Signature · 2 lines
Thanks,
~Nick Desaulniers
#9 lore raw

Re: [tip:x86/build] x86/um/vdso: Drop implicit common-page-size linker flag

Am Dienstag, 11. Dezember 2018, 18:39:45 CET schrieb Nick Desaulniers:

Quoted 17 lines
Quoted 15 lines · On Tue, Dec 11, 2018 at 5:12 AM tip-bot for [email protected]…
Commit-ID:  f4313ba52f9caccfda6a55f991c84aba6726b88f
Gitweb:     https://git.kernel.org/tip/f4313ba52f9caccfda6a55f991c84aba6726b88f
Author:     [email protected] <[email protected]>
AuthorDate: Mon, 10 Dec 2018 14:27:16 -0800
Committer:  Borislav Petkov <[email protected]>
CommitDate: Tue, 11 Dec 2018 13:58:57 +0100

x86/um/vdso: Drop implicit common-page-size linker flag

GNU linker's -z common-page-size's default value is based on the target architecture. arch/x86/um/vdso/Makefile sets it to the architecture default, which is implicit and redundant. Drop it so that one more LLVM build issue gets addressed.

Quoted 7 lines
Quoted 3 lines

I missed Richard's ACK. Did it occur off list? I just want to confirm there's nothing wrong with my email client. Thank you for taking the patch either way.

https://lore.kernel.org/lkml/1633144.08IGjMOzBB@blindfold/

Maybe google started to hate my mailserver (again).

Thanks,
//richard

maintainer
#10 lore raw

Re: [tip:x86/build] x86/um/vdso: Drop implicit common-page-size linker flag

Quoted 3 lines · Richard Weinberger

https://lore.kernel.org/lkml/1633144.08IGjMOzBB@blindfold/

Maybe google started to hate my mailserver (again).

You probably need DKIM fun. It is most likely marked as spam in his mbox.

Signature · 4 lines
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.
#11 lore raw

Re: [tip:x86/build] x86/um/vdso: Drop implicit common-page-size linker flag

Quoted 8 lines · Borislav Petkov
Quoted 3 lines · Richard Weinberger

https://lore.kernel.org/lkml/1633144.08IGjMOzBB@blindfold/

Maybe google started to hate my mailserver (again).

You probably need DKIM fun. It is most likely marked as spam in his mbox.

Indeed it was. I'm forced to use Gmail's clients for this work account and all that implies (no plain text responses when mobile). Man do I miss Thunderbird properly threading responses clearly by use of indentation. Gmail literally did not show any responses even in search for my patch (even from someone on the to/cc list!). Maybe I can file a bug about this internally...

Signature · 2 lines
Thanks,
~Nick Desaulniers
#12 lore raw

Re: [tip:x86/build] x86/um/vdso: Drop implicit common-page-size linker flag

Quoted 2 lines · Nick Desaulniers

Indeed it was. I'm forced to use Gmail's clients for this work account and all that implies (no plain text responses when mobile).

Can't you access it over imap?

Quoted 1 line

Maybe I can file a bug about this internally...

FWIW, people have looked for ways to report such issues in the past...

But in this particular case, DKIM is pretty good spam protection mechanism so enabling it is a good idea.

Signature · 4 lines
Regards/Gruss,
    Boris.

SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)
#13 lore raw

Re: [tip:x86/build] x86/um/vdso: Drop implicit common-page-size linker flag

Quoted 6 lines · Borislav Petkov
Quoted 2 lines · Nick Desaulniers

Indeed it was. I'm forced to use Gmail's clients for this work account and all that implies (no plain text responses when mobile).

Can't you access it over imap?

Personal gmail account, yes. Corporate gmail, no, IIUC. There was a pretty big internal thread where all of our kernel contributors got cut off one day and were scrambling to figure out how to send/review patches as their workflows were interrupted. Something is still not configured right when I send patches (maintainers have merged patches with my email address but no name, I assume from working with mbox files).

We have some internal tool that's smtp based but does the two factor authentication.

Quoted 7 lines
Quoted 2 lines

Maybe I can file a bug about this internally...

FWIW, people have looked for ways to report such issues in the past...

But in this particular case, DKIM is pretty good spam protection mechanism so enabling it is a good idea.

Internal Gmail developers were able to help me verify that SPF was setup correctly, but indeed there's no DKIM. This article has more
info: https://support.google.com/mail/answer/81126?hl=en. Richard, I don't know if that's a lot of work on your end, but other folks using gmail might have the same issue repeatedly with receiving emails from your domain otherwise.

Signature · 2 lines
Thanks,
~Nick Desaulniers
#14 lore raw

Re: [tip:x86/build] x86/um/vdso: Drop implicit common-page-size linker flag

Am Dienstag, 11. Dezember 2018, 20:08:30 CET schrieb Nick Desaulniers:

Quoted 9 lines
Quoted 2 lines

But in this particular case, DKIM is pretty good spam protection mechanism so enabling it is a good idea.

Internal Gmail developers were able to help me verify that SPF was setup correctly, but indeed there's no DKIM. This article has more
info: https://support.google.com/mail/answer/81126?hl=en. Richard, I don't know if that's a lot of work on your end, but other folks using gmail might have the same issue repeatedly with receiving emails from your domain otherwise.

Running your own mailserver is already a PITA, so adding a little more pain does not count in much more.
Thanks for talking to Gmail guys, I'll look into adding DKIM.

Thanks,
//richard

maintainer
#15 lore raw

Re: [tip:x86/build] x86/um/vdso: Drop implicit common-page-size linker flag

In reply to Nick Desaulniers
Quoted 4 lines · Nick Desaulniers

Personal gmail account, yes. Corporate gmail, no, IIUC. There was a pretty big internal thread where all of our kernel contributors got cut off one day and were scrambling to figure out how to send/review patches as their workflows were interrupted.

Gotta love all those stories of kernel people and corporate mail systems... And every company has its own strange idiosyncrasies...

Quoted 3 lines

Something is still not configured right when I send patches (maintainers have merged patches with my email address but no name, I assume from working with mbox files).

Yeah, had to fix that up today too. For some reason your git setup

X-Mailer: git-send-email 2.20.0.rc2.403.gdbc3b29805-goog

doesn't do names in From:

https://lkml.kernel.org/r/[email protected]

Quoted 2 lines

We have some internal tool that's smtp based but does the two factor authentication.

So some people send from !corporate mail servers but put their company's name in brackets to keep attribution:

For example. Dunno if that's something that would make sense for your case though.

Quoted 3 lines

Internal Gmail developers were able to help me verify that SPF was setup correctly, but indeed there's no DKIM. This article has more
info: https://support.google.com/mail/answer/81126?hl=en.

I know that one from my very recent past. :)

Quoted 3 lines

Richard, I don't know if that's a lot of work on your end, but other folks using gmail might have the same issue repeatedly with receiving emails from your domain otherwise.

We had to do that too for our domain.

Signature · 4 lines
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.
#16 lore raw

[tip:x86/build] x86/um/vdso: Drop implicit common-page-size linker flag

In reply to [email protected]
x86/um/vdso: Drop implicit common-page-size linker flag
Commit-ID:  e4f752dda0de351efd198f438b68e743029da68a
Gitweb:     https://git.kernel.org/tip/e4f752dda0de351efd198f438b68e743029da68a
Author:     Nick Desaulniers <[email protected]>
AuthorDate: Mon, 10 Dec 2018 14:27:16 -0800
Committer:  Borislav Petkov <[email protected]>
CommitDate: Tue, 11 Dec 2018 14:19:42 +0100

x86/um/vdso: Drop implicit common-page-size linker flag

GNU linker's -z common-page-size's default value is based on the target architecture. arch/x86/um/vdso/Makefile sets it to the architecture default, which is implicit and redundant. Drop it so that one more LLVM build issue gets addressed.

---
 arch/x86/um/vdso/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/um/vdso/Makefile +1 -1
index 822ccdba93ad..bf94060fc06f 100644
@@ -26,7 +26,7 @@ targets += vdso.so vdso.so.dbg vdso.lds $(vobjs-y)
 CPPFLAGS_vdso.lds += -P -C
 
 VDSO_LDFLAGS_vdso.lds = -m64 -Wl,-soname=linux-vdso.so.1 \
-       -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096
+       -Wl,-z,max-page-size=4096
 
 $(obj)/vdso.o: $(src)/vdso.S $(obj)/vdso.so