Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:arch\x86\kernel\umip.c Create Date:2022-07-28 08:50:39
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:xup_umip_exception() - Fixup a general protection fault caused by UMIP*@regs: Registers as saved when entering the #GP handler* The instructions SGDT, SIDT, STR, SMSW and SLDT cause a general protection* fault if executed with CPL > 0 (i

Proto:bool fixup_umip_exception(struct pt_regs *regs)

Type:bool

Parameter:

TypeParameterName
struct pt_regs *regs
321  seg_base = 0
323  unsigned char dummy_data[10] = {0}
325  __user * uaddr
329  If Not regs Then Return false
338  If Not user_64bit_mode(regs) Then seg_base = sn_get_seg_base() - Obtain base address of segment descriptor
341  If seg_base == -1L Then Return false
344  not_copied = copy_from_user(buf, (void__user * )(seg_base + Return frame for iretq ), size of buf )
346  nr_copied = size of buf - not_copied
353  If Not nr_copied Then Return false
356  sn_init() - initialize struct insn*@insn: &struct insn to be initialized*@kaddr: address (in kernel memory) of instruction (or copy thereof)*@x86_64: !0 for 64-bit kernel or 64-bit app
368  seg_defs = sn_get_code_seg_params() - Obtain code segment parameters*@regs: Structure with register values as seen when entering kernel mode* Obtain address and operand sizes of the code segment. It is obtained from the* selector contained in the CS register in regs
369  If seg_defs == -EINVAL Then Return false
372  addr_bytes = INSN_CODE_SEG_ADDR_SZ(seg_defs)
373  opnd_bytes = INSN_CODE_SEG_OPND_SZ(seg_defs)
375  sn_get_length() - Get the length of instruction*@insn: &struct insn containing instruction* If necessary, first collects the instruction up to and including the* immediates bytes.
376  If nr_copied < length Then Return false
379  umip_inst = dentify_insn() - Identify a UMIP-protected instruction*@insn: Instruction structure with opcode and ModRM byte
380  If umip_inst < 0 Then Return false
383  umip_pr_warn(regs, "%s instruction cannot be used by applications.\n", umip_insns[umip_inst])
387  If umip_inst == 0F 00 /1 || umip_inst == 0F 00 /0 Then Return false
390  umip_pr_warn(regs, "For now, expensive software emulation returns the result.\n")
392  If mulate_umip_insn() - Emulate UMIP instructions and return dummy values*@insn: Instruction structure with operands*@umip_inst: A constant indicating the instruction to emulate*@data: Buffer into which the dummy result is stored*@data_size: Size of the Then Return false
402  If X86_MODRM_MOD(value) == 3 Then
403  reg_offset = sn_get_modrm_rm_off() - Obtain register in r/m part of the ModRM byte*@insn: Instruction containing the ModRM byte*@regs: Register values as seen when entering kernel mode* Returns:* The register indicated by the r/m part of the ModRM byte. The
410  If reg_offset < 0 Then Return false
413  reg_addr = regs + reg_offset
414  memcpy(reg_addr, dummy_data, dummy_data_size)
415  Else
416  uaddr = sn_get_addr_ref() - Obtain the linear address referred by instruction*@insn: Instruction structure containing ModRM byte and displacement*@regs: Structure with register values as seen when entering kernel mode* Obtain the linear address referred by the
417  If uaddr == -1L Then Return false
420  nr_copied = copy_to_user(uaddr, dummy_data, dummy_data_size)
421  If nr_copied > 0 Then
427  Return true
432  Return frame for iretq += length
433  Return true