linux-um archives
 help / color / mirror / Atom feed
From: Hans-Werner Hilse <hwhilse@gmail.com>
To: user-mode-linux-devel@lists.sourceforge.net
Subject: [uml-devel] [PATCH] um: Do not rely on libc to provide modify_ldt()
Date: Fri, 26 Jun 2015 10:36:14 +0200	[thread overview]
Message-ID: <1435307774-3897-2-git-send-email-hwhilse@gmail.com> (raw)
In-Reply-To: <1435307774-3897-1-git-send-email-hwhilse@gmail.com>

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

Signed-off-by: Hans-Werner Hilse <hwhilse@gmail.com>
---
 arch/x86/um/ldt.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/x86/um/ldt.c b/arch/x86/um/ldt.c
index 9701a4f..6e57c22 100644
--- a/arch/x86/um/ldt.c
+++ b/arch/x86/um/ldt.c
@@ -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)
-- 
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
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel


  reply	other threads:[~2015-06-26  8:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-26  8:36 [uml-devel] [PATCH] missed musl compatibility patch Hans-Werner Hilse
2015-06-26  8:36 ` Hans-Werner Hilse [this message]
2015-06-27 18:18 ` Richard Weinberger
2015-06-29  7:15   ` Hans-Werner Hilse
2015-06-29  9:50     ` [uml-devel] [PATCH v2] " Hans-Werner Hilse
2015-06-29  9:50       ` [uml-devel] [PATCH v2] um: Do not rely on libc to provide modify_ldt() Hans-Werner Hilse
2015-07-27 11:30         ` Hans-Werner Hilse
2015-07-28 21:41           ` Richard Weinberger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1435307774-3897-2-git-send-email-hwhilse@gmail.com \
    --to=hwhilse@gmail.com \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox