Skip to content

Commit be79d28

Browse files
hcahcagregkh
authored andcommitted
s390: Revert support for DCACHE_WORD_ACCESS
commit 37540b8 upstream. load_unaligned_zeropad() reads eight bytes from unaligned addresses and may cross page boundaries. It handles exceptions which may happen if reading from the second page results in an exception. For pages which are donated to the Ultravisor for secure execution purposes the do_secure_storage_access() exception handler however does not handle such exceptions correctly. Such an exception may result in an endless exception loop which will never be resolved. An attempt to fix this [1] turned out to be not sufficient. For now revert load_unaligned_zeropad() until this problem has been resolved in a proper way. Note that the implementation of load_unaligned_zeropad() itself is correct. The revert is just a temporary workaround until there is complete fix for secure storage access exceptions. [1] commit b00be77 ("s390/mm: Add missing secure storage access fixups for donated memory") Fixes: 802ba53 ("s390: add support for DCACHE_WORD_ACCESS") Cc: stable@vger.kernel.org Acked-by: Christian Borntraeger <borntraeger@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com> Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 2421a7b commit be79d28

4 files changed

Lines changed: 0 additions & 45 deletions

File tree

arch/s390/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ config S390
161161
select ARCH_WANTS_THP_SWAP
162162
select BUILDTIME_TABLE_SORT
163163
select CLONE_BACKWARDS2
164-
select DCACHE_WORD_ACCESS if !KMSAN
165164
select DYNAMIC_FTRACE if FUNCTION_TRACER
166165
select FUNCTION_ALIGNMENT_8B if CC_IS_GCC
167166
select FUNCTION_ALIGNMENT_16B if !CC_IS_GCC

arch/s390/include/asm/asm-extable.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#define EX_TYPE_UA_FAULT 3
1313
#define EX_TYPE_UA_LOAD_REG 5
1414
#define EX_TYPE_UA_LOAD_REGPAIR 6
15-
#define EX_TYPE_ZEROPAD 7
1615
#define EX_TYPE_FPC 8
1716
#define EX_TYPE_UA_MVCOS_TO 9
1817
#define EX_TYPE_UA_MVCOS_FROM 10
@@ -80,9 +79,6 @@
8079
#define EX_TABLE_UA_LOAD_REGPAIR(_fault, _target, _regerr, _regzero) \
8180
__EX_TABLE(__ex_table, _fault, _target, EX_TYPE_UA_LOAD_REGPAIR, _regerr, _regzero, 0)
8281

83-
#define EX_TABLE_ZEROPAD(_fault, _target, _regdata, _regaddr) \
84-
__EX_TABLE(__ex_table, _fault, _target, EX_TYPE_ZEROPAD, _regdata, _regaddr, 0)
85-
8682
#define EX_TABLE_FPC(_fault, _target) \
8783
__EX_TABLE(__ex_table, _fault, _target, EX_TYPE_FPC, __stringify(%%r0), __stringify(%%r0), 0)
8884

arch/s390/include/asm/word-at-a-time.h

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
#include <linux/bitops.h>
66
#include <linux/wordpart.h>
7-
#include <asm/asm-extable.h>
87
#include <asm/bitsperlong.h>
98

109
struct word_at_a_time {
@@ -41,25 +40,4 @@ static inline unsigned long zero_bytemask(unsigned long data)
4140
return ~1UL << data;
4241
}
4342

44-
/*
45-
* Load an unaligned word from kernel space.
46-
*
47-
* In the (very unlikely) case of the word being a page-crosser
48-
* and the next page not being mapped, take the exception and
49-
* return zeroes in the non-existing part.
50-
*/
51-
static inline unsigned long load_unaligned_zeropad(const void *addr)
52-
{
53-
unsigned long data;
54-
55-
asm_inline volatile(
56-
"0: lg %[data],0(%[addr])\n"
57-
"1: nopr %%r7\n"
58-
EX_TABLE_ZEROPAD(0b, 1b, %[data], %[addr])
59-
EX_TABLE_ZEROPAD(1b, 1b, %[data], %[addr])
60-
: [data] "=d" (data)
61-
: [addr] "a" (addr), "m" (*(unsigned long *)addr));
62-
return data;
63-
}
64-
6543
#endif /* _ASM_WORD_AT_A_TIME_H */

arch/s390/mm/extable.c

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -50,22 +50,6 @@ static bool ex_handler_ua_load_reg(const struct exception_table_entry *ex,
5050
return true;
5151
}
5252

53-
static bool ex_handler_zeropad(const struct exception_table_entry *ex, struct pt_regs *regs)
54-
{
55-
unsigned int reg_addr = FIELD_GET(EX_DATA_REG_ADDR, ex->data);
56-
unsigned int reg_data = FIELD_GET(EX_DATA_REG_ERR, ex->data);
57-
unsigned long data, addr, offset;
58-
59-
addr = regs->gprs[reg_addr];
60-
offset = addr & (sizeof(unsigned long) - 1);
61-
addr &= ~(sizeof(unsigned long) - 1);
62-
data = *(unsigned long *)addr;
63-
data <<= BITS_PER_BYTE * offset;
64-
regs->gprs[reg_data] = data;
65-
regs->psw.addr = extable_fixup(ex);
66-
return true;
67-
}
68-
6953
static bool ex_handler_fpc(const struct exception_table_entry *ex, struct pt_regs *regs)
7054
{
7155
fpu_sfpc(0);
@@ -134,8 +118,6 @@ bool fixup_exception(struct pt_regs *regs)
134118
return ex_handler_ua_load_reg(ex, false, regs);
135119
case EX_TYPE_UA_LOAD_REGPAIR:
136120
return ex_handler_ua_load_reg(ex, true, regs);
137-
case EX_TYPE_ZEROPAD:
138-
return ex_handler_zeropad(ex, regs);
139121
case EX_TYPE_FPC:
140122
return ex_handler_fpc(ex, regs);
141123
case EX_TYPE_UA_MVCOS_TO:

0 commit comments

Comments
 (0)