Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

Name:__text_poke

Proto:static void *__text_poke(void *addr, const void *opcode, size_t len)

Type:void

Parameter:

TypeParameterName
void *addr
const void *opcode
size_tlen
791  cross_page_boundary = offset_in_page(addr) + len > PAGE_SIZE
792  struct page * pages[2] = {NULL}
803  BUG_ON(!after_bootmem)
805  If Not core_kernel_text((unsignedlong)addr) Then
806  pages[0] = Support for virtually mapped pages
807  If cross_page_boundary Then pages[1] = Support for virtually mapped pages
809  Else
810  pages[0] = virt_to_page(kaddr) returns a valid pointer if and only if* virt_addr_valid(kaddr) returns true.(addr)
811  WARN_ON(!PageReserved(pages[0]))
812  If cross_page_boundary Then pages[1] = virt_to_page(kaddr) returns a valid pointer if and only if* virt_addr_valid(kaddr) returns true.(addr + PAGE_SIZE)
819  BUG_ON(!pages[0] || (cross_page_boundary && !pages[1]))
821  local_irq_save(flags)
827  pgprot = __pgprot(pgprot_val(PAGE_KERNEL) & ~_PAGE_GLOBAL)
832  ptep = get_locked_pte(poking_mm, poking_addr, & ptl)
837  VM_BUG_ON(!ptep)
839  pte = Conversion functions: convert a page and protection to a page entry,* and a page entry and page directory to the page they refer to.* (Currently stuck as a macro because of indirect forward reference* to linux/mm.h:page_to_nid())(pages[0], pgprot)
840  set_pte_at(poking_mm, poking_addr, ptep, pte)
842  If cross_page_boundary Then
843  pte = Conversion functions: convert a page and protection to a page entry,* and a page entry and page directory to the page they refer to.* (Currently stuck as a macro because of indirect forward reference* to linux/mm.h:page_to_nid())(pages[1], pgprot)
844  set_pte_at(poking_mm, poking_addr + PAGE_SIZE, ptep + 1, pte)
851  prev = Using a temporary mm allows to set temporary mappings that are not accessible* by other CPUs
853  Disable reporting bugs for current task
854  memcpy((u8 * )poking_addr + offset_in_page(addr), opcode, len)
855  Enable reporting bugs after kasan_disable_current()
861  The "volatile" is due to gcc bugs ()
863  pte_clear(poking_mm, poking_addr, ptep)
864  If cross_page_boundary Then pte_clear(poking_mm, poking_addr + PAGE_SIZE, ptep + 1)
872  unuse_temporary_mm(prev)
878  flush_tlb_mm_range(poking_mm, poking_addr, poking_addr + (cross_page_boundary ? 2 : 1) * PAGE_SIZE, PAGE_SHIFT determines the page size , false)
886  BUG_ON(memcmp(addr, opcode, len))
888  pte_unmap_unlock(ptep, ptl)
889  local_irq_restore(flags)
890  Return addr
Caller
NameDescribe
text_pokext_poke - Update instructions on a live kernel*@addr: address to modify*@opcode: source of the copy*@len: length to copy* Only atomic text poke/set should be allowed when not doing early patching
text_poke_kgdbxt_poke_kgdb - Update instructions on a live kernel by kgdb*@addr: address to modify*@opcode: source of the copy*@len: length to copy* Only atomic text poke/set should be allowed when not doing early patching