aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-05-16 12:24:44 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-05-16 12:24:44 -0400
commit2b6b38b04c2e7fe1713104768048fe2cae89c38e (patch)
tree8a56f967aa7062589d45749f1ef032a3a0fcf6f4
parentbec6cd63aa0abb0752e3d04daa36e26c08a49315 (diff)
parentfb317002ab4419ae7e068bee6897f2d5745aa3b9 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
Pull s390 fixes from Martin Schwidefsky: - convert the debug feature to refcount_t - reduce the copy size for strncpy_from_user - 8 bug fixes * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: s390/virtio: change virtio_feature_desc:features type to __le32 s390: convert debug_info.ref_count from atomic_t to refcount_t s390: move _text symbol to address higher than zero s390/qdio: increase string buffer size s390/ccwgroup: increase string buffer size s390/topology: let topology_mnest_limit() return unsigned char s390/uaccess: use sane length for __strncpy_from_user() s390/uprobes: fix compile for !KPROBES s390/ftrace: fix compile for !MODULES s390/cputime: fix incorrect system time
-rw-r--r--arch/s390/include/asm/debug.h3
-rw-r--r--arch/s390/include/asm/dis.h2
-rw-r--r--arch/s390/include/asm/kprobes.h20
-rw-r--r--arch/s390/include/asm/sysinfo.h2
-rw-r--r--arch/s390/kernel/debug.c8
-rw-r--r--arch/s390/kernel/entry.S21
-rw-r--r--arch/s390/kernel/ftrace.c4
-rw-r--r--arch/s390/kernel/vmlinux.lds.S8
-rw-r--r--arch/s390/lib/probes.c1
-rw-r--r--arch/s390/lib/uaccess.c4
-rw-r--r--drivers/s390/cio/ccwgroup.c4
-rw-r--r--drivers/s390/cio/qdio_debug.h2
-rw-r--r--drivers/s390/virtio/virtio_ccw.c2
13 files changed, 55 insertions, 26 deletions
diff --git a/arch/s390/include/asm/debug.h b/arch/s390/include/asm/debug.h
index 0206c8052328..df7b54ea956d 100644
--- a/arch/s390/include/asm/debug.h
+++ b/arch/s390/include/asm/debug.h
@@ -10,6 +10,7 @@
10#include <linux/spinlock.h> 10#include <linux/spinlock.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/time.h> 12#include <linux/time.h>
13#include <linux/refcount.h>
13#include <uapi/asm/debug.h> 14#include <uapi/asm/debug.h>
14 15
15#define DEBUG_MAX_LEVEL 6 /* debug levels range from 0 to 6 */ 16#define DEBUG_MAX_LEVEL 6 /* debug levels range from 0 to 6 */
@@ -31,7 +32,7 @@ struct debug_view;
31typedef struct debug_info { 32typedef struct debug_info {
32 struct debug_info* next; 33 struct debug_info* next;
33 struct debug_info* prev; 34 struct debug_info* prev;
34 atomic_t ref_count; 35 refcount_t ref_count;
35 spinlock_t lock; 36 spinlock_t lock;
36 int level; 37 int level;
37 int nr_areas; 38 int nr_areas;
diff --git a/arch/s390/include/asm/dis.h b/arch/s390/include/asm/dis.h
index 60323c21938b..37f617dfbede 100644
--- a/arch/s390/include/asm/dis.h
+++ b/arch/s390/include/asm/dis.h
@@ -40,6 +40,8 @@ static inline int insn_length(unsigned char code)
40 return ((((int) code + 64) >> 7) + 1) << 1; 40 return ((((int) code + 64) >> 7) + 1) << 1;
41} 41}
42 42
43struct pt_regs;
44
43void show_code(struct pt_regs *regs); 45void show_code(struct pt_regs *regs);
44void print_fn_code(unsigned char *code, unsigned long len); 46void print_fn_code(unsigned char *code, unsigned long len);
45int insn_to_mnemonic(unsigned char *instruction, char *buf, unsigned int len); 47int insn_to_mnemonic(unsigned char *instruction, char *buf, unsigned int len);
diff --git a/arch/s390/include/asm/kprobes.h b/arch/s390/include/asm/kprobes.h
index 1293c4066cfc..28792ef82c83 100644
--- a/arch/s390/include/asm/kprobes.h
+++ b/arch/s390/include/asm/kprobes.h
@@ -27,12 +27,21 @@
27 * 2005-Dec Used as a template for s390 by Mike Grundy 27 * 2005-Dec Used as a template for s390 by Mike Grundy
28 * <grundym@us.ibm.com> 28 * <grundym@us.ibm.com>
29 */ 29 */
30#include <linux/types.h>
30#include <asm-generic/kprobes.h> 31#include <asm-generic/kprobes.h>
31 32
32#define BREAKPOINT_INSTRUCTION 0x0002 33#define BREAKPOINT_INSTRUCTION 0x0002
33 34
35#define FIXUP_PSW_NORMAL 0x08
36#define FIXUP_BRANCH_NOT_TAKEN 0x04
37#define FIXUP_RETURN_REGISTER 0x02
38#define FIXUP_NOT_REQUIRED 0x01
39
40int probe_is_prohibited_opcode(u16 *insn);
41int probe_get_fixup_type(u16 *insn);
42int probe_is_insn_relative_long(u16 *insn);
43
34#ifdef CONFIG_KPROBES 44#ifdef CONFIG_KPROBES
35#include <linux/types.h>
36#include <linux/ptrace.h> 45#include <linux/ptrace.h>
37#include <linux/percpu.h> 46#include <linux/percpu.h>
38#include <linux/sched/task_stack.h> 47#include <linux/sched/task_stack.h>
@@ -56,11 +65,6 @@ typedef u16 kprobe_opcode_t;
56 65
57#define KPROBE_SWAP_INST 0x10 66#define KPROBE_SWAP_INST 0x10
58 67
59#define FIXUP_PSW_NORMAL 0x08
60#define FIXUP_BRANCH_NOT_TAKEN 0x04
61#define FIXUP_RETURN_REGISTER 0x02
62#define FIXUP_NOT_REQUIRED 0x01
63
64/* Architecture specific copy of original instruction */ 68/* Architecture specific copy of original instruction */
65struct arch_specific_insn { 69struct arch_specific_insn {
66 /* copy of original instruction */ 70 /* copy of original instruction */
@@ -90,10 +94,6 @@ int kprobe_fault_handler(struct pt_regs *regs, int trapnr);
90int kprobe_exceptions_notify(struct notifier_block *self, 94int kprobe_exceptions_notify(struct notifier_block *self,
91 unsigned long val, void *data); 95 unsigned long val, void *data);
92 96
93int probe_is_prohibited_opcode(u16 *insn);
94int probe_get_fixup_type(u16 *insn);
95int probe_is_insn_relative_long(u16 *insn);
96
97#define flush_insn_slot(p) do { } while (0) 97#define flush_insn_slot(p) do { } while (0)
98 98
99#endif /* CONFIG_KPROBES */ 99#endif /* CONFIG_KPROBES */
diff --git a/arch/s390/include/asm/sysinfo.h b/arch/s390/include/asm/sysinfo.h
index 73bff45ced55..e784bed6ed7f 100644
--- a/arch/s390/include/asm/sysinfo.h
+++ b/arch/s390/include/asm/sysinfo.h
@@ -146,7 +146,7 @@ extern int topology_max_mnest;
146 * Returns the maximum nesting level supported by the cpu topology code. 146 * Returns the maximum nesting level supported by the cpu topology code.
147 * The current maximum level is 4 which is the drawer level. 147 * The current maximum level is 4 which is the drawer level.
148 */ 148 */
149static inline int topology_mnest_limit(void) 149static inline unsigned char topology_mnest_limit(void)
150{ 150{
151 return min(topology_max_mnest, 4); 151 return min(topology_max_mnest, 4);
152} 152}
diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c
index 530226b6cb19..86b3e74f569e 100644
--- a/arch/s390/kernel/debug.c
+++ b/arch/s390/kernel/debug.c
@@ -277,7 +277,7 @@ debug_info_alloc(const char *name, int pages_per_area, int nr_areas,
277 memset(rc->views, 0, DEBUG_MAX_VIEWS * sizeof(struct debug_view *)); 277 memset(rc->views, 0, DEBUG_MAX_VIEWS * sizeof(struct debug_view *));
278 memset(rc->debugfs_entries, 0 ,DEBUG_MAX_VIEWS * 278 memset(rc->debugfs_entries, 0 ,DEBUG_MAX_VIEWS *
279 sizeof(struct dentry*)); 279 sizeof(struct dentry*));
280 atomic_set(&(rc->ref_count), 0); 280 refcount_set(&(rc->ref_count), 0);
281 281
282 return rc; 282 return rc;
283 283
@@ -361,7 +361,7 @@ debug_info_create(const char *name, int pages_per_area, int nr_areas,
361 debug_area_last = rc; 361 debug_area_last = rc;
362 rc->next = NULL; 362 rc->next = NULL;
363 363
364 debug_info_get(rc); 364 refcount_set(&rc->ref_count, 1);
365out: 365out:
366 return rc; 366 return rc;
367} 367}
@@ -416,7 +416,7 @@ static void
416debug_info_get(debug_info_t * db_info) 416debug_info_get(debug_info_t * db_info)
417{ 417{
418 if (db_info) 418 if (db_info)
419 atomic_inc(&db_info->ref_count); 419 refcount_inc(&db_info->ref_count);
420} 420}
421 421
422/* 422/*
@@ -431,7 +431,7 @@ debug_info_put(debug_info_t *db_info)
431 431
432 if (!db_info) 432 if (!db_info)
433 return; 433 return;
434 if (atomic_dec_and_test(&db_info->ref_count)) { 434 if (refcount_dec_and_test(&db_info->ref_count)) {
435 for (i = 0; i < DEBUG_MAX_VIEWS; i++) { 435 for (i = 0; i < DEBUG_MAX_VIEWS; i++) {
436 if (!db_info->views[i]) 436 if (!db_info->views[i])
437 continue; 437 continue;
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
index a5f5d3bb3dbc..e408d9cc5b96 100644
--- a/arch/s390/kernel/entry.S
+++ b/arch/s390/kernel/entry.S
@@ -312,6 +312,7 @@ ENTRY(system_call)
312 lg %r14,__LC_VDSO_PER_CPU 312 lg %r14,__LC_VDSO_PER_CPU
313 lmg %r0,%r10,__PT_R0(%r11) 313 lmg %r0,%r10,__PT_R0(%r11)
314 mvc __LC_RETURN_PSW(16),__PT_PSW(%r11) 314 mvc __LC_RETURN_PSW(16),__PT_PSW(%r11)
315.Lsysc_exit_timer:
315 stpt __LC_EXIT_TIMER 316 stpt __LC_EXIT_TIMER
316 mvc __VDSO_ECTG_BASE(16,%r14),__LC_EXIT_TIMER 317 mvc __VDSO_ECTG_BASE(16,%r14),__LC_EXIT_TIMER
317 lmg %r11,%r15,__PT_R11(%r11) 318 lmg %r11,%r15,__PT_R11(%r11)
@@ -623,6 +624,7 @@ ENTRY(io_int_handler)
623 lg %r14,__LC_VDSO_PER_CPU 624 lg %r14,__LC_VDSO_PER_CPU
624 lmg %r0,%r10,__PT_R0(%r11) 625 lmg %r0,%r10,__PT_R0(%r11)
625 mvc __LC_RETURN_PSW(16),__PT_PSW(%r11) 626 mvc __LC_RETURN_PSW(16),__PT_PSW(%r11)
627.Lio_exit_timer:
626 stpt __LC_EXIT_TIMER 628 stpt __LC_EXIT_TIMER
627 mvc __VDSO_ECTG_BASE(16,%r14),__LC_EXIT_TIMER 629 mvc __VDSO_ECTG_BASE(16,%r14),__LC_EXIT_TIMER
628 lmg %r11,%r15,__PT_R11(%r11) 630 lmg %r11,%r15,__PT_R11(%r11)
@@ -1174,15 +1176,23 @@ cleanup_critical:
1174 br %r14 1176 br %r14
1175 1177
1176.Lcleanup_sysc_restore: 1178.Lcleanup_sysc_restore:
1179 # check if stpt has been executed
1177 clg %r9,BASED(.Lcleanup_sysc_restore_insn) 1180 clg %r9,BASED(.Lcleanup_sysc_restore_insn)
1181 jh 0f
1182 mvc __LC_EXIT_TIMER(8),__LC_ASYNC_ENTER_TIMER
1183 cghi %r11,__LC_SAVE_AREA_ASYNC
1178 je 0f 1184 je 0f
1185 mvc __LC_EXIT_TIMER(8),__LC_MCCK_ENTER_TIMER
11860: clg %r9,BASED(.Lcleanup_sysc_restore_insn+8)
1187 je 1f
1179 lg %r9,24(%r11) # get saved pointer to pt_regs 1188 lg %r9,24(%r11) # get saved pointer to pt_regs
1180 mvc __LC_RETURN_PSW(16),__PT_PSW(%r9) 1189 mvc __LC_RETURN_PSW(16),__PT_PSW(%r9)
1181 mvc 0(64,%r11),__PT_R8(%r9) 1190 mvc 0(64,%r11),__PT_R8(%r9)
1182 lmg %r0,%r7,__PT_R0(%r9) 1191 lmg %r0,%r7,__PT_R0(%r9)
11830: lmg %r8,%r9,__LC_RETURN_PSW 11921: lmg %r8,%r9,__LC_RETURN_PSW
1184 br %r14 1193 br %r14
1185.Lcleanup_sysc_restore_insn: 1194.Lcleanup_sysc_restore_insn:
1195 .quad .Lsysc_exit_timer
1186 .quad .Lsysc_done - 4 1196 .quad .Lsysc_done - 4
1187 1197
1188.Lcleanup_io_tif: 1198.Lcleanup_io_tif:
@@ -1190,15 +1200,20 @@ cleanup_critical:
1190 br %r14 1200 br %r14
1191 1201
1192.Lcleanup_io_restore: 1202.Lcleanup_io_restore:
1203 # check if stpt has been executed
1193 clg %r9,BASED(.Lcleanup_io_restore_insn) 1204 clg %r9,BASED(.Lcleanup_io_restore_insn)
1194 je 0f 1205 jh 0f
1206 mvc __LC_EXIT_TIMER(8),__LC_MCCK_ENTER_TIMER
12070: clg %r9,BASED(.Lcleanup_io_restore_insn+8)
1208 je 1f
1195 lg %r9,24(%r11) # get saved r11 pointer to pt_regs 1209 lg %r9,24(%r11) # get saved r11 pointer to pt_regs
1196 mvc __LC_RETURN_PSW(16),__PT_PSW(%r9) 1210 mvc __LC_RETURN_PSW(16),__PT_PSW(%r9)
1197 mvc 0(64,%r11),__PT_R8(%r9) 1211 mvc 0(64,%r11),__PT_R8(%r9)
1198 lmg %r0,%r7,__PT_R0(%r9) 1212 lmg %r0,%r7,__PT_R0(%r9)
11990: lmg %r8,%r9,__LC_RETURN_PSW 12131: lmg %r8,%r9,__LC_RETURN_PSW
1200 br %r14 1214 br %r14
1201.Lcleanup_io_restore_insn: 1215.Lcleanup_io_restore_insn:
1216 .quad .Lio_exit_timer
1202 .quad .Lio_done - 4 1217 .quad .Lio_done - 4
1203 1218
1204.Lcleanup_idle: 1219.Lcleanup_idle:
diff --git a/arch/s390/kernel/ftrace.c b/arch/s390/kernel/ftrace.c
index 27477f34cc0a..d03a6d12c4bd 100644
--- a/arch/s390/kernel/ftrace.c
+++ b/arch/s390/kernel/ftrace.c
@@ -173,6 +173,8 @@ int __init ftrace_dyn_arch_init(void)
173 return 0; 173 return 0;
174} 174}
175 175
176#ifdef CONFIG_MODULES
177
176static int __init ftrace_plt_init(void) 178static int __init ftrace_plt_init(void)
177{ 179{
178 unsigned int *ip; 180 unsigned int *ip;
@@ -191,6 +193,8 @@ static int __init ftrace_plt_init(void)
191} 193}
192device_initcall(ftrace_plt_init); 194device_initcall(ftrace_plt_init);
193 195
196#endif /* CONFIG_MODULES */
197
194#ifdef CONFIG_FUNCTION_GRAPH_TRACER 198#ifdef CONFIG_FUNCTION_GRAPH_TRACER
195/* 199/*
196 * Hook the return address and push it in the stack of return addresses 200 * Hook the return address and push it in the stack of return addresses
diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S
index 72307f108c40..6e2c42bd1c3b 100644
--- a/arch/s390/kernel/vmlinux.lds.S
+++ b/arch/s390/kernel/vmlinux.lds.S
@@ -31,8 +31,14 @@ SECTIONS
31{ 31{
32 . = 0x00000000; 32 . = 0x00000000;
33 .text : { 33 .text : {
34 _text = .; /* Text and read-only data */ 34 /* Text and read-only data */
35 HEAD_TEXT 35 HEAD_TEXT
36 /*
37 * E.g. perf doesn't like symbols starting at address zero,
38 * therefore skip the initial PSW and channel program located
39 * at address zero and let _text start at 0x200.
40 */
41 _text = 0x200;
36 TEXT_TEXT 42 TEXT_TEXT
37 SCHED_TEXT 43 SCHED_TEXT
38 CPUIDLE_TEXT 44 CPUIDLE_TEXT
diff --git a/arch/s390/lib/probes.c b/arch/s390/lib/probes.c
index ae90e1ae3607..1963ddbf4ab3 100644
--- a/arch/s390/lib/probes.c
+++ b/arch/s390/lib/probes.c
@@ -4,6 +4,7 @@
4 * Copyright IBM Corp. 2014 4 * Copyright IBM Corp. 2014
5 */ 5 */
6 6
7#include <linux/errno.h>
7#include <asm/kprobes.h> 8#include <asm/kprobes.h>
8#include <asm/dis.h> 9#include <asm/dis.h>
9 10
diff --git a/arch/s390/lib/uaccess.c b/arch/s390/lib/uaccess.c
index 1e5bb2b86c42..b3bd3f23b8e8 100644
--- a/arch/s390/lib/uaccess.c
+++ b/arch/s390/lib/uaccess.c
@@ -337,8 +337,8 @@ long __strncpy_from_user(char *dst, const char __user *src, long size)
337 return 0; 337 return 0;
338 done = 0; 338 done = 0;
339 do { 339 do {
340 offset = (size_t)src & ~PAGE_MASK; 340 offset = (size_t)src & (L1_CACHE_BYTES - 1);
341 len = min(size - done, PAGE_SIZE - offset); 341 len = min(size - done, L1_CACHE_BYTES - offset);
342 if (copy_from_user(dst, src, len)) 342 if (copy_from_user(dst, src, len))
343 return -EFAULT; 343 return -EFAULT;
344 len_str = strnlen(dst, len); 344 len_str = strnlen(dst, len);
diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c
index e443b0d0b236..34b9ad6b3143 100644
--- a/drivers/s390/cio/ccwgroup.c
+++ b/drivers/s390/cio/ccwgroup.c
@@ -35,7 +35,7 @@ static struct bus_type ccwgroup_bus_type;
35static void __ccwgroup_remove_symlinks(struct ccwgroup_device *gdev) 35static void __ccwgroup_remove_symlinks(struct ccwgroup_device *gdev)
36{ 36{
37 int i; 37 int i;
38 char str[8]; 38 char str[16];
39 39
40 for (i = 0; i < gdev->count; i++) { 40 for (i = 0; i < gdev->count; i++) {
41 sprintf(str, "cdev%d", i); 41 sprintf(str, "cdev%d", i);
@@ -238,7 +238,7 @@ static void ccwgroup_release(struct device *dev)
238 238
239static int __ccwgroup_create_symlinks(struct ccwgroup_device *gdev) 239static int __ccwgroup_create_symlinks(struct ccwgroup_device *gdev)
240{ 240{
241 char str[8]; 241 char str[16];
242 int i, rc; 242 int i, rc;
243 243
244 for (i = 0; i < gdev->count; i++) { 244 for (i = 0; i < gdev->count; i++) {
diff --git a/drivers/s390/cio/qdio_debug.h b/drivers/s390/cio/qdio_debug.h
index f33ce8577619..1d595d17bf11 100644
--- a/drivers/s390/cio/qdio_debug.h
+++ b/drivers/s390/cio/qdio_debug.h
@@ -11,7 +11,7 @@
11#include "qdio.h" 11#include "qdio.h"
12 12
13/* that gives us 15 characters in the text event views */ 13/* that gives us 15 characters in the text event views */
14#define QDIO_DBF_LEN 16 14#define QDIO_DBF_LEN 32
15 15
16extern debug_info_t *qdio_dbf_setup; 16extern debug_info_t *qdio_dbf_setup;
17extern debug_info_t *qdio_dbf_error; 17extern debug_info_t *qdio_dbf_error;
diff --git a/drivers/s390/virtio/virtio_ccw.c b/drivers/s390/virtio/virtio_ccw.c
index 2a76ea78a0bf..b18fe2014cf2 100644
--- a/drivers/s390/virtio/virtio_ccw.c
+++ b/drivers/s390/virtio/virtio_ccw.c
@@ -87,7 +87,7 @@ struct vq_info_block {
87} __packed; 87} __packed;
88 88
89struct virtio_feature_desc { 89struct virtio_feature_desc {
90 __u32 features; 90 __le32 features;
91 __u8 index; 91 __u8 index;
92} __packed; 92} __packed;
93 93