* [PATCH] selftests: mptcp: extend CFLAGS to keep options from environment
@ 2025-01-23 8:35 Jan Stancek
2025-01-23 8:39 ` Hangbin Liu
0 siblings, 1 reply; 5+ messages in thread
From: Jan Stancek @ 2025-01-23 8:35 UTC (permalink / raw)
To: matttbe, martineau, eliang; +Cc: netdev, mptcp, haliu, linux-kselftest
Package build environments like Fedora rpmbuild introduced hardening
options (e.g. -pie -Wl,-z,now) by passing a -spec option to CFLAGS
and LDFLAGS.
mptcp Makefile currently overrides CFLAGS but not LDFLAGS, which leads
to a mismatch and build failure, for example:
make[1]: *** [../../lib.mk:222: tools/testing/selftests/net/mptcp/mptcp_sockopt] Error 1
/usr/bin/ld: /tmp/ccqyMVdb.o: relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
tools/testing/selftests/net/mptcp/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/net/mptcp/Makefile b/tools/testing/selftests/net/mptcp/Makefile
index 8e3fc05a5397..9706bc73809f 100644
--- a/tools/testing/selftests/net/mptcp/Makefile
+++ b/tools/testing/selftests/net/mptcp/Makefile
@@ -2,7 +2,7 @@
top_srcdir = ../../../../..
-CFLAGS = -Wall -Wl,--no-as-needed -O2 -g -I$(top_srcdir)/usr/include $(KHDR_INCLUDES)
+CFLAGS += -Wall -Wl,--no-as-needed -O2 -g -I$(top_srcdir)/usr/include $(KHDR_INCLUDES)
TEST_PROGS := mptcp_connect.sh pm_netlink.sh mptcp_join.sh diag.sh \
simult_flows.sh mptcp_sockopt.sh userspace_pm.sh
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] selftests: mptcp: extend CFLAGS to keep options from environment
2025-01-23 8:35 [PATCH] selftests: mptcp: extend CFLAGS to keep options from environment Jan Stancek
@ 2025-01-23 8:39 ` Hangbin Liu
2025-01-23 8:43 ` Hangbin Liu
0 siblings, 1 reply; 5+ messages in thread
From: Hangbin Liu @ 2025-01-23 8:39 UTC (permalink / raw)
To: Jan Stancek; +Cc: matttbe, martineau, eliang, netdev, mptcp, linux-kselftest
On Thu, Jan 23, 2025 at 09:35:42AM +0100, Jan Stancek wrote:
> Package build environments like Fedora rpmbuild introduced hardening
> options (e.g. -pie -Wl,-z,now) by passing a -spec option to CFLAGS
> and LDFLAGS.
>
> mptcp Makefile currently overrides CFLAGS but not LDFLAGS, which leads
> to a mismatch and build failure, for example:
> make[1]: *** [../../lib.mk:222: tools/testing/selftests/net/mptcp/mptcp_sockopt] Error 1
> /usr/bin/ld: /tmp/ccqyMVdb.o: relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIE
> /usr/bin/ld: failed to set dynamic section sizes: bad value
> collect2: error: ld returned 1 exit status
>
> Signed-off-by: Jan Stancek <jstancek@redhat.com>
> ---
> tools/testing/selftests/net/mptcp/Makefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/net/mptcp/Makefile b/tools/testing/selftests/net/mptcp/Makefile
> index 8e3fc05a5397..9706bc73809f 100644
> --- a/tools/testing/selftests/net/mptcp/Makefile
> +++ b/tools/testing/selftests/net/mptcp/Makefile
> @@ -2,7 +2,7 @@
>
> top_srcdir = ../../../../..
>
> -CFLAGS = -Wall -Wl,--no-as-needed -O2 -g -I$(top_srcdir)/usr/include $(KHDR_INCLUDES)
> +CFLAGS += -Wall -Wl,--no-as-needed -O2 -g -I$(top_srcdir)/usr/include $(KHDR_INCLUDES)
>
> TEST_PROGS := mptcp_connect.sh pm_netlink.sh mptcp_join.sh diag.sh \
> simult_flows.sh mptcp_sockopt.sh userspace_pm.sh
> --
> 2.43.0
>
Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] selftests: mptcp: extend CFLAGS to keep options from environment
2025-01-23 8:39 ` Hangbin Liu
@ 2025-01-23 8:43 ` Hangbin Liu
2025-01-23 10:26 ` Matthieu Baerts
0 siblings, 1 reply; 5+ messages in thread
From: Hangbin Liu @ 2025-01-23 8:43 UTC (permalink / raw)
To: Jan Stancek; +Cc: matttbe, martineau, eliang, netdev, mptcp, linux-kselftest
On Thu, Jan 23, 2025 at 08:39:53AM +0000, Hangbin Liu wrote:
> On Thu, Jan 23, 2025 at 09:35:42AM +0100, Jan Stancek wrote:
> > Package build environments like Fedora rpmbuild introduced hardening
> > options (e.g. -pie -Wl,-z,now) by passing a -spec option to CFLAGS
> > and LDFLAGS.
> >
> > mptcp Makefile currently overrides CFLAGS but not LDFLAGS, which leads
> > to a mismatch and build failure, for example:
> > make[1]: *** [../../lib.mk:222: tools/testing/selftests/net/mptcp/mptcp_sockopt] Error 1
> > /usr/bin/ld: /tmp/ccqyMVdb.o: relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIE
> > /usr/bin/ld: failed to set dynamic section sizes: bad value
> > collect2: error: ld returned 1 exit status
> >
> > Signed-off-by: Jan Stancek <jstancek@redhat.com>
> > ---
> > tools/testing/selftests/net/mptcp/Makefile | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/tools/testing/selftests/net/mptcp/Makefile b/tools/testing/selftests/net/mptcp/Makefile
> > index 8e3fc05a5397..9706bc73809f 100644
> > --- a/tools/testing/selftests/net/mptcp/Makefile
> > +++ b/tools/testing/selftests/net/mptcp/Makefile
> > @@ -2,7 +2,7 @@
> >
> > top_srcdir = ../../../../..
> >
> > -CFLAGS = -Wall -Wl,--no-as-needed -O2 -g -I$(top_srcdir)/usr/include $(KHDR_INCLUDES)
> > +CFLAGS += -Wall -Wl,--no-as-needed -O2 -g -I$(top_srcdir)/usr/include $(KHDR_INCLUDES)
> >
> > TEST_PROGS := mptcp_connect.sh pm_netlink.sh mptcp_join.sh diag.sh \
> > simult_flows.sh mptcp_sockopt.sh userspace_pm.sh
> > --
> > 2.43.0
> >
>
> Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
Hmm, net-next is closed. Not sure if we can target this to net since it fixes
the build errors.
Thanks
Hangbin
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] selftests: mptcp: extend CFLAGS to keep options from environment
2025-01-23 8:43 ` Hangbin Liu
@ 2025-01-23 10:26 ` Matthieu Baerts
2025-01-23 10:44 ` Jan Stancek
0 siblings, 1 reply; 5+ messages in thread
From: Matthieu Baerts @ 2025-01-23 10:26 UTC (permalink / raw)
To: Hangbin Liu, Jan Stancek; +Cc: martineau, netdev, mptcp, linux-kselftest
Hi Jan, Hangbin,
(-cc <eliang@kernel.org>: wrong address apparently)
On 23/01/2025 09:43, Hangbin Liu wrote:
> On Thu, Jan 23, 2025 at 08:39:53AM +0000, Hangbin Liu wrote:
>> On Thu, Jan 23, 2025 at 09:35:42AM +0100, Jan Stancek wrote:
>>> Package build environments like Fedora rpmbuild introduced hardening
>>> options (e.g. -pie -Wl,-z,now) by passing a -spec option to CFLAGS
>>> and LDFLAGS.
>>>
>>> mptcp Makefile currently overrides CFLAGS but not LDFLAGS, which leads
>>> to a mismatch and build failure, for example:
>>> make[1]: *** [../../lib.mk:222: tools/testing/selftests/net/mptcp/mptcp_sockopt] Error 1
>>> /usr/bin/ld: /tmp/ccqyMVdb.o: relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIE
>>> /usr/bin/ld: failed to set dynamic section sizes: bad value
>>> collect2: error: ld returned 1 exit status
>>>
>>> Signed-off-by: Jan Stancek <jstancek@redhat.com>
>>> ---
>>> tools/testing/selftests/net/mptcp/Makefile | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/tools/testing/selftests/net/mptcp/Makefile b/tools/testing/selftests/net/mptcp/Makefile
>>> index 8e3fc05a5397..9706bc73809f 100644
>>> --- a/tools/testing/selftests/net/mptcp/Makefile
>>> +++ b/tools/testing/selftests/net/mptcp/Makefile
>>> @@ -2,7 +2,7 @@
>>>
>>> top_srcdir = ../../../../..
>>>
>>> -CFLAGS = -Wall -Wl,--no-as-needed -O2 -g -I$(top_srcdir)/usr/include $(KHDR_INCLUDES)
>>> +CFLAGS += -Wall -Wl,--no-as-needed -O2 -g -I$(top_srcdir)/usr/include $(KHDR_INCLUDES)
Thank you for the fix, it looks good to me too:
Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
>>>
>>> TEST_PROGS := mptcp_connect.sh pm_netlink.sh mptcp_join.sh diag.sh \
>>> simult_flows.sh mptcp_sockopt.sh userspace_pm.sh
>>> --
>>> 2.43.0
>>>
>>
>> Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
>
> Hmm, net-next is closed. Not sure if we can target this to net since it fixes
> the build errors.
I think this should target -net. It should then have a Fixes tag (and cc
Stable). Not sure if we need to backport that all along. Maybe enough to
use the following one, because I see it fixed the same issue in net and
tcp_ao:
Fixes: cc937dad85ae ("selftests: centralize -D_GNU_SOURCE= to CFLAGS in
lib.mk")
BTW, I guess you will need the same fix in
tools/testing/selftests/net/lib/Makefile and
tools/testing/selftests/net/openvswitch/Makefile.
@Jan: Do you mind fixing them too please? Also, please next time add the
target in the subject, e.g. [PATCH net], see:
https://docs.kernel.org/process/maintainer-netdev.html
@Netdev maintainers: this can be applied directly in -net, no need to go
through the MPTCP tree first. But it can if you prefer me adding the
Fixes tag.
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] selftests: mptcp: extend CFLAGS to keep options from environment
2025-01-23 10:26 ` Matthieu Baerts
@ 2025-01-23 10:44 ` Jan Stancek
0 siblings, 0 replies; 5+ messages in thread
From: Jan Stancek @ 2025-01-23 10:44 UTC (permalink / raw)
To: Matthieu Baerts; +Cc: Hangbin Liu, martineau, netdev, mptcp, linux-kselftest
On Thu, Jan 23, 2025 at 11:26 AM Matthieu Baerts <matttbe@kernel.org> wrote:
>
> Hi Jan, Hangbin,
>
> (-cc <eliang@kernel.org>: wrong address apparently)
>
> On 23/01/2025 09:43, Hangbin Liu wrote:
> > On Thu, Jan 23, 2025 at 08:39:53AM +0000, Hangbin Liu wrote:
> >> On Thu, Jan 23, 2025 at 09:35:42AM +0100, Jan Stancek wrote:
> >>> Package build environments like Fedora rpmbuild introduced hardening
> >>> options (e.g. -pie -Wl,-z,now) by passing a -spec option to CFLAGS
> >>> and LDFLAGS.
> >>>
> >>> mptcp Makefile currently overrides CFLAGS but not LDFLAGS, which leads
> >>> to a mismatch and build failure, for example:
> >>> make[1]: *** [../../lib.mk:222: tools/testing/selftests/net/mptcp/mptcp_sockopt] Error 1
> >>> /usr/bin/ld: /tmp/ccqyMVdb.o: relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIE
> >>> /usr/bin/ld: failed to set dynamic section sizes: bad value
> >>> collect2: error: ld returned 1 exit status
> >>>
> >>> Signed-off-by: Jan Stancek <jstancek@redhat.com>
> >>> ---
> >>> tools/testing/selftests/net/mptcp/Makefile | 2 +-
> >>> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>>
> >>> diff --git a/tools/testing/selftests/net/mptcp/Makefile b/tools/testing/selftests/net/mptcp/Makefile
> >>> index 8e3fc05a5397..9706bc73809f 100644
> >>> --- a/tools/testing/selftests/net/mptcp/Makefile
> >>> +++ b/tools/testing/selftests/net/mptcp/Makefile
> >>> @@ -2,7 +2,7 @@
> >>>
> >>> top_srcdir = ../../../../..
> >>>
> >>> -CFLAGS = -Wall -Wl,--no-as-needed -O2 -g -I$(top_srcdir)/usr/include $(KHDR_INCLUDES)
> >>> +CFLAGS += -Wall -Wl,--no-as-needed -O2 -g -I$(top_srcdir)/usr/include $(KHDR_INCLUDES)
>
> Thank you for the fix, it looks good to me too:
>
> Reviewed-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
>
> >>>
> >>> TEST_PROGS := mptcp_connect.sh pm_netlink.sh mptcp_join.sh diag.sh \
> >>> simult_flows.sh mptcp_sockopt.sh userspace_pm.sh
> >>> --
> >>> 2.43.0
> >>>
> >>
> >> Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
> >
> > Hmm, net-next is closed. Not sure if we can target this to net since it fixes
> > the build errors.
>
> I think this should target -net. It should then have a Fixes tag (and cc
> Stable). Not sure if we need to backport that all along. Maybe enough to
> use the following one, because I see it fixed the same issue in net and
> tcp_ao:
>
> Fixes: cc937dad85ae ("selftests: centralize -D_GNU_SOURCE= to CFLAGS in
> lib.mk")
>
> BTW, I guess you will need the same fix in
> tools/testing/selftests/net/lib/Makefile and
> tools/testing/selftests/net/openvswitch/Makefile.
>
> @Jan: Do you mind fixing them too please? Also, please next time add the
> target in the subject, e.g. [PATCH net], see:
Will do.
Regards,
Jan
>
> https://docs.kernel.org/process/maintainer-netdev.html
>
> @Netdev maintainers: this can be applied directly in -net, no need to go
> through the MPTCP tree first. But it can if you prefer me adding the
> Fixes tag.
>
> Cheers,
> Matt
> --
> Sponsored by the NGI0 Core fund.
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-01-23 10:44 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-23 8:35 [PATCH] selftests: mptcp: extend CFLAGS to keep options from environment Jan Stancek
2025-01-23 8:39 ` Hangbin Liu
2025-01-23 8:43 ` Hangbin Liu
2025-01-23 10:26 ` Matthieu Baerts
2025-01-23 10:44 ` Jan Stancek
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).