* [PATCH iproute2] tc: fix bpf compilation with old glibc
@ 2015-07-22 12:29 Nicolas Dichtel
2015-07-22 13:05 ` Daniel Borkmann
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Nicolas Dichtel @ 2015-07-22 12:29 UTC (permalink / raw)
To: shemminger; +Cc: netdev, Nicolas Dichtel, Daniel Borkmann
Error was:
f_bpf.o: In function `bpf_parse_opt':
f_bpf.c:(.text+0x88f): undefined reference to `secure_getenv'
m_bpf.o: In function `parse_bpf':
m_bpf.c:(.text+0x587): undefined reference to `secure_getenv'
collect2: error: ld returned 1 exit status
CC: Daniel Borkmann <daniel@iogearbox.net>
Fixes: 88eea5395483 ("tc: {f,m}_bpf: allow to retrieve uds path from env")
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
configure | 49 +++++++++++++++++++++++++++++++++++++++++++++++--
tc/Makefile | 6 ++++++
tc/tc_bpf.h | 9 +++++++++
3 files changed, 62 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index 3ae4c955ae8e..1eacdc67dbb9 100755
--- a/configure
+++ b/configure
@@ -289,12 +289,54 @@ check_mnl()
if ${PKG_CONFIG} libmnl --exists
then
echo "HAVE_MNL:=y" >>Config
- echo -n "yes"
+ echo "yes"
else
- echo -n "no"
+ echo "no"
fi
}
+check_secure_getenv()
+{
+ #check if we have secure_getenv()
+ cat >$TMPDIR/secure_getenv_test.c <<EOF
+#include <stdlib.h>
+
+int main(int argc, char **argv)
+{
+ secure_getenv("foo");
+ return 0;
+}
+EOF
+
+ $CC -I$INCLUDE -o $TMPDIR/secure_getenv_test $TMPDIR/secure_getenv_test.c >/dev/null 2>&1
+ if [ $? -eq 0 ]
+ then
+ echo "HAVE_SECURE_GETENV:=y" >>Config
+ echo "yes"
+ else
+ #check if we have __secure_getenv()
+ cat >$TMPDIR/secure_getenv_test.c <<EOF
+#include <stdlib.h>
+
+int main(int argc, char **argv)
+{
+ __secure_getenv("foo");
+ return 0;
+}
+EOF
+
+ $CC -I$INCLUDE -o $TMPDIR/secure_getenv_test $TMPDIR/secure_getenv_test.c >/dev/null 2>&1
+ if [ $? -eq 0 ]
+ then
+ echo "HAVE___SECURE_GETENV:=y" >>Config
+ echo "yes"
+ else
+ echo "no"
+ fi
+ fi
+ rm -f $TMPDIR/secure_getenv_test.c $TMPDIR/secure_getenv_test
+}
+
echo "# Generated config based on" $INCLUDE >Config
check_toolchain
@@ -328,6 +370,9 @@ check_elf
echo -n "libmnl support: "
check_mnl
+echo -n "secure_getenv() support: "
+check_secure_getenv
+
echo
echo -n "docs:"
check_docs
diff --git a/tc/Makefile b/tc/Makefile
index 56acbaa1ab13..d598fc29532f 100644
--- a/tc/Makefile
+++ b/tc/Makefile
@@ -7,6 +7,12 @@ include ../Config
ifeq ($(IP_CONFIG_SETNS),y)
CFLAGS += -DHAVE_SETNS
endif
+ifeq ($(HAVE_SECURE_GETENV),y)
+ CFLAGS += -DHAVE_SECURE_GETENV
+endif
+ifeq ($(HAVE___SECURE_GETENV),y)
+ CFLAGS += -DHAVE___SECURE_GETENV
+endif
SHARED_LIBS ?= y
diff --git a/tc/tc_bpf.h b/tc/tc_bpf.h
index 2ad881219e68..2e4b1a985f05 100644
--- a/tc/tc_bpf.h
+++ b/tc/tc_bpf.h
@@ -21,12 +21,21 @@
#include <errno.h>
#include <stdio.h>
#include <stdint.h>
+#include <stdlib.h>
#include "utils.h"
#include "bpf_scm.h"
#define BPF_ENV_UDS "TC_BPF_UDS"
+#ifndef HAVE_SECURE_GETENV
+# ifdef HAVE___SECURE_GETENV
+# define secure_getenv __secure_getenv
+# else
+# error neither secure_getenv nor __secure_getenv is available
+# endif
+#endif
+
int bpf_parse_string(char *arg, bool from_file, __u16 *bpf_len,
char **bpf_string, bool *need_release,
const char separator);
--
2.4.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH iproute2] tc: fix bpf compilation with old glibc
2015-07-22 12:29 [PATCH iproute2] tc: fix bpf compilation with old glibc Nicolas Dichtel
@ 2015-07-22 13:05 ` Daniel Borkmann
2015-07-22 13:18 ` Nicolas Dichtel
[not found] ` <19c76849dd1f4a94875b0aa5d3d7e96c@HQ1WP-EXMB12.corp.brocade.com>
2015-07-27 21:36 ` [PATCH " Stephen Hemminger
2 siblings, 1 reply; 9+ messages in thread
From: Daniel Borkmann @ 2015-07-22 13:05 UTC (permalink / raw)
To: Nicolas Dichtel, shemminger; +Cc: netdev
On 07/22/2015 02:29 PM, Nicolas Dichtel wrote:
> Error was:
> f_bpf.o: In function `bpf_parse_opt':
> f_bpf.c:(.text+0x88f): undefined reference to `secure_getenv'
> m_bpf.o: In function `parse_bpf':
> m_bpf.c:(.text+0x587): undefined reference to `secure_getenv'
> collect2: error: ld returned 1 exit status
>
> CC: Daniel Borkmann <daniel@iogearbox.net>
> Fixes: 88eea5395483 ("tc: {f,m}_bpf: allow to retrieve uds path from env")
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Thanks Nicolas! I am thinking we should probably just stick to getenv()
and convert these two users.
Thanks,
Daniel
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH iproute2] tc: fix bpf compilation with old glibc
2015-07-22 13:05 ` Daniel Borkmann
@ 2015-07-22 13:18 ` Nicolas Dichtel
0 siblings, 0 replies; 9+ messages in thread
From: Nicolas Dichtel @ 2015-07-22 13:18 UTC (permalink / raw)
To: Daniel Borkmann, shemminger; +Cc: netdev
Le 22/07/2015 15:05, Daniel Borkmann a écrit :
> On 07/22/2015 02:29 PM, Nicolas Dichtel wrote:
>> Error was:
>> f_bpf.o: In function `bpf_parse_opt':
>> f_bpf.c:(.text+0x88f): undefined reference to `secure_getenv'
>> m_bpf.o: In function `parse_bpf':
>> m_bpf.c:(.text+0x587): undefined reference to `secure_getenv'
>> collect2: error: ld returned 1 exit status
>>
>> CC: Daniel Borkmann <daniel@iogearbox.net>
>> Fixes: 88eea5395483 ("tc: {f,m}_bpf: allow to retrieve uds path from env")
>> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
>
> Thanks Nicolas! I am thinking we should probably just stick to getenv()
> and convert these two users.
As you want, I don't have a strong opinion on this. Stephen?
Regards,
Nicolas
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH iproute2] tc: fix bpf compilation with old glibc
[not found] ` <19c76849dd1f4a94875b0aa5d3d7e96c@HQ1WP-EXMB12.corp.brocade.com>
@ 2015-07-22 16:47 ` Stephen Hemminger
2015-07-23 7:17 ` [PATCH v2 " Nicolas Dichtel
0 siblings, 1 reply; 9+ messages in thread
From: Stephen Hemminger @ 2015-07-22 16:47 UTC (permalink / raw)
To: Daniel Borkmann; +Cc: Nicolas Dichtel, netdev@vger.kernel.org
On Wed, 22 Jul 2015 13:05:32 +0000
Daniel Borkmann <daniel@iogearbox.net> wrote:
> On 07/22/2015 02:29 PM, Nicolas Dichtel wrote:
> > Error was:
> > f_bpf.o: In function `bpf_parse_opt':
> > f_bpf.c:(.text+0x88f): undefined reference to `secure_getenv'
> > m_bpf.o: In function `parse_bpf':
> > m_bpf.c:(.text+0x587): undefined reference to `secure_getenv'
> > collect2: error: ld returned 1 exit status
> >
> > CC: Daniel Borkmann <daniel@iogearbox.net>
> > Fixes: 88eea5395483 ("tc: {f,m}_bpf: allow to retrieve uds path from env")
> > Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
>
> Thanks Nicolas! I am thinking we should probably just stick to getenv()
> and convert these two users.
>
> Thanks,
> Daniel
Yes, please use getenv() unless there is a obvious special
security requirement involved.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 iproute2] tc: fix bpf compilation with old glibc
2015-07-22 16:47 ` Stephen Hemminger
@ 2015-07-23 7:17 ` Nicolas Dichtel
2015-07-23 7:25 ` Daniel Borkmann
2015-07-23 21:50 ` Alexei Starovoitov
0 siblings, 2 replies; 9+ messages in thread
From: Nicolas Dichtel @ 2015-07-23 7:17 UTC (permalink / raw)
To: shemminger; +Cc: netdev, Nicolas Dichtel, Daniel Borkmann
Error was:
f_bpf.o: In function `bpf_parse_opt':
f_bpf.c:(.text+0x88f): undefined reference to `secure_getenv'
m_bpf.o: In function `parse_bpf':
m_bpf.c:(.text+0x587): undefined reference to `secure_getenv'
collect2: error: ld returned 1 exit status
There is no special reason to use the secure version of getenv, thus let's
simply use getenv().
CC: Daniel Borkmann <daniel@iogearbox.net>
Fixes: 88eea5395483 ("tc: {f,m}_bpf: allow to retrieve uds path from env")
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
v2: rework the fix to use getenv() instead of secure_getenv()
examples/bpf/bpf_agent.c | 2 +-
tc/f_bpf.c | 2 +-
tc/m_bpf.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/examples/bpf/bpf_agent.c b/examples/bpf/bpf_agent.c
index 426b8800bf4e..f9b9ce3ccb3d 100644
--- a/examples/bpf/bpf_agent.c
+++ b/examples/bpf/bpf_agent.c
@@ -154,7 +154,7 @@ static void bpf_map_get_from_env(int *tfd)
memset(key, 0, sizeof(key));
snprintf(key, sizeof(key), "BPF_MAP%d", i);
- val = secure_getenv(key);
+ val = getenv(key);
assert(val != NULL);
tfd[i] = atoi(val);
diff --git a/tc/f_bpf.c b/tc/f_bpf.c
index c21bf33fd25f..490dc6b4e7ba 100644
--- a/tc/f_bpf.c
+++ b/tc/f_bpf.c
@@ -122,7 +122,7 @@ opt_bpf:
NEXT_ARG();
if (ebpf) {
- bpf_uds_name = secure_getenv(BPF_ENV_UDS);
+ bpf_uds_name = getenv(BPF_ENV_UDS);
bpf_obj = *argv;
NEXT_ARG();
diff --git a/tc/m_bpf.c b/tc/m_bpf.c
index 9ddb6672693c..c51f44fc6ce6 100644
--- a/tc/m_bpf.c
+++ b/tc/m_bpf.c
@@ -105,7 +105,7 @@ opt_bpf:
NEXT_ARG();
if (ebpf) {
- bpf_uds_name = secure_getenv(BPF_ENV_UDS);
+ bpf_uds_name = getenv(BPF_ENV_UDS);
bpf_obj = *argv;
NEXT_ARG();
--
2.4.2
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2 iproute2] tc: fix bpf compilation with old glibc
2015-07-23 7:17 ` [PATCH v2 " Nicolas Dichtel
@ 2015-07-23 7:25 ` Daniel Borkmann
2015-07-23 21:50 ` Alexei Starovoitov
1 sibling, 0 replies; 9+ messages in thread
From: Daniel Borkmann @ 2015-07-23 7:25 UTC (permalink / raw)
To: Nicolas Dichtel, shemminger; +Cc: netdev
On 07/23/2015 09:17 AM, Nicolas Dichtel wrote:
> Error was:
> f_bpf.o: In function `bpf_parse_opt':
> f_bpf.c:(.text+0x88f): undefined reference to `secure_getenv'
> m_bpf.o: In function `parse_bpf':
> m_bpf.c:(.text+0x587): undefined reference to `secure_getenv'
> collect2: error: ld returned 1 exit status
>
> There is no special reason to use the secure version of getenv, thus let's
> simply use getenv().
>
> CC: Daniel Borkmann <daniel@iogearbox.net>
> Fixes: 88eea5395483 ("tc: {f,m}_bpf: allow to retrieve uds path from env")
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 iproute2] tc: fix bpf compilation with old glibc
2015-07-23 7:17 ` [PATCH v2 " Nicolas Dichtel
2015-07-23 7:25 ` Daniel Borkmann
@ 2015-07-23 21:50 ` Alexei Starovoitov
2015-07-27 8:09 ` Yegor Yefremov
1 sibling, 1 reply; 9+ messages in thread
From: Alexei Starovoitov @ 2015-07-23 21:50 UTC (permalink / raw)
To: Nicolas Dichtel; +Cc: shemminger, netdev, Daniel Borkmann
On Thu, Jul 23, 2015 at 09:17:41AM +0200, Nicolas Dichtel wrote:
> Error was:
> f_bpf.o: In function `bpf_parse_opt':
> f_bpf.c:(.text+0x88f): undefined reference to `secure_getenv'
> m_bpf.o: In function `parse_bpf':
> m_bpf.c:(.text+0x587): undefined reference to `secure_getenv'
> collect2: error: ld returned 1 exit status
>
> There is no special reason to use the secure version of getenv, thus let's
> simply use getenv().
>
> CC: Daniel Borkmann <daniel@iogearbox.net>
> Fixes: 88eea5395483 ("tc: {f,m}_bpf: allow to retrieve uds path from env")
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
> ---
>
> v2: rework the fix to use getenv() instead of secure_getenv()
had the same workaround locally.
Acked-by: Alexei Starovoitov <ast@plumgrid.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 iproute2] tc: fix bpf compilation with old glibc
2015-07-23 21:50 ` Alexei Starovoitov
@ 2015-07-27 8:09 ` Yegor Yefremov
0 siblings, 0 replies; 9+ messages in thread
From: Yegor Yefremov @ 2015-07-27 8:09 UTC (permalink / raw)
To: Alexei Starovoitov
Cc: Nicolas Dichtel, Stephen Hemminger, netdev, Daniel Borkmann
On Thu, Jul 23, 2015 at 11:50 PM, Alexei Starovoitov
<alexei.starovoitov@gmail.com> wrote:
> On Thu, Jul 23, 2015 at 09:17:41AM +0200, Nicolas Dichtel wrote:
>> Error was:
>> f_bpf.o: In function `bpf_parse_opt':
>> f_bpf.c:(.text+0x88f): undefined reference to `secure_getenv'
>> m_bpf.o: In function `parse_bpf':
>> m_bpf.c:(.text+0x587): undefined reference to `secure_getenv'
>> collect2: error: ld returned 1 exit status
>>
>> There is no special reason to use the secure version of getenv, thus let's
>> simply use getenv().
>>
>> CC: Daniel Borkmann <daniel@iogearbox.net>
>> Fixes: 88eea5395483 ("tc: {f,m}_bpf: allow to retrieve uds path from env")
>> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
>> ---
>>
>> v2: rework the fix to use getenv() instead of secure_getenv()
>
> had the same workaround locally.
> Acked-by: Alexei Starovoitov <ast@plumgrid.com>
Tested-by: Yegor Yefremov <yegorslists@googlemail.com>
tested with uclibc, that has problems with secure_getenv() too.
Yegor
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH iproute2] tc: fix bpf compilation with old glibc
2015-07-22 12:29 [PATCH iproute2] tc: fix bpf compilation with old glibc Nicolas Dichtel
2015-07-22 13:05 ` Daniel Borkmann
[not found] ` <19c76849dd1f4a94875b0aa5d3d7e96c@HQ1WP-EXMB12.corp.brocade.com>
@ 2015-07-27 21:36 ` Stephen Hemminger
2 siblings, 0 replies; 9+ messages in thread
From: Stephen Hemminger @ 2015-07-27 21:36 UTC (permalink / raw)
To: Nicolas Dichtel; +Cc: shemminger, netdev, Daniel Borkmann
On Wed, 22 Jul 2015 14:29:30 +0200
Nicolas Dichtel <nicolas.dichtel@6wind.com> wrote:
> Error was:
> f_bpf.o: In function `bpf_parse_opt':
> f_bpf.c:(.text+0x88f): undefined reference to `secure_getenv'
> m_bpf.o: In function `parse_bpf':
> m_bpf.c:(.text+0x587): undefined reference to `secure_getenv'
> collect2: error: ld returned 1 exit status
>
> CC: Daniel Borkmann <daniel@iogearbox.net>
> Fixes: 88eea5395483 ("tc: {f,m}_bpf: allow to retrieve uds path from env")
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Applied thanks.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2015-07-27 21:36 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-22 12:29 [PATCH iproute2] tc: fix bpf compilation with old glibc Nicolas Dichtel
2015-07-22 13:05 ` Daniel Borkmann
2015-07-22 13:18 ` Nicolas Dichtel
[not found] ` <19c76849dd1f4a94875b0aa5d3d7e96c@HQ1WP-EXMB12.corp.brocade.com>
2015-07-22 16:47 ` Stephen Hemminger
2015-07-23 7:17 ` [PATCH v2 " Nicolas Dichtel
2015-07-23 7:25 ` Daniel Borkmann
2015-07-23 21:50 ` Alexei Starovoitov
2015-07-27 8:09 ` Yegor Yefremov
2015-07-27 21:36 ` [PATCH " Stephen Hemminger
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).