Commit 9e0243db authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for-linus-4.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml

Pull UML updates from Richard Weinberger:
 "Beside of various fixes this also contains patches to enable features
  such was Kcov, kmemleak and TRACE_IRQFLAGS_SUPPORT on UML"

* 'for-linus-4.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml:
  hostfs: Freeing an ERR_PTR in hostfs_fill_sb_common()
  um: Support kcov
  um: Enable TRACE_IRQFLAGS_SUPPORT
  um: Use asm-generic/irqflags.h
  um: Fix possible deadlock in sig_handler_common()
  um: Select HAVE_DEBUG_KMEMLEAK
  um: Setup physical memory in setup_arch()
  um: Eliminate null test after alloc_bootmem
parents b067c904 8a545f18
config UML config UML
bool bool
default y default y
select ARCH_HAS_KCOV
select HAVE_ARCH_AUDITSYSCALL select HAVE_ARCH_AUDITSYSCALL
select HAVE_ARCH_SECCOMP_FILTER select HAVE_ARCH_SECCOMP_FILTER
select HAVE_UID16 select HAVE_UID16
select HAVE_FUTEX_CMPXCHG if FUTEX select HAVE_FUTEX_CMPXCHG if FUTEX
select HAVE_DEBUG_KMEMLEAK
select GENERIC_IRQ_SHOW select GENERIC_IRQ_SHOW
select GENERIC_CPU_DEVICES select GENERIC_CPU_DEVICES
select GENERIC_IO select GENERIC_IO
...@@ -31,10 +33,9 @@ config PCI ...@@ -31,10 +33,9 @@ config PCI
config PCMCIA config PCMCIA
bool bool
# Yet to do!
config TRACE_IRQFLAGS_SUPPORT config TRACE_IRQFLAGS_SUPPORT
bool bool
default n default y
config LOCKDEP_SUPPORT config LOCKDEP_SUPPORT
bool bool
......
...@@ -6,37 +6,33 @@ extern int set_signals(int enable); ...@@ -6,37 +6,33 @@ extern int set_signals(int enable);
extern void block_signals(void); extern void block_signals(void);
extern void unblock_signals(void); extern void unblock_signals(void);
#define arch_local_save_flags arch_local_save_flags
static inline unsigned long arch_local_save_flags(void) static inline unsigned long arch_local_save_flags(void)
{ {
return get_signals(); return get_signals();
} }
#define arch_local_irq_restore arch_local_irq_restore
static inline void arch_local_irq_restore(unsigned long flags) static inline void arch_local_irq_restore(unsigned long flags)
{ {
set_signals(flags); set_signals(flags);
} }
#define arch_local_irq_enable arch_local_irq_enable
static inline void arch_local_irq_enable(void) static inline void arch_local_irq_enable(void)
{ {
unblock_signals(); unblock_signals();
} }
#define arch_local_irq_disable arch_local_irq_disable
static inline void arch_local_irq_disable(void) static inline void arch_local_irq_disable(void)
{ {
block_signals(); block_signals();
} }
static inline unsigned long arch_local_irq_save(void) #define ARCH_IRQ_DISABLED 0
{ #define ARCh_IRQ_ENABLED (SIGIO|SIGVTALRM)
unsigned long flags;
flags = arch_local_save_flags();
arch_local_irq_disable();
return flags;
}
static inline bool arch_irqs_disabled(void) #include <asm-generic/irqflags.h>
{
return arch_local_save_flags() == 0;
}
#endif #endif
...@@ -3,6 +3,11 @@ ...@@ -3,6 +3,11 @@
# Licensed under the GPL # Licensed under the GPL
# #
# Don't instrument UML-specific code; without this, we may crash when
# accessing the instrumentation buffer for the first time from the
# kernel.
KCOV_INSTRUMENT := n
CPPFLAGS_vmlinux.lds := -DSTART=$(LDS_START) \ CPPFLAGS_vmlinux.lds := -DSTART=$(LDS_START) \
-DELF_ARCH=$(LDS_ELF_ARCH) \ -DELF_ARCH=$(LDS_ELF_ARCH) \
-DELF_FORMAT=$(LDS_ELF_FORMAT) \ -DELF_FORMAT=$(LDS_ELF_FORMAT) \
......
...@@ -37,8 +37,6 @@ static int __init read_initrd(void) ...@@ -37,8 +37,6 @@ static int __init read_initrd(void)
} }
area = alloc_bootmem(size); area = alloc_bootmem(size);
if (area == NULL)
return 0;
if (load_initrd(initrd, area, size) == -1) if (load_initrd(initrd, area, size) == -1)
return 0; return 0;
......
...@@ -319,9 +319,6 @@ int __init linux_main(int argc, char **argv) ...@@ -319,9 +319,6 @@ int __init linux_main(int argc, char **argv)
start_vm = VMALLOC_START; start_vm = VMALLOC_START;
setup_physmem(uml_physmem, uml_reserved, physmem_size, highmem);
mem_total_pages(physmem_size, iomem_size, highmem);
virtmem_size = physmem_size; virtmem_size = physmem_size;
stack = (unsigned long) argv; stack = (unsigned long) argv;
stack &= ~(1024 * 1024 - 1); stack &= ~(1024 * 1024 - 1);
...@@ -334,7 +331,6 @@ int __init linux_main(int argc, char **argv) ...@@ -334,7 +331,6 @@ int __init linux_main(int argc, char **argv)
printf("Kernel virtual memory size shrunk to %lu bytes\n", printf("Kernel virtual memory size shrunk to %lu bytes\n",
virtmem_size); virtmem_size);
stack_protections((unsigned long) &init_thread_info);
os_flush_stdout(); os_flush_stdout();
return start_uml(); return start_uml();
...@@ -342,6 +338,10 @@ int __init linux_main(int argc, char **argv) ...@@ -342,6 +338,10 @@ int __init linux_main(int argc, char **argv)
void __init setup_arch(char **cmdline_p) void __init setup_arch(char **cmdline_p)
{ {
stack_protections((unsigned long) &init_thread_info);
setup_physmem(uml_physmem, uml_reserved, physmem_size, highmem);
mem_total_pages(physmem_size, iomem_size, highmem);
paging_init(); paging_init();
strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE); strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
*cmdline_p = command_line; *cmdline_p = command_line;
......
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
# Licensed under the GPL # Licensed under the GPL
# #
# Don't instrument UML-specific code
KCOV_INSTRUMENT := n
obj-y = aio.o execvp.o file.o helper.o irq.o main.o mem.o process.o \ obj-y = aio.o execvp.o file.o helper.o irq.o main.o mem.o process.o \
registers.o sigio.o signal.o start_up.o time.o tty.o \ registers.o sigio.o signal.o start_up.o time.o tty.o \
umid.o user_syms.o util.o drivers/ skas/ umid.o user_syms.o util.o drivers/ skas/
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <kern_util.h> #include <kern_util.h>
#include <os.h> #include <os.h>
#include <sysdep/mcontext.h> #include <sysdep/mcontext.h>
#include <um_malloc.h>
void (*sig_info[NSIG])(int, struct siginfo *, struct uml_pt_regs *) = { void (*sig_info[NSIG])(int, struct siginfo *, struct uml_pt_regs *) = {
[SIGTRAP] = relay_signal, [SIGTRAP] = relay_signal,
...@@ -32,7 +33,7 @@ static void sig_handler_common(int sig, struct siginfo *si, mcontext_t *mc) ...@@ -32,7 +33,7 @@ static void sig_handler_common(int sig, struct siginfo *si, mcontext_t *mc)
struct uml_pt_regs *r; struct uml_pt_regs *r;
int save_errno = errno; int save_errno = errno;
r = malloc(sizeof(struct uml_pt_regs)); r = uml_kmalloc(sizeof(struct uml_pt_regs), UM_GFP_ATOMIC);
if (!r) if (!r)
panic("out of memory"); panic("out of memory");
...@@ -91,7 +92,7 @@ static void timer_real_alarm_handler(mcontext_t *mc) ...@@ -91,7 +92,7 @@ static void timer_real_alarm_handler(mcontext_t *mc)
{ {
struct uml_pt_regs *regs; struct uml_pt_regs *regs;
regs = malloc(sizeof(struct uml_pt_regs)); regs = uml_kmalloc(sizeof(struct uml_pt_regs), UM_GFP_ATOMIC);
if (!regs) if (!regs)
panic("out of memory"); panic("out of memory");
......
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
# Building vDSO images for x86. # Building vDSO images for x86.
# #
# Prevents link failures: __sanitizer_cov_trace_pc() is not linked in.
KCOV_INSTRUMENT := n
VDSO64-y := y VDSO64-y := y
vdso-install-$(VDSO64-y) += vdso.so vdso-install-$(VDSO64-y) += vdso.so
......
...@@ -959,9 +959,10 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent) ...@@ -959,9 +959,10 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)
if (S_ISLNK(root_inode->i_mode)) { if (S_ISLNK(root_inode->i_mode)) {
char *name = follow_link(host_root_path); char *name = follow_link(host_root_path);
if (IS_ERR(name)) if (IS_ERR(name)) {
err = PTR_ERR(name); err = PTR_ERR(name);
else goto out_put;
}
err = read_name(root_inode, name); err = read_name(root_inode, name);
kfree(name); kfree(name);
if (err) if (err)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment