| Date | Thu, 26 Mar 2020 18:21:46 +0100 | From | Borislav Petkov <> | Subject | Re: [PATCH 06/70] x86/umip: Factor out instruction fetch |
| |
On Thu, Mar 19, 2020 at 10:13:03AM +0100, Joerg Roedel wrote: > From: Joerg Roedel <jroedel@suse.de> > > Factor out the code to fetch the instruction from user-space to a helper > function.
Add "No functional changes." here.
> Signed-off-by: Joerg Roedel <jroedel@suse.de> > --- > arch/x86/include/asm/insn-eval.h | 2 ++ > arch/x86/kernel/umip.c | 26 +++++----------------- > arch/x86/lib/insn-eval.c | 38 ++++++++++++++++++++++++++++++++ > 3 files changed, 46 insertions(+), 20 deletions(-)
...
> +int insn_fetch_from_user(struct pt_regs *regs, > + unsigned char buf[MAX_INSN_SIZE])
No need for that linebreak - fits in 80 cols.
> +{ > + unsigned long seg_base = 0; > + int not_copied; > + > + /* > + * If not in user-space long mode, a custom code segment could be in > + * use. This is true in protected mode (if the process defined a local > + * descriptor table), or virtual-8086 mode. In most of the cases > + * seg_base will be zero as in USER_CS. > + */ > + if (!user_64bit_mode(regs)) > + seg_base = insn_get_seg_base(regs, INAT_SEG_REG_CS); > + > + if (seg_base == -1L) > + return 0;
This reads strange: seg_base is changed only inside that if test so I guess we could test it there too:
if (!user_64bit_mode(regs)) { seg_base = insn_get_seg_base(regs, INAT_SEG_REG_CS); if (seg_base == -1L) return 0; }
which is a small enough change to not require a separate patch.
Thx.
-- Regards/Gruss, Boris.
https://people.kernel.org/tglx/notes-about-netiquette
|