diff options
-rw-r--r-- | arch/um/Kconfig | 10 | ||||
-rw-r--r-- | arch/um/os-Linux/signal.c | 28 |
2 files changed, 15 insertions, 23 deletions
diff --git a/arch/um/Kconfig b/arch/um/Kconfig index ec9711d068b7..41913504a56e 100644 --- a/arch/um/Kconfig +++ b/arch/um/Kconfig | |||
@@ -142,13 +142,17 @@ config MAGIC_SYSRQ | |||
142 | 142 | ||
143 | config KERNEL_STACK_ORDER | 143 | config KERNEL_STACK_ORDER |
144 | int "Kernel stack size order" | 144 | int "Kernel stack size order" |
145 | default 1 if 64BIT | 145 | default 2 if 64BIT |
146 | range 1 10 if 64BIT | 146 | range 2 10 if 64BIT |
147 | default 0 if !64BIT | 147 | default 1 if !64BIT |
148 | help | 148 | help |
149 | This option determines the size of UML kernel stacks. They will | 149 | This option determines the size of UML kernel stacks. They will |
150 | be 1 << order pages. The default is OK unless you're running Valgrind | 150 | be 1 << order pages. The default is OK unless you're running Valgrind |
151 | on UML, in which case, set this to 3. | 151 | on UML, in which case, set this to 3. |
152 | It is possible to reduce the stack to 1 for 64BIT and 0 for 32BIT on | ||
153 | older (pre-2017) CPUs. It is not recommended on newer CPUs due to the | ||
154 | increase in the size of the state which needs to be saved when handling | ||
155 | signals. | ||
152 | 156 | ||
153 | config MMAPPER | 157 | config MMAPPER |
154 | tristate "iomem emulation driver" | 158 | tristate "iomem emulation driver" |
diff --git a/arch/um/os-Linux/signal.c b/arch/um/os-Linux/signal.c index bf0acb8aad8b..75b10235d369 100644 --- a/arch/um/os-Linux/signal.c +++ b/arch/um/os-Linux/signal.c | |||
@@ -31,29 +31,23 @@ void (*sig_info[NSIG])(int, struct siginfo *, struct uml_pt_regs *) = { | |||
31 | 31 | ||
32 | static void sig_handler_common(int sig, struct siginfo *si, mcontext_t *mc) | 32 | static void sig_handler_common(int sig, struct siginfo *si, mcontext_t *mc) |
33 | { | 33 | { |
34 | struct uml_pt_regs *r; | 34 | struct uml_pt_regs r; |
35 | int save_errno = errno; | 35 | int save_errno = errno; |
36 | 36 | ||
37 | r = uml_kmalloc(sizeof(struct uml_pt_regs), UM_GFP_ATOMIC); | 37 | r.is_user = 0; |
38 | if (!r) | ||
39 | panic("out of memory"); | ||
40 | |||
41 | r->is_user = 0; | ||
42 | if (sig == SIGSEGV) { | 38 | if (sig == SIGSEGV) { |
43 | /* For segfaults, we want the data from the sigcontext. */ | 39 | /* For segfaults, we want the data from the sigcontext. */ |
44 | get_regs_from_mc(r, mc); | 40 | get_regs_from_mc(&r, mc); |
45 | GET_FAULTINFO_FROM_MC(r->faultinfo, mc); | 41 | GET_FAULTINFO_FROM_MC(r.faultinfo, mc); |
46 | } | 42 | } |
47 | 43 | ||
48 | /* enable signals if sig isn't IRQ signal */ | 44 | /* enable signals if sig isn't IRQ signal */ |
49 | if ((sig != SIGIO) && (sig != SIGWINCH) && (sig != SIGALRM)) | 45 | if ((sig != SIGIO) && (sig != SIGWINCH) && (sig != SIGALRM)) |
50 | unblock_signals(); | 46 | unblock_signals(); |
51 | 47 | ||
52 | (*sig_info[sig])(sig, si, r); | 48 | (*sig_info[sig])(sig, si, &r); |
53 | 49 | ||
54 | errno = save_errno; | 50 | errno = save_errno; |
55 | |||
56 | free(r); | ||
57 | } | 51 | } |
58 | 52 | ||
59 | /* | 53 | /* |
@@ -91,17 +85,11 @@ void sig_handler(int sig, struct siginfo *si, mcontext_t *mc) | |||
91 | 85 | ||
92 | static void timer_real_alarm_handler(mcontext_t *mc) | 86 | static void timer_real_alarm_handler(mcontext_t *mc) |
93 | { | 87 | { |
94 | struct uml_pt_regs *regs; | 88 | struct uml_pt_regs regs; |
95 | |||
96 | regs = uml_kmalloc(sizeof(struct uml_pt_regs), UM_GFP_ATOMIC); | ||
97 | if (!regs) | ||
98 | panic("out of memory"); | ||
99 | 89 | ||
100 | if (mc != NULL) | 90 | if (mc != NULL) |
101 | get_regs_from_mc(regs, mc); | 91 | get_regs_from_mc(®s, mc); |
102 | timer_handler(SIGALRM, NULL, regs); | 92 | timer_handler(SIGALRM, NULL, ®s); |
103 | |||
104 | free(regs); | ||
105 | } | 93 | } |
106 | 94 | ||
107 | void timer_alarm_handler(int sig, struct siginfo *unused_si, mcontext_t *mc) | 95 | void timer_alarm_handler(int sig, struct siginfo *unused_si, mcontext_t *mc) |