netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/1] net/core: work around section mismatch warning for ptp_classifier
@ 2019-04-15 17:14 Gerald Schaefer
  2019-04-15 17:14 ` [PATCH 1/1] " Gerald Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Gerald Schaefer @ 2019-04-15 17:14 UTC (permalink / raw)
  To: David S . Miller
  Cc: netdev, Ard Biesheuvel, Martin Schwidefsky, Heiko Carstens,
	Gerald Schaefer

While preparing KASLR for s390, I stumbled over a section mismatch warning
after enabling -fPIE compiler option:
WARNING: vmlinux.o(.data+0x31070): Section mismatch in reference from the
variable print_fmt_kfree_skb to the variable .init.data:ptp_filter.51760

I found a patch that would address this issue as part of a KASLR patch
series for ARM from Ard Biesheuvel:
https://marc.info/?l=kernel-hardening&m=150444052819798&w=2
https://marc.info/?l=kernel-hardening&m=150444051919794&w=2

That patch series did not make it upstream, and there seems to be no other
arch using -fpic/pie so far, so this fix is still missing.

Dave, could you please pick it up, as we will see this warning on s390
after my KASRL patches go upstream.

Ard Biesheuvel (1):
  net/core: work around section mismatch warning for ptp_classifier

 net/core/ptp_classifier.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

-- 
2.16.4


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/1] net/core: work around section mismatch warning for ptp_classifier
  2019-04-15 17:14 [PATCH 0/1] net/core: work around section mismatch warning for ptp_classifier Gerald Schaefer
@ 2019-04-15 17:14 ` Gerald Schaefer
  2019-04-17  3:46   ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Gerald Schaefer @ 2019-04-15 17:14 UTC (permalink / raw)
  To: David S . Miller
  Cc: netdev, Ard Biesheuvel, Martin Schwidefsky, Heiko Carstens,
	Gerald Schaefer

From: Ard Biesheuvel <ard.biesheuvel@linaro.org>

The routine ptp_classifier_init() uses an initializer for an
automatic struct type variable which refers to an __initdata
symbol. This is perfectly legal, but may trigger a section
mismatch warning when running the compiler in -fpic mode, due
to the fact that the initializer may be emitted into an anonymous
.data section thats lack the __init annotation. So work around it
by using assignments instead.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
---
 net/core/ptp_classifier.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/net/core/ptp_classifier.c b/net/core/ptp_classifier.c
index 703cf76aa7c2..7109c168b5e0 100644
--- a/net/core/ptp_classifier.c
+++ b/net/core/ptp_classifier.c
@@ -185,9 +185,10 @@ void __init ptp_classifier_init(void)
 		{ 0x16,  0,  0, 0x00000000 },
 		{ 0x06,  0,  0, 0x00000000 },
 	};
-	struct sock_fprog_kern ptp_prog = {
-		.len = ARRAY_SIZE(ptp_filter), .filter = ptp_filter,
-	};
+	struct sock_fprog_kern ptp_prog;
+
+	ptp_prog.len = ARRAY_SIZE(ptp_filter);
+	ptp_prog.filter = ptp_filter;
 
 	BUG_ON(bpf_prog_create(&ptp_insns, &ptp_prog));
 }
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] net/core: work around section mismatch warning for ptp_classifier
  2019-04-15 17:14 ` [PATCH 1/1] " Gerald Schaefer
@ 2019-04-17  3:46   ` David Miller
  0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2019-04-17  3:46 UTC (permalink / raw)
  To: gerald.schaefer; +Cc: netdev, ard.biesheuvel, schwidefsky, heiko.carstens

From: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Date: Mon, 15 Apr 2019 19:14:45 +0200

> From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> 
> The routine ptp_classifier_init() uses an initializer for an
> automatic struct type variable which refers to an __initdata
> symbol. This is perfectly legal, but may trigger a section
> mismatch warning when running the compiler in -fpic mode, due
> to the fact that the initializer may be emitted into an anonymous
> .data section thats lack the __init annotation. So work around it
> by using assignments instead.
> 
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>

Applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-04-17  3:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-15 17:14 [PATCH 0/1] net/core: work around section mismatch warning for ptp_classifier Gerald Schaefer
2019-04-15 17:14 ` [PATCH 1/1] " Gerald Schaefer
2019-04-17  3:46   ` David Miller

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).