Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'fixes' of git://git.armlinux.org.uk/~rmk/linux-arm

Pull ARM fix from Russell King:
"Last ARM fix for 4.14.

This plugs a hole in dump_instr(), which, with certain conditions
satisfied, can dump instructions from kernel space"

* 'fixes' of git://git.armlinux.org.uk/~rmk/linux-arm:
ARM: 8720/1: ensure dump_instr() checks addr_limit

+18 -10
+18 -10
arch/arm/kernel/traps.c
··· 154 154 set_fs(fs); 155 155 } 156 156 157 - static void dump_instr(const char *lvl, struct pt_regs *regs) 157 + static void __dump_instr(const char *lvl, struct pt_regs *regs) 158 158 { 159 159 unsigned long addr = instruction_pointer(regs); 160 160 const int thumb = thumb_mode(regs); 161 161 const int width = thumb ? 4 : 8; 162 - mm_segment_t fs; 163 162 char str[sizeof("00000000 ") * 5 + 2 + 1], *p = str; 164 163 int i; 165 164 166 165 /* 167 - * We need to switch to kernel mode so that we can use __get_user 168 - * to safely read from kernel space. Note that we now dump the 169 - * code first, just in case the backtrace kills us. 166 + * Note that we now dump the code first, just in case the backtrace 167 + * kills us. 170 168 */ 171 - fs = get_fs(); 172 - set_fs(KERNEL_DS); 173 169 174 170 for (i = -4; i < 1 + !!thumb; i++) { 175 171 unsigned int val, bad; 176 172 177 173 if (thumb) 178 - bad = __get_user(val, &((u16 *)addr)[i]); 174 + bad = get_user(val, &((u16 *)addr)[i]); 179 175 else 180 - bad = __get_user(val, &((u32 *)addr)[i]); 176 + bad = get_user(val, &((u32 *)addr)[i]); 181 177 182 178 if (!bad) 183 179 p += sprintf(p, i == 0 ? "(%0*x) " : "%0*x ", ··· 184 188 } 185 189 } 186 190 printk("%sCode: %s\n", lvl, str); 191 + } 187 192 188 - set_fs(fs); 193 + static void dump_instr(const char *lvl, struct pt_regs *regs) 194 + { 195 + mm_segment_t fs; 196 + 197 + if (!user_mode(regs)) { 198 + fs = get_fs(); 199 + set_fs(KERNEL_DS); 200 + __dump_instr(lvl, regs); 201 + set_fs(fs); 202 + } else { 203 + __dump_instr(lvl, regs); 204 + } 189 205 } 190 206 191 207 #ifdef CONFIG_ARM_UNWIND