x86/mm: Move is_vsyscall_vaddr() into asm/vsyscall.h
Subsystems (6)
Sasha Levin
maintainerPATCH 1/4 x86/mm: Move is_vsyscall_vaddr() into asm/vsyscall.h
From: Hou Tao <[email protected]>
[ Upstream commit ee0e39a63b78849f8abbef268b13e4838569f646 ]
Move is_vsyscall_vaddr() into asm/vsyscall.h to make it available for copy_from_kernel_nofault_allowed() in arch/x86/mm/maccess.c.
--- arch/x86/include/asm/vsyscall.h | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/x86/include/asm/vsyscall.h +10 -0
@@ -4,6 +4,7 @@#include <linux/seqlock.h> #include <uapi/asm/vsyscall.h> +#include <asm/page_types.h> #ifdef CONFIG_X86_VSYSCALL_EMULATION extern void map_vsyscall (void );
@@ -22,4 +23,13 @@ static inline bool emulate_vsyscall(struct pt_regs *regs, unsigned long address) }#endif +/* +* The (legacy) vsyscall page is the long page in the kernel portion +* of the address space that has user-accessible permissions. +*/ +static inline bool is_vsyscall_vaddr (unsigned long vaddr) +{ +return unlikely ((vaddr &PAGE_MASK ) ==VSYSCALL_ADDR ); +} +#endif /* _ASM_X86_VSYSCALL_H */
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 2/4 net/iucv: fix the allocation size of iucv_path_table array
From: Alexander Gordeev <[email protected]>
[ Upstream commit b4ea9b6a18ebf7f9f3a7a60f82e925186978cfcf ]
iucv_path_table is a dynamically allocated array of pointers to struct iucv_path items. Yet, its size is calculated as if it was an array of struct iucv_path items.
--- net/iucv/iucv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/iucv/iucv.c +2 -2
@@ -192,7 +192,7 @@ static char iucv_error_pathid[16] = "INVALID PATHID";static LIST_HEAD (iucv_handler_list);/* -* iucv_path_table: an array of iucv_path structures. +* iucv_path_table: array of pointers to iucv_path structures. */ static struct iucv_path **iucv_path_table;static unsigned long iucv_max_pathid;
@@ -603,7 +603,7 @@ static int iucv_enable(void)get_online_cpus (); rc = -ENOMEM ; - alloc_size = iucv_max_pathid *sizeof (struct iucv_path ); + alloc_size = iucv_max_pathid *sizeof (*iucv_path_table); iucv_path_table =kzalloc (alloc_size,GFP_KERNEL );if (!iucv_path_table) goto out;
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 3/4 block: sed-opal: handle empty atoms when parsing response
In reply to Sasha LevinFrom: Greg Joyce <[email protected]>
[ Upstream commit 5429c8de56f6b2bd8f537df3a1e04e67b9c04282 ]
The SED Opal response parsing function response_parse() does not handle the case of an empty atom in the response. This causes the entry count to be too high and the response fails to be parsed. Recognizing, but ignoring, empty atoms allows response handling to succeed.
--- block/opal_proto.h | 1 + block/sed-opal.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-)
block/opal_proto.h +1 -0
@@ -73,6 +73,7 @@ enum opal_response_token {#define SHORT_ATOM_BYTE 0xBF#define MEDIUM_ATOM_BYTE 0xDF#define LONG_ATOM_BYTE 0xE3 +#define EMPTY_ATOM_BYTE 0xFF#define OPAL_INVAL_PARAM 12#define OPAL_MANUFACTURED_INACTIVE 0x08
block/sed-opal.c +5 -1
@@ -844,16 +844,20 @@ static int response_parse(const u8 *buf, size_t length, token_length =response_parse_medium (iter, pos); else if (pos[0] <= LONG_ATOM_BYTE) /* long atom */ token_length =response_parse_long (iter, pos); + else if (pos[0] == EMPTY_ATOM_BYTE) /* empty atom */ + token_length =1 ; else /* TOKEN */ token_length =response_parse_token (iter, pos);if (token_length <0 )return token_length; +if (pos[0 ] !=EMPTY_ATOM_BYTE ) + num_entries++; + pos += token_length; total -= token_length; iter++; - num_entries++; }if (num_entries ==0 ) {
Signature · 1 line
2.43.0
Sasha Levin
maintainerPATCH 4/4 dm-verity, dm-crypt: align "struct bvec_iter" correctly
In reply to Sasha LevinFrom: Mikulas Patocka <[email protected]>
[ Upstream commit 787f1b2800464aa277236a66eb3c279535edd460 ]
"struct bvec_iter" is defined with the __packed attribute, so it is aligned on a single byte. On X86 (and on other architectures that support unaligned addresses in hardware), "struct bvec_iter" is accessed using the 8-byte and 4-byte memory instructions, however these instructions are less efficient if they operate on unaligned addresses.
(on RISC machines that don't have unaligned access in hardware, GCC generates byte-by-byte accesses that are very inefficient - see [1])
This commit reorders the entries in "struct dm_verity_io" and "struct convert_context", so that "struct bvec_iter" is aligned on 8 bytes.
[1] https://lore.kernel.org/all/ZcLuWUNRZadJr0tQ@fedora/T/
--- drivers/md/dm-crypt.c | 4 ++-- drivers/md/dm-verity.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/md/dm-crypt.c +2 -2
@@ -46,11 +46,11 @@struct convert_context {struct completion restart;struct bio *bio_in; -struct bio *bio_out;struct bvec_iter iter_in; +struct bio *bio_out;struct bvec_iter iter_out; -u64 cc_sector;atomic_t cc_pending; +u64 cc_sector;union {struct skcipher_request *req;struct aead_request *req_aead;
drivers/md/dm-verity.h +2 -2
@@ -72,11 +72,11 @@ struct dm_verity_io {/* original value of bio->bi_end_io */ bio_end_io_t *orig_bi_end_io; +struct bvec_iter iter; +sector_t block;unsigned n_blocks; -struct bvec_iter iter; -struct work_struct work;/*
Signature · 1 line
2.43.0
Hi!
Quoted 2 lines
Move
is_vsyscall_vaddr()intoasm/vsyscall.hto make it available forcopy_from_kernel_nofault_allowed()inarch/x86/mm/maccess.c.
This seems to be just part of a patch -- it does not move anything -- and we should not really need it for 4.19, as we don't have those copy_from_kernel_nofault_allowed changes.
Best regards,
Pavel
Quoted 23 lines
+++
b/arch/x86/include/asm/vsyscall.harch/x86/include/asm/vsyscall.h +10
-0@@ -4,6 +4,7 @@#include <linux/seqlock.h> #include <uapi/asm/vsyscall.h> +#include <asm/page_types.h> #ifdef CONFIG_X86_VSYSCALL_EMULATION extern void map_vsyscall (void );@@ -22,4 +23,13 @@ static inline bool emulate_vsyscall(struct pt_regs *regs, unsigned long address) }#endif +/* +* The (legacy) vsyscall page is the long page in the kernel portion +* of the address space that has user-accessible permissions. +*/ +static inline bool is_vsyscall_vaddr (unsigned long vaddr) +{ +return unlikely ((vaddr &PAGE_MASK ) ==VSYSCALL_ADDR ); +} +#endif /* _ASM_X86_VSYSCALL_H */
Signature · 1 line
People of Russia, stop Putin before his war on Ukraine escalates.
Sasha Levin
maintainerQuoted 8 lines · Pavel Machek
Hi!
Quoted 2 lines
Move
is_vsyscall_vaddr()intoasm/vsyscall.hto make it available forcopy_from_kernel_nofault_allowed()inarch/x86/mm/maccess.c.This seems to be just part of a patch -- it does not move anything -- and we should not really need it for 4.19, as we don't have those
copy_from_kernel_nofault_allowedchanges.
Yup, looks like it's not needed on <5.10.
Signature · 2 lines
Thanks, Sasha