Vegard Nossum | 21 May 17:46 2016
Picon

[PATCH v2] um: support kcov

This adds support for kcov to UML.

There is a small problem where UML will randomly segfault during boot;
this is because current_thread_info() occasionally returns an invalid
(non-NULL) pointer and we try to dereference it in
__sanitizer_cov_trace_pc(). I consider this a bug in UML itself and this
patch merely exposes it.

[v2: disable instrumentation in UML-specific code]

Cc: Quentin Casasnovas <quentin.casasnovas <at> oracle.com>
Cc: Richard Weinberger <richard <at> nod.at>
Cc: Thomas Meyer <thomas <at> m3y3r.de>
Cc: user-mode-linux-devel <user-mode-linux-devel <at> lists.sourceforge.net>
Cc: Dmitry Vyukov <dvyukov <at> google.com>
Signed-off-by: Vegard Nossum <vegard.nossum <at> oracle.com>
---
 arch/um/Kconfig.common    | 1 +
 arch/um/kernel/Makefile   | 5 +++++
 arch/um/os-Linux/Makefile | 3 +++
 arch/x86/um/vdso/Makefile | 3 +++
 4 files changed, 12 insertions(+)

diff --git a/arch/um/Kconfig.common b/arch/um/Kconfig.common
index cc00134..64c1d46 100644
--- a/arch/um/Kconfig.common
+++ b/arch/um/Kconfig.common
 <at>  <at>  -1,6 +1,7  <at>  <at> 
 config UML
 	bool
(Continue reading)

Vegard Nossum | 21 May 16:12 2016
Picon

Re: [PATCH] um: support kcov

On 05/21/2016 04:05 PM, Dmitry Vyukov wrote:
> On Sat, May 21, 2016 at 4:03 PM, Vegard Nossum <vegard.nossum <at> oracle.com
> <mailto:vegard.nossum <at> oracle.com>> wrote:
>
>     This adds support for kcov to UML.
>
[...]
> Acked-by: Dmitry Vyukov <dvyukov <at> google.com <mailto:dvyukov <at> google.com>>
>
> Cool! How do you plan to use it?

We have a patch for kcov itself adding the AFL mode coming up very soon
:-) We've been doing almost all our filesystem (and other) AFL fuzzing
in UML instances as we found it gave a really big performance boost over
KVM.

Vegard

------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
Vegard Nossum | 21 May 16:03 2016
Picon

[PATCH] um: support kcov

This adds support for kcov to UML.

There is a small problem where UML will randomly segfault during boot;
this is because current_thread_info() occasionally returns an invalid
(non-NULL) pointer and we try to dereference it in
__sanitizer_cov_trace_pc(). I consider this a bug in UML itself and this
patch merely exposes it.

Cc: Quentin Casasnovas <quentin.casasnovas <at> oracle.com>
Cc: Richard Weinberger <richard <at> nod.at>
Cc: Thomas Meyer <thomas <at> m3y3r.de>
Cc: user-mode-linux-devel <user-mode-linux-devel <at> lists.sourceforge.net>
Cc: Dmitry Vyukov <dvyukov <at> google.com>
Signed-off-by: Vegard Nossum <vegard.nossum <at> oracle.com>
---
 arch/um/Kconfig.common    | 1 +
 arch/x86/um/vdso/Makefile | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/arch/um/Kconfig.common b/arch/um/Kconfig.common
index cc00134..64c1d46 100644
--- a/arch/um/Kconfig.common
+++ b/arch/um/Kconfig.common
 <at>  <at>  -1,6 +1,7  <at>  <at> 
 config UML
 	bool
 	default y
+	select ARCH_HAS_KCOV
 	select HAVE_ARCH_AUDITSYSCALL
 	select HAVE_ARCH_SECCOMP_FILTER
(Continue reading)

Vegard Nossum | 21 May 15:51 2016
Picon

current_thread_info() returns invalid pointer in early UML boot code

Hi people,

I'm having some trouble with using current_thread_info() during UML
early boot. Sometimes it works just fine, but often I get segfaults
because current_thread_info() is returning an invalid pointer. It
looks random: 0x202118, 0x1003e0003, 0xd33b90b3, 0x6db043, etc.

I found an earlier thread which described the same problem:
http://permalink.gmane.org/gmane.linux.uml.devel/14642

However, I think the patch there is a bit hacky/papers over an
underlying bug, since it just uses is_kernel_addr() before deciding
whether to return the pointer from current_thread_info() or not. The
fact that the crash is random leads me to think it's some sort of race
during the UML boot.

Does anybody understand fully what's going on here, why it returns
those invalid (seemingly random) values? If the problem is that we're
on a wrong stack, can we switch stacks earlier during boot or
something to make current_thread_info() always return a valid
thread_info pointer?

Thanks,

Vegard

------------------------------------------------------------------------------
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
(Continue reading)

Eli Cooper | 19 Mar 17:58 2016
Picon

[PATCH v3 0/3] um: fix and extend FPU support

This series first fixes a bug that results in corrupted FPU state after
invoking signal handlers. It also adds support for the extended processor
state (XSTATE) for x86_64 UML, especially the YMM registers used by AVX(2)
instructions.

Tested with a minimal multi-threaded FPU-intensive test program (see below).
This series supersedes the previous sigreturn fix as that one is incorrect
when the process is multi-threaded.

Changes since v2:
 - Add an improved sigreturn fix to this series
 - Merge the ptrace changes into the last commit
 - Make the selftest program multi-threaded

Changes since v1:
 - Refactor functions with oversized stack frame
 - Add a tiny selftest program to the cover letter

Eli Cooper (3):
  um: fix FPU state preservation around signal handlers
  um: extend fpstate to _xstate to support YMM registers
  um: add extended processor state save/restore support

 arch/um/include/shared/registers.h    |  2 ++
 arch/um/kernel/process.c              |  2 +-
 arch/um/os-Linux/signal.c             | 28 ++++++++++++++------
 arch/x86/um/os-Linux/registers.c      | 49 +++++++++++++++++++++++++++++++++--
 arch/x86/um/ptrace_32.c               |  5 ++--
 arch/x86/um/ptrace_64.c               | 16 ++++++------
 arch/x86/um/shared/sysdep/ptrace_64.h |  4 +--
(Continue reading)

Eli Cooper | 16 Mar 09:48 2016
Picon

[PATCH v2 0/3] um: Add support for extended processor state

This series adds support for the extended processor state (XSTATE) for
x86_64 UML, especially the YMM registers used by AVX/AVX2 instructions.

Modern userspace programs built with AVX can now run inside x86_64 UML
without YMM registers getting corrupted.

Tested with a tiny selftest program below, which of course requires the
following patch I sent earlier today to run correctly.
  um: fix FPU register double-restore after sigreturn

Also tested with a latest Arch Linux image on a CPU with AVX2 support.
Without YMM support in UML, a lot of programs crash unexpectedly,
or result in bad results (e.g., calculating SHA256 in OpenSSL).

Changes since v1:
 - Refactor functions with oversized stack frame
 - Add a tiny selftest program to the cover letter

Eli Cooper (3):
  um: extend _fpstate to _xstate
  um: add extended processor state save/restore support
  um: fix ptrace PTRACE_GETFPREGS and PTRACE_SETFPREG support

 arch/um/include/shared/registers.h    |  2 ++
 arch/um/kernel/process.c              |  2 +-
 arch/um/os-Linux/signal.c             | 28 ++++++++++++-----
 arch/x86/um/os-Linux/registers.c      | 49 ++++++++++++++++++++++++++++--
 arch/x86/um/ptrace_32.c               |  5 +--
 arch/x86/um/ptrace_64.c               | 16 +++++-----
 arch/x86/um/shared/sysdep/ptrace_64.h |  4 +--
(Continue reading)

Eli Cooper | 16 Mar 02:25 2016
Picon

[PATCH] um: fix FPU register double-restore after sigreturn

This patch prevents userspace() from incorrectly restoring FPU registers
after a sigreturn or rt_sigreturn system call, which has already restored
FPU registers to the state prior to the signal handler was invoked.

Fixes FPU state corruption after invoking the signal handler.

Signed-off-by: Eli Cooper <elicooper <at> gmx.com>
---
 arch/um/os-Linux/skas/process.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index 23025d6..664f184 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
 <at>  <at>  -310,6 +310,8  <at>  <at>  void userspace(struct uml_pt_regs *regs)
 	int err, status, op, pid = userspace_pid[0];
 	/* To prevent races if using_sysemu changes under us.*/
 	int local_using_sysemu;
+	/* To prevent FPU register restore after sigreturn syscalls. */
+	int skip_fp_restore = 0;
 	siginfo_t si;

 	/* Handle any immediate reschedules or signals */
 <at>  <at>  -328,8 +330,9  <at>  <at>  void userspace(struct uml_pt_regs *regs)
 		if (ptrace(PTRACE_SETREGS, pid, 0, regs->gp))
 			fatal_sigsegv();

-		if (put_fp_registers(pid, regs->fp))
-			fatal_sigsegv();
(Continue reading)

Eli Cooper | 6 Mar 15:36 2016
Picon

[PATCH 0/3] um: Add support for extended processor state

This series adds support for the extended processor state (XSTATE) for
x86_64 UML, especially the YMM registers used by AVX/AVX2 instructions.

Modern userspace programs built with AVX can now run inside x86_64 UML
without YMM registers getting corrupted.

Eli Cooper (3):
  um: extend _fpstate to _xstate
  um: add extended processor state save/restore support
  um: fix ptrace PTRACE_GETFPREGS and PTRACE_SETFPREG support

 arch/um/include/shared/registers.h    |  2 ++
 arch/um/kernel/process.c              |  2 +-
 arch/x86/um/os-Linux/registers.c      | 49 +++++++++++++++++++++++++++++++++--
 arch/x86/um/ptrace_32.c               |  4 +--
 arch/x86/um/ptrace_64.c               | 14 +++++-----
 arch/x86/um/shared/sysdep/ptrace_64.h |  4 +--
 arch/x86/um/signal.c                  | 26 +++++++++----------
 arch/x86/um/user-offsets.c            |  2 +-
 8 files changed, 73 insertions(+), 30 deletions(-)

--

-- 
2.7.2

------------------------------------------------------------------------------
Richard Weinberger | 12 Jan 21:36 2016
Picon

[GIT PULL] UML updates for 4.5

Linus,

the following changes since commit 74bf8efb5fa6e958d2d7c7917b8bb672085ec0c6:

  Linux 4.4-rc7 (2015-12-27 18:17:37 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml.git for-linus-4.5-rc1

for you to fetch changes up to 3e46b25376321db119bc8507ce8c8841c580e736:

  um: Use race-free temporary file creation (2016-01-10 21:49:50 +0100)

----------------------------------------------------------------
Anton Ivanov (3):
      um: Prevent IRQ handler reentrancy
      um: Do not change hard IRQ flags in soft IRQ processing
      um: Update UBD to use pread/pwrite family of functions

Mickaël Salaün (7):
      um: Fix ptrace GETREGS/SETREGS bugs
      selftests/seccomp: Remove the need for HAVE_ARCH_TRACEHOOK
      um: Add full asm/syscall.h support
      um: Add seccomp support
      um: Fix build error and kconfig for i386
      um: Do not set unsecure permission for temporary file
      um: Use race-free temporary file creation

Vegard Nossum (3):
(Continue reading)

Richard Weinberger | 10 Jan 23:37 2016
Picon

Stuff for v4.5

Hi!

I've pushed everything I'd like to see in 4.5 merged.
Please speak up now if I forgot something!

https://git.kernel.org/cgit/linux/kernel/git/rw/uml.git/log/?h=linux-next

--

-- 
Thanks,
//richard

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140
Anton Ivanov | 21 Dec 19:54 2015

[PATCH 1/2] Update UBD to use pread/pwrite family of functions

This decreases the number of syscalls per read/write by half.

Signed-off-by: Anton Ivanov <aivanov <at> brocade.com>
---
 arch/um/drivers/ubd_kern.c  | 27 +++++----------------------
 arch/um/include/shared/os.h |  2 ++
 arch/um/os-Linux/file.c     | 19 +++++++++++++++++++
 3 files changed, 26 insertions(+), 22 deletions(-)

diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index e8ab93c..39ba207 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
 <at>  <at>  -535,11 +535,7  <at>  <at>  static int read_cow_bitmap(int fd, void *buf, int offset, int len)
 {
 	int err;

-	err = os_seek_file(fd, offset);
-	if (err < 0)
-		return err;
-
-	err = os_read_file(fd, buf, len);
+	err = os_pread_file(fd, buf, len, offset);
 	if (err < 0)
 		return err;

 <at>  <at>  -1377,14 +1373,8  <at>  <at>  static int update_bitmap(struct io_thread_req *req)
 	if(req->cow_offset == -1)
 		return 0;

(Continue reading)


Gmane