Skip to contentSkip to conversation

missed musl compatibility patch

PATCH Superseded Hans-Werner Hilse 2 participants 8 messages Jun 26, 2015 – Jul 28, 2015

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

PATCH 1/1 missed musl compatibility patch

I'm sorry but one patch that is necessary for compilation against musl libc was still missing in the series I sent earlier. (Thank you very much for applying!)

This is a bit awkward: It looked so nice and clean to just call "modify_ldt()" before. The external declaration is a hint that not all was well. Looking at modify_ldt(2), making the syscall via syscall() ourselves is actually the recommended way, so I hope it isn't too troublesome a patch.

Hans-Werner Hilse (1):
um: Do not rely on libc to provide modify_ldt()

 arch/x86/um/ldt.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
Signature · 13 lines
2.4.3


------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#1 lore raw

PATCH 1/1 um: Do not rely on libc to provide modify_ldt()

modify_ldt() was declared as an external symbol. Despite the man page for this syscall telling that there is no wrapper in glibc, since version 2.1 there actually is, so linking to the glibc works.

Since modify_ldt() is not a POSIX interface, other libc implementations do not always provide a wrapper function. Even glibc headers do not provide a corresponding declaration.

So go the recommended way to call this using syscall().

---
 arch/x86/um/ldt.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
arch/x86/um/ldt.c +7 -1
index 9701a4f..6e57c22 100644
@@ -11,8 +11,14 @@
 #include <os.h>
 #include <skas.h>
 #include <sysdep/tls.h>
+#include <unistd.h>
+#include <sys/syscall.h>
+
+static inline int modify_ldt (int func, void *ptr, unsigned long bytecount)
+{
+	return syscall(SYS_modify_ldt, func, ptr, bytecount);
+}
 
-extern int modify_ldt(int func, void *ptr, unsigned long bytecount);
 
 static long write_ldt_entry(struct mm_id *mm_idp, int func,
 		     struct user_desc *desc, void **addr, int done)
Signature · 13 lines
2.4.3


------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#2 lore raw
In reply to Hans-Werner Hilse
Quoted 3 lines · Hans-Werner Hilse

I'm sorry but one patch that is necessary for compilation against musl libc was still missing in the series I sent earlier. (Thank you very much for applying!)

Okay. We can merge it for -rc2.

Signature · 13 lines
Thanks,
//richard

------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#3 lore raw

Hi,

Am 2015-06-27 20:18, schrieb Richard Weinberger:

Quoted 7 lines
Quoted 3 lines · Hans-Werner Hilse

I'm sorry but one patch that is necessary for compilation against musl libc was still missing in the series I sent earlier. (Thank you very much for applying!)

Okay. We can merge it for -rc2.

Please ignore for now, I need to fix this patch, unfortunately. As it is, it breaks compilation on a much more important target - glibc. I'll send a v2 once I got this right.

-hwh

------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager! OpManager is web-based network management software that monitors network devices and physical & virtual servers, alerts via email & sms for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#4 lore raw

PATCH v2 1/1 missed musl compatibility patch

Updated patch to provide our own mofify_ldt() wrapper. The earlier version did not take into account that outside the "os-Linux" directories the host API is not accessible.

However, an according syscall() definition is in os.h, which is already included. The syscall number can be taken from the kernel space definition as __NR_modify_ldt.

Hans-Werner Hilse (1):
um: Do not rely on libc to provide modify_ldt()

 arch/x86/um/ldt.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
Signature · 13 lines
2.4.3


------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#5 lore raw

PATCH v2 1/1 um: Do not rely on libc to provide modify_ldt()

modify_ldt() was declared as an external symbol. Despite the man page for this syscall telling that there is no wrapper in glibc, since version 2.1 there actually is, so linking to the glibc works.

Since modify_ldt() is not a POSIX interface, other libc implementations do not always provide a wrapper function. Even glibc headers do not provide a corresponding declaration.

So go the recommended way to call this using syscall().

---
 arch/x86/um/ldt.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
arch/x86/um/ldt.c +4 -1
index 9701a4f..836a1eb 100644
@@ -12,7 +12,10 @@
 #include <skas.h>
 #include <sysdep/tls.h>
 
-extern int modify_ldt(int func, void *ptr, unsigned long bytecount);
+static inline int modify_ldt (int func, void *ptr, unsigned long bytecount)
+{
+	return syscall(__NR_modify_ldt, func, ptr, bytecount);
+}
 
 static long write_ldt_entry(struct mm_id *mm_idp, int func,
 		     struct user_desc *desc, void **addr, int done)
Signature · 13 lines
2.4.3


------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#6 lore raw

Re: [uml-devel] [PATCH v2] um: Do not rely on libc to provide modify_ldt()

Hi,

Richard, might I ping you about this one?

Reading other mails on this ML, I reckon' you're quite busy - no problem, it's not really critical anyway. Just want to make sure the updated patch got noticed.

Thanks,

-hwh

Am 2015-06-29 11:50, schrieb Hans-Werner Hilse:

Quoted 32 lines

modify_ldt() was declared as an external symbol. Despite the man page for this syscall telling that there is no wrapper in glibc, since version 2.1 there actually is, so linking to the glibc works.

Since modify_ldt() is not a POSIX interface, other libc implementations do not always provide a wrapper function. Even glibc headers do not provide a corresponding declaration.

So go the recommended way to call this using syscall().

---
 arch/x86/um/ldt.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
arch/x86/um/ldt.c +4 -1
index 9701a4f..836a1eb 100644
@@ -12,7 +12,10 @@
 #include <skas.h>
 #include <sysdep/tls.h>
 
-extern int modify_ldt(int func, void *ptr, unsigned long bytecount);
+static inline int modify_ldt (int func, void *ptr, unsigned long 
 bytecount)
+{
+	return syscall(__NR_modify_ldt, func, ptr, bytecount);
+}
 
 static long write_ldt_entry(struct mm_id *mm_idp, int func,
Quoted 1 line

struct user_desc *desc, void **addr, int done)

------------------------------------------------------------------------------
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#7 lore raw

Re: [uml-devel] [PATCH v2] um: Do not rely on libc to provide modify_ldt()

Quoted 7 lines · Hans-Werner Hilse

Hi,

Richard, might I ping you about this one?

Reading other mails on this ML, I reckon' you're quite busy - no problem, it's not really critical anyway. Just want to make sure the updated patch got noticed.

Thanks for the heads up! Your patch looks good, it will be part if the next pull request (target -rc5).

Signature · 8 lines
Thanks,
//richard

------------------------------------------------------------------------------
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel