Skip to contentSkip to conversation

package/lxc: fix compilation with stub memfd_create

PATCH New Patrick Havelange 3 participants 4 messages Oct 22, 2019 – Oct 30, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/lxc: fix compilation with stub memfd_create

This fixes compilation issue in case memfd_create is a stub in libc. Patch already merged in lxc master branch (344b8ee293f4d3730a70a6ccaa03d7e4a516ae95).

Copy of the original commit log:

In case the internal memfd_create has to be used, make sure we don't clash with the already existing memfd_create function from glibc.

This can happen if this glibc function is a stub. In this case, at ./configure time, the test for this function will return false, however the declaration of that function is still available. This leads to compilation errors.

---
 ...-rename-internal-memfd_create-to-mem.patch | 43 +++++++++++++++++++
 1 file changed, 43 insertions(+)
 create mode 100644 package/lxc/0001-syscall_wrappers-rename-internal-memfd_create-to-mem.patch
package/lxc/0001-syscall_wrappers-rename-internal-memfd_create-to-mem.patch new file +43 -0
new file mode 100644
index 0000000000..6210591c09
@@ -0,0 +1,43 @@
+From 2b23a1313f501423aecbe4ad4a988a9f6f832f1f Mon Sep 17 00:00:00 2001
+From: Patrick Havelange <[email protected]>
+Date: Tue, 22 Oct 2019 12:29:54 +0200
+Subject: [PATCH 1/1] syscall_wrappers: rename internal memfd_create to
+ memfd_create_lxc
+
+In case the internal memfd_create has to be used, make sure we don't
+clash with the already existing memfd_create function from glibc.
+
+This can happen if this glibc function is a stub. In this case, at
+./configure time, the test for this function will return false, however
+the declaration of that function is still available. This leads to
+compilation errors.
+
+Signed-off-by: Patrick Havelange <[email protected]>
+---
+ src/lxc/syscall_wrappers.h | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/lxc/syscall_wrappers.h b/src/lxc/syscall_wrappers.h
+index 42d94db..bddf01b 100644
+--- a/src/lxc/syscall_wrappers.h
++++ b/src/lxc/syscall_wrappers.h
+@@ -59,7 +59,7 @@ static inline long __keyctl(int cmd, unsigned long arg2, unsigned long arg3,
+ #endif
+ 
+ #ifndef HAVE_MEMFD_CREATE
+-static inline int memfd_create(const char *name, unsigned int flags) {
++static inline int memfd_create_lxc(const char *name, unsigned int flags) {
+ 	#ifndef __NR_memfd_create
+ 		#if defined __i386__
+ 			#define __NR_memfd_create 356
+@@ -98,6 +98,7 @@ static inline int memfd_create(const char *name, unsigned int flags) {
+ 	return -1;
+ 	#endif
+ }
++#define memfd_create memfd_create_lxc
+ #else
+ extern int memfd_create(const char *name, unsigned int flags);
+ #endif
+-- 
+2.20.1
+
Signature · 1 line
2.20.1
#1 lore raw

PATCH 1/1 package/lxc: fix compilation with stub memfd_create

Patrick,

Quoted 10 lines · Patrick Havelange

This fixes compilation issue in case memfd_create is a stub in libc. Patch already merged in lxc master branch (344b8ee293f4d3730a70a6ccaa03d7e4a516ae95).

Copy of the original commit log:

In case the internal memfd_create has to be used, make sure we don't clash with the already existing memfd_create function from glibc.

Quoted 6 lines

This can happen if this glibc function is a stub. In this case, at ./configure time, the test for this function will return false, however the declaration of that function is still available. This leads to compilation errors.

Quoted 61 lines
---
 ...-rename-internal-memfd_create-to-mem.patch | 43 +++++++++++++++++++
 1 file changed, 43 insertions(+)
 create mode 100644 package/lxc/0001-syscall_wrappers-rename-internal-memfd_create-to-mem.patch
package/lxc/0001-syscall_wrappers-rename-internal-memfd_create-to-mem.patch new file +43 -1
new file mode 100644
index 0000000000..6210591c09
@@ -0,0 +1,43 @@
+From 2b23a1313f501423aecbe4ad4a988a9f6f832f1f Mon Sep 17 00:00:00 2001
+From: Patrick Havelange <[email protected]>
+Date: Tue, 22 Oct 2019 12:29:54 +0200
+Subject: [PATCH 1/1] syscall_wrappers: rename internal memfd_create to
+ memfd_create_lxc
+
+In case the internal memfd_create has to be used, make sure we don't
+clash with the already existing memfd_create function from glibc.
+
+This can happen if this glibc function is a stub. In this case, at
+./configure time, the test for this function will return false, however
+the declaration of that function is still available. This leads to
+compilation errors.
+
+Signed-off-by: Patrick Havelange <[email protected]>
+---
+ src/lxc/syscall_wrappers.h | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/lxc/syscall_wrappers.h b/src/lxc/syscall_wrappers.h
+index 42d94db..bddf01b 100644
+--- a/src/lxc/syscall_wrappers.h
++++ b/src/lxc/syscall_wrappers.h
+@@ -59,7 +59,7 @@ static inline long __keyctl(int cmd, unsigned long arg2, unsigned long arg3,
+ #endif
+
+ #ifndef HAVE_MEMFD_CREATE
+-static inline int memfd_create(const char *name, unsigned int flags) {
++static inline int memfd_create_lxc(const char *name, unsigned int flags) {
+       #ifndef __NR_memfd_create
+               #if defined __i386__
+                       #define __NR_memfd_create 356
+@@ -98,6 +98,7 @@ static inline int memfd_create(const char *name, unsigned int flags) {
+       return -1;
+       #endif
+ }
++#define memfd_create memfd_create_lxc
+ #else
+ extern int memfd_create(const char *name, unsigned int flags);
+ #endif
+--
+2.20.1
+
--

2.20.1

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

Signature · 23 lines
Matthew Weber | Associate Director Software Engineer | Commercial Avionics

COLLINS AEROSPACE

400 Collins Road NE, Cedar Rapids, Iowa 52498, USA

Tel: +1 319 295 7349 | FAX: +1 319 263 6099

matthew.weber at collins.com | collinsaerospace.com



CONFIDENTIALITY WARNING: This message may contain proprietary and/or
privileged information of Collins Aerospace and its affiliated
companies. If you are not the intended recipient, please 1) Do not
disclose, copy, distribute or use this message or its contents. 2)
Advise the sender by return email. 3) Delete all copies (including all
attachments) from your computer. Your cooperation is greatly
appreciated.


Any export restricted material should be shared using my
matthew.weber at corp.rockwellcollins.com address.
#2 lore raw

PATCH 1/1 package/lxc: fix compilation with stub memfd_create

Peter,

Quoted 9 lines · Matthew Weber

Patrick,

Quoted 4 lines · Patrick Havelange

This fixes compilation issue in case memfd_create is a stub in libc. Patch already merged in lxc master branch (344b8ee293f4d3730a70a6ccaa03d7e4a516ae95).

Looks like this would also be applicable to the 2019.02.x as the LXC version hasn't been bumped yet from 3.1.0.

Quoted 105 lines
Quoted 6 lines

Copy of the original commit log:

In case the internal memfd_create has to be used, make sure we don't clash with the already existing memfd_create function from glibc.

Quoted 6 lines

This can happen if this glibc function is a stub. In this case, at ./configure time, the test for this function will return false, however the declaration of that function is still available. This leads to compilation errors.

Quoted 57 lines
---
 ...-rename-internal-memfd_create-to-mem.patch | 43 +++++++++++++++++++
 1 file changed, 43 insertions(+)
 create mode 100644 package/lxc/0001-syscall_wrappers-rename-internal-memfd_create-to-mem.patch
package/lxc/0001-syscall_wrappers-rename-internal-memfd_create-to-mem.patch new file +43 -1
new file mode 100644
index 0000000000..6210591c09
@@ -0,0 +1,43 @@
+From 2b23a1313f501423aecbe4ad4a988a9f6f832f1f Mon Sep 17 00:00:00 2001
+From: Patrick Havelange <[email protected]>
+Date: Tue, 22 Oct 2019 12:29:54 +0200
+Subject: [PATCH 1/1] syscall_wrappers: rename internal memfd_create to
+ memfd_create_lxc
+
+In case the internal memfd_create has to be used, make sure we don't
+clash with the already existing memfd_create function from glibc.
+
+This can happen if this glibc function is a stub. In this case, at
+./configure time, the test for this function will return false, however
+the declaration of that function is still available. This leads to
+compilation errors.
+
+Signed-off-by: Patrick Havelange <[email protected]>
+---
+ src/lxc/syscall_wrappers.h | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/lxc/syscall_wrappers.h b/src/lxc/syscall_wrappers.h
+index 42d94db..bddf01b 100644
+--- a/src/lxc/syscall_wrappers.h
++++ b/src/lxc/syscall_wrappers.h
+@@ -59,7 +59,7 @@ static inline long __keyctl(int cmd, unsigned long arg2, unsigned long arg3,
+ #endif
+
+ #ifndef HAVE_MEMFD_CREATE
+-static inline int memfd_create(const char *name, unsigned int flags) {
++static inline int memfd_create_lxc(const char *name, unsigned int flags) {
+       #ifndef __NR_memfd_create
+               #if defined __i386__
+                       #define __NR_memfd_create 356
+@@ -98,6 +98,7 @@ static inline int memfd_create(const char *name, unsigned int flags) {
+       return -1;
+       #endif
+ }
++#define memfd_create memfd_create_lxc
+ #else
+ extern int memfd_create(const char *name, unsigned int flags);
+ #endif
+--
+2.20.1
+
--

2.20.1

Quoted 4 lines

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

--

Matthew Weber | Associate Director Software Engineer | Commercial Avionics

COLLINS AEROSPACE

400 Collins Road NE, Cedar Rapids, Iowa 52498, USA

Tel: +1 319 295 7349 | FAX: +1 319 263 6099

matthew.weber at collins.com | collinsaerospace.com

CONFIDENTIALITY WARNING: This message may contain proprietary and/or privileged information of Collins Aerospace and its affiliated companies. If you are not the intended recipient, please 1) Do not disclose, copy, distribute or use this message or its contents. 2) Advise the sender by return email. 3) Delete all copies (including all attachments) from your computer. Your cooperation is greatly appreciated.

Any export restricted material should be shared using my matthew.weber at corp.rockwellcollins.com address.

Signature · 23 lines
Matthew Weber | Associate Director Software Engineer | Commercial Avionics

COLLINS AEROSPACE

400 Collins Road NE, Cedar Rapids, Iowa 52498, USA

Tel: +1 319 295 7349 | FAX: +1 319 263 6099

matthew.weber at collins.com | collinsaerospace.com



CONFIDENTIALITY WARNING: This message may contain proprietary and/or
privileged information of Collins Aerospace and its affiliated
companies. If you are not the intended recipient, please 1) Do not
disclose, copy, distribute or use this message or its contents. 2)
Advise the sender by return email. 3) Delete all copies (including all
attachments) from your computer. Your cooperation is greatly
appreciated.


Any export restricted material should be shared using my
matthew.weber at corp.rockwellcollins.com address.
#3 lore raw

PATCH 1/1 package/lxc: fix compilation with stub memfd_create

In reply to Patrick Havelange
Quoted 11 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Patrick" == Patrick Havelange <[email protected]> writes:

This fixes compilation issue in case memfd_create is a stub in libc. Patch already merged in lxc master branch (344b8ee293f4d3730a70a6ccaa03d7e4a516ae95).

Copy of the original commit log:

In case the internal memfd_create has to be used, make sure we don't clash with the already existing memfd_create function from glibc.

Quoted 6 lines

This can happen if this glibc function is a stub. In this case, at ./configure time, the test for this function will return false, however the declaration of that function is still available. This leads to compilation errors.

Committed to 2019.02.x and 2019.08.x, thanks.

Signature · 1 line
Bye, Peter Korsgaard