Hans-Werner Hilse | 26 Jun 10:36 2015
Picon

[PATCH] 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(-)

--

-- 
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
Hans-Werner Hilse | 11 Jun 11:29 2015
Picon

[PATCH v2 0/3] musl compatibility patches

This set of patches facilitate compilation with the musl libc,
either linked to shared libraries or static.

Hans-Werner Hilse (3):
  um: Do not use __ptr_t type for stack_t's .ss pointer
  um: Do not use stdin and stdout identifiers for struct members
  um: Include sys/types.h for makedev(), major(), minor()

 arch/um/drivers/harddog_user.c         | 18 +++++++++---------
 arch/um/drivers/net_user.c             |  6 +++---
 arch/um/drivers/slip_user.c            | 14 +++++++-------
 arch/um/drivers/slirp_user.c           | 16 ++++++++--------
 arch/um/os-Linux/drivers/tuntap_user.c |  6 +++---
 arch/um/os-Linux/file.c                |  1 +
 arch/um/os-Linux/signal.c              |  8 +++++---
 7 files changed, 36 insertions(+), 33 deletions(-)

--

-- 
2.4.2

------------------------------------------------------------------------------
Richard Weinberger | 10 Jun 23:38 2015
Picon

Re: [PATCH 3/3] um: Include sys/types.h for makedev(), major(), minor()

On Wed, Jun 10, 2015 at 11:21 PM, Hans-Werner Hilse <hwhilse <at> gmail.com> wrote:
> The functions in question are not part of the POSIX standard,
> documentation however hints that the corresponding header shall
> be sys/types.h. C libraries other than glibc, namely musl, did
> not include that header via other ways and complained.

Makes sense. :-)

--

-- 
Thanks,
//richard

------------------------------------------------------------------------------
Richard Weinberger | 10 Jun 23:37 2015
Picon

Re: [PATCH 2/3] um: Do not use stdin and stdout names for variables

On Wed, Jun 10, 2015 at 11:21 PM, Hans-Werner Hilse <hwhilse <at> gmail.com> wrote:
> Naming local variables "stdin" and "stdout" is fine with glibc,
> other C libraries, namely musl, will however complain.

Wait, what?!
These are not local variables, they are struct members.

What exactly is the issue with musl? Sounds very odd.

--

-- 
Thanks,
//richard

------------------------------------------------------------------------------
Richard Weinberger | 10 Jun 23:35 2015
Picon

Re: [PATCH 1/3] um: Fallback when C library does not provide __ptr_t

On Wed, Jun 10, 2015 at 11:20 PM, Hans-Werner Hilse <hwhilse <at> gmail.com> wrote:
> Glibc provides __ptr_t for the pointer in the stack_t struct,
> but other C libraries - namely musl - do not necessarily do so.
> In that case, fall back to a void* pointer.

Please just kill __ptr_t in UML.

--

-- 
Thanks,
//richard

------------------------------------------------------------------------------
Hans-Werner Hilse | 10 Jun 23:23 2015
Picon

Re: [PATCH 1/3] um: Fallback when C library does not provide __ptr_t

Hi,

Am 2015-06-10 23:20, schrieb Hans-Werner Hilse:
[...]

This three-part patch series will allow to compile UML against the musl 
libc implementation - even statically.

Take it as a suggestion, but I think most things are quite sensible. The 
__ptr_t stuff is admittedly a bit ugly.

-hwh

------------------------------------------------------------------------------
Hans-Werner Hilse | 10 Jun 23:21 2015
Picon

[PATCH 3/3] um: Include sys/types.h for makedev(), major(), minor()

The functions in question are not part of the POSIX standard,
documentation however hints that the corresponding header shall
be sys/types.h. C libraries other than glibc, namely musl, did
not include that header via other ways and complained.

Signed-off-by: Hans-Werner Hilse <hwhilse <at> gmail.com>
---
  arch/um/os-Linux/file.c | 1 +
  1 file changed, 1 insertion(+)

diff --git a/arch/um/os-Linux/file.c b/arch/um/os-Linux/file.c
index 08d90fb..26e0164 100644
--- a/arch/um/os-Linux/file.c
+++ b/arch/um/os-Linux/file.c
 <at>  <at>  -13,6 +13,7  <at>  <at> 
  #include <sys/socket.h>
  #include <sys/stat.h>
  #include <sys/un.h>
+#include <sys/types.h>
  #include <os.h>

  static void copy_stat(struct uml_stat *dst, const struct stat64 *src)
--

-- 
2.4.2

------------------------------------------------------------------------------
Hans-Werner Hilse | 10 Jun 23:21 2015
Picon

[PATCH 2/3] um: Do not use stdin and stdout names for variables

Naming local variables "stdin" and "stdout" is fine with glibc,
other C libraries, namely musl, will however complain.

Signed-off-by: Hans-Werner Hilse <hwhilse <at> gmail.com>
---
  arch/um/drivers/harddog_user.c         | 18 +++++++++---------
  arch/um/drivers/net_user.c             |  6 +++---
  arch/um/drivers/slip_user.c            | 14 +++++++-------
  arch/um/drivers/slirp_user.c           | 16 ++++++++--------
  arch/um/os-Linux/drivers/tuntap_user.c |  6 +++---
  5 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/arch/um/drivers/harddog_user.c 
b/arch/um/drivers/harddog_user.c
index f99b32a..3aa8b0d 100644
--- a/arch/um/drivers/harddog_user.c
+++ b/arch/um/drivers/harddog_user.c
 <at>  <at>  -9,8 +9,8  <at>  <at> 
  #include <os.h>

  struct dog_data {
-	int stdin;
-	int stdout;
+	int stdin_fd;
+	int stdout_fd;
  	int close_me[2];
  };

 <at>  <at>  -18,11 +18,11  <at>  <at>  static void pre_exec(void *d)
  {
(Continue reading)

Hans-Werner Hilse | 10 Jun 23:20 2015
Picon

[PATCH 1/3] um: Fallback when C library does not provide __ptr_t

Glibc provides __ptr_t for the pointer in the stack_t struct,
but other C libraries - namely musl - do not necessarily do so.
In that case, fall back to a void* pointer.

Signed-off-by: Hans-Werner Hilse <hwhilse <at> gmail.com>
---
  arch/um/os-Linux/signal.c | 5 +++++
  1 file changed, 5 insertions(+)

diff --git a/arch/um/os-Linux/signal.c b/arch/um/os-Linux/signal.c
index 7b605e4..82d95d9 100644
--- a/arch/um/os-Linux/signal.c
+++ b/arch/um/os-Linux/signal.c
 <at>  <at>  -15,6 +15,11  <at>  <at> 
  #include <sysdep/mcontext.h>
  #include "internal.h"

+/* some C libraries do not provide a special pointer typedef */
+#ifndef __ptr_t
+# define __ptr_t void *
+#endif
+
  void (*sig_info[NSIG])(int, struct siginfo *, struct uml_pt_regs *) = {
  	[SIGTRAP]	= relay_signal,
  	[SIGFPE]	= relay_signal,
--

-- 
2.4.2

------------------------------------------------------------------------------
(Continue reading)

Richard Weinberger | 31 May 23:38 2015
Picon

[PATCH 1/5] um: Catch unprotected user memory access

If the kernel tries to access user memory without copy_from_user()
a trap will happen as kernel and userspace run in different processes
on the host side. Currently this special page fault cannot be resolved
and will happen over and over again. As result UML will lockup.
This patch allows the page fault code to detect that situation and
causes a panic() such that the root cause of the unprotected memory
access can be found and fixed.

Signed-off-by: Richard Weinberger <richard <at> nod.at>
---
 arch/um/kernel/trap.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/um/kernel/trap.c b/arch/um/kernel/trap.c
index 8e4daf4..34b633e 100644
--- a/arch/um/kernel/trap.c
+++ b/arch/um/kernel/trap.c
 <at>  <at>  -219,6 +219,11  <at>  <at>  unsigned long segv(struct faultinfo fi, unsigned long ip, int is_user,
 		show_regs(container_of(regs, struct pt_regs, regs));
 		panic("Segfault with no mm");
 	}
+	else if (!is_user && address < TASK_SIZE) {
+		show_regs(container_of(regs, struct pt_regs, regs));
+		panic("Kernel tried to access user memory at addr 0x%lx, ip 0x%lx",
+		       address, ip);
+	}

 	if (SEGV_IS_FIXABLE(&fi))
 		err = handle_page_fault(address, ip, is_write, is_user,
--

-- 
(Continue reading)

Hans-Werner Hilse | 24 May 15:23 2015
Picon

[PATCH] um: handle GCC 5.x like GCC 4.x

Compiler compatibility macros were conditionally defined based on
the compiler version. The it tested __GNUC__, but compared it to
a maximum value of 4, breaking compilation on now current GCC 5.x.
Thus, the check is extended to check for version 4.x and beyond.

Signed-off-by: Hans-Werner Hilse <hwhilse <at> gmail.com>
---
 arch/um/include/shared/init.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/um/include/shared/init.h b/arch/um/include/shared/init.h
index b3906f8..ecdec48 100644
--- a/arch/um/include/shared/init.h
+++ b/arch/um/include/shared/init.h
 <at>  <at>  -54,7 +54,7  <at>  <at>  typedef void (*exitcall_t)(void);
 #endif

 #else
-#if __GNUC__ == 4
+#if __GNUC__ >= 4
 # define __used			__attribute__((__used__))
 #endif
 #endif
--

-- 
2.4.1

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
(Continue reading)


Gmane