Skip to content

Commit 4ecd4ff

Browse files
committed
Merge branch 'for-linus-4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml
Pull UML updates from Richard Weinberger: "Mostly fixes for UML: - First round of fixes for PTRACE_GETRESET/SETREGSET - A printf vs printk cleanup - Minor improvements" * 'for-linus-4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rw/uml: um: Correctly check for PTRACE_GETRESET/SETREGSET um: v2: Use generic NOTES macro um: Add kerneldoc for userspace_tramp() and start_userspace() um: Add kerneldoc for segv_handler um: stub-data.h: remove superfluous include um: userspace - be more verbose in ptrace set regs error um: add dummy ioremap and iounmap functions um: Allow building and running on older hosts um: Avoid longjmp/setjmp symbol clashes with libpthread.a um: console: Ignore console= option um: Use os_warn to print out pre-boot warning/error messages um: Add os_warn() for pre-boot warning/error messages um: Use os_info for the messages on normal path um: Add os_info() for pre-boot information messages um: Use printk instead of printf in make_uml_dir
2 parents 966859b + 61e8d46 commit 4ecd4ff

File tree

21 files changed

+201
-82
lines changed

21 files changed

+201
-82
lines changed

arch/um/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,14 @@ KBUILD_CPPFLAGS += -I$(srctree)/$(HOST_DIR)/um
5959
# Same things for in6addr_loopback and mktime - found in libc. For these two we
6060
# only get link-time error, luckily.
6161
#
62+
# -Dlongjmp=kernel_longjmp prevents anything from referencing the libpthread.a
63+
# embedded copy of longjmp, same thing for setjmp.
64+
#
6265
# These apply to USER_CFLAGS to.
6366

6467
KBUILD_CFLAGS += $(CFLAGS) $(CFLAGS-y) -D__arch_um__ \
6568
$(ARCH_INCLUDE) $(MODE_INCLUDE) -Dvmap=kernel_vmap \
69+
-Dlongjmp=kernel_longjmp -Dsetjmp=kernel_setjmp \
6670
-Din6addr_loopback=kernel_in6addr_loopback \
6771
-Din6addr_any=kernel_in6addr_any -Dstrrchr=kernel_strrchr
6872

arch/um/drivers/stdio_console.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,9 @@ __uml_exitcall(console_exit);
192192

193193
static int console_chan_setup(char *str)
194194
{
195+
if (!strncmp(str, "sole=", 5)) /* console= option specifies tty */
196+
return 0;
197+
195198
line_setup(vt_conf, MAX_TTYS, &def_conf, str, "console");
196199
return 1;
197200
}

arch/um/include/asm/common.lds.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
PROVIDE (_unprotected_end = .);
1616

1717
. = ALIGN(4096);
18-
.note : { *(.note.*) }
18+
NOTES
1919
EXCEPTION_TABLE(0)
2020

2121
BUG_TABLE

arch/um/include/asm/io.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#ifndef _ASM_UM_IO_H
2+
#define _ASM_UM_IO_H
3+
4+
#define ioremap ioremap
5+
static inline void __iomem *ioremap(phys_addr_t offset, size_t size)
6+
{
7+
return (void __iomem *)(unsigned long)offset;
8+
}
9+
10+
#define iounmap iounmap
11+
static inline void iounmap(void __iomem *addr)
12+
{
13+
}
14+
15+
#include <asm-generic/io.h>
16+
17+
#endif

arch/um/include/shared/os.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,10 @@ extern void setup_hostinfo(char *buf, int len);
242242
extern void os_dump_core(void) __attribute__ ((noreturn));
243243
extern void um_early_printk(const char *s, unsigned int n);
244244
extern void os_fix_helper_signals(void);
245+
extern void os_info(const char *fmt, ...)
246+
__attribute__ ((format (printf, 1, 2)));
247+
extern void os_warn(const char *fmt, ...)
248+
__attribute__ ((format (printf, 1, 2)));
245249

246250
/* time.c */
247251
extern void os_idle_sleep(unsigned long long nsecs);

arch/um/include/shared/skas/stub-data.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
#ifndef __STUB_DATA_H
99
#define __STUB_DATA_H
1010

11-
#include <time.h>
12-
1311
struct stub_data {
1412
unsigned long offset;
1513
int fd;

arch/um/kernel/physmem.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ void __init setup_physmem(unsigned long start, unsigned long reserve_end,
8989
offset = uml_reserved - uml_physmem;
9090
map_size = len - offset;
9191
if(map_size <= 0) {
92-
printf("Too few physical memory! Needed=%d, given=%d\n",
93-
offset, len);
92+
os_warn("Too few physical memory! Needed=%lu, given=%lu\n",
93+
offset, len);
9494
exit(1);
9595
}
9696

@@ -99,9 +99,9 @@ void __init setup_physmem(unsigned long start, unsigned long reserve_end,
9999
err = os_map_memory((void *) uml_reserved, physmem_fd, offset,
100100
map_size, 1, 1, 1);
101101
if (err < 0) {
102-
printf("setup_physmem - mapping %ld bytes of memory at 0x%p "
103-
"failed - errno = %d\n", map_size,
104-
(void *) uml_reserved, err);
102+
os_warn("setup_physmem - mapping %ld bytes of memory at 0x%p "
103+
"failed - errno = %d\n", map_size,
104+
(void *) uml_reserved, err);
105105
exit(1);
106106
}
107107

arch/um/kernel/trap.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,16 @@ void fatal_sigsegv(void)
183183
os_dump_core();
184184
}
185185

186+
/**
187+
* segv_handler() - the SIGSEGV handler
188+
* @sig: the signal number
189+
* @unused_si: the signal info struct; unused in this handler
190+
* @regs: the ptrace register information
191+
*
192+
* The handler first extracts the faultinfo from the UML ptrace regs struct.
193+
* If the userfault did not happen in an UML userspace process, bad_segv is called.
194+
* Otherwise the signal did happen in a cloned userspace process, handle it.
195+
*/
186196
void segv_handler(int sig, struct siginfo *unused_si, struct uml_pt_regs *regs)
187197
{
188198
struct faultinfo * fi = UPT_FAULTINFO(regs);

arch/um/kernel/um_arch.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ static char __initdata command_line[COMMAND_LINE_SIZE] = { 0 };
3434
static void __init add_arg(char *arg)
3535
{
3636
if (strlen(command_line) + strlen(arg) + 1 > COMMAND_LINE_SIZE) {
37-
printf("add_arg: Too many command line arguments!\n");
37+
os_warn("add_arg: Too many command line arguments!\n");
3838
exit(1);
3939
}
4040
if (strlen(command_line) > 0)
@@ -120,6 +120,7 @@ static const char *usage_string =
120120

121121
static int __init uml_version_setup(char *line, int *add)
122122
{
123+
/* Explicitly use printf() to show version in stdout */
123124
printf("%s\n", init_utsname()->release);
124125
exit(0);
125126

@@ -148,8 +149,8 @@ __uml_setup("root=", uml_root_setup,
148149

149150
static int __init no_skas_debug_setup(char *line, int *add)
150151
{
151-
printf("'debug' is not necessary to gdb UML in skas mode - run \n");
152-
printf("'gdb linux'\n");
152+
os_warn("'debug' is not necessary to gdb UML in skas mode - run\n");
153+
os_warn("'gdb linux'\n");
153154

154155
return 0;
155156
}
@@ -165,6 +166,7 @@ static int __init Usage(char *line, int *add)
165166

166167
printf(usage_string, init_utsname()->release);
167168
p = &__uml_help_start;
169+
/* Explicitly use printf() to show help in stdout */
168170
while (p < &__uml_help_end) {
169171
printf("%s", *p);
170172
p++;
@@ -283,8 +285,8 @@ int __init linux_main(int argc, char **argv)
283285

284286
diff = UML_ROUND_UP(brk_start) - UML_ROUND_UP(&_end);
285287
if (diff > 1024 * 1024) {
286-
printf("Adding %ld bytes to physical memory to account for "
287-
"exec-shield gap\n", diff);
288+
os_info("Adding %ld bytes to physical memory to account for "
289+
"exec-shield gap\n", diff);
288290
physmem_size += UML_ROUND_UP(brk_start) - UML_ROUND_UP(&_end);
289291
}
290292

@@ -324,8 +326,8 @@ int __init linux_main(int argc, char **argv)
324326
end_vm = start_vm + virtmem_size;
325327

326328
if (virtmem_size < physmem_size)
327-
printf("Kernel virtual memory size shrunk to %lu bytes\n",
328-
virtmem_size);
329+
os_info("Kernel virtual memory size shrunk to %lu bytes\n",
330+
virtmem_size);
329331

330332
os_flush_stdout();
331333

arch/um/kernel/umid.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ static int __init set_umid_arg(char *name, int *add)
1616
int err;
1717

1818
if (umid_inited) {
19-
printf("umid already set\n");
19+
os_warn("umid already set\n");
2020
return 0;
2121
}
2222

2323
*add = 0;
2424
err = set_umid(name);
2525
if (err == -EEXIST)
26-
printf("umid '%s' already in use\n", name);
26+
os_warn("umid '%s' already in use\n", name);
2727
else if (!err)
2828
umid_inited = 1;
2929

0 commit comments

Comments
 (0)