translation_unit
comment "// SPDX-License-Identifier: GPL-2.0-or-later"
preproc_def
#define "#define"
identifier "_GNU_SOURCE"
comment "/* memmem() */"
preproc_include
#include "#include"
system_lib_string "<subcmd/parse-options.h>"
preproc_include
#include "#include"
system_lib_string "<stdlib.h>"
preproc_include
#include "#include"
system_lib_string "<string.h>"
preproc_include
#include "#include"
system_lib_string "<libgen.h>"
preproc_include
#include "#include"
system_lib_string "<stdio.h>"
preproc_include
#include "#include"
system_lib_string "<ctype.h>"
preproc_include
#include "#include"
system_lib_string "<objtool/objtool.h>"
preproc_include
#include "#include"
system_lib_string "<objtool/warn.h>"
preproc_include
#include "#include"
system_lib_string "<objtool/arch.h>"
preproc_include
#include "#include"
system_lib_string "<objtool/klp.h>"
preproc_include
#include "#include"
system_lib_string "<objtool/util.h>"
preproc_include
#include "#include"
system_lib_string "<arch/special.h>"
preproc_include
#include "#include"
system_lib_string "<linux/objtool_types.h>"
preproc_include
#include "#include"
system_lib_string "<linux/livepatch_external.h>"
preproc_include
#include "#include"
system_lib_string "<linux/stringify.h>"
preproc_include
#include "#include"
system_lib_string "<linux/string.h>"
preproc_include
#include "#include"
system_lib_string "<linux/jhash.h>"
preproc_function_def
#define "#define"
identifier "sizeof_field"
preproc_params
( "("
identifier "TYPE"
, ","
identifier "MEMBER"
) ")"
preproc_arg "sizeof((((TYPE *)0)->MEMBER))"
struct_specifier (+30 nodes collapsed)
; ";"
struct_specifier (+22 nodes collapsed)
; ";"
declaration (+28 nodes collapsed)
declaration (+58 nodes collapsed)
declaration
storage_class_specifier
static "static"
macro_type_specifier
identifier "DEFINE_HASHTABLE"
( "("
type_descriptor
type_identifier "exports"
ERROR
, ","
number_literal "15"
) ")"
identifier ""
; ";"
function_definition (+39 nodes collapsed)
function_definition (+319 nodes collapsed)
function_definition (+601 nodes collapsed)
function_definition (+353 nodes collapsed)
function_definition (+64 nodes collapsed)
function_definition (+64 nodes collapsed)
comment "/*\n * Certain static local variables should never be correla"...
function_definition (+194 nodes collapsed)
comment "/*\n * Clang emits several useless .Ltmp_* code labels.\n */"
function_definition (+71 nodes collapsed)
function_definition (+244 nodes collapsed)
comment "/*\n * These sections are referenced by special sections but "...
function_definition (+106 nodes collapsed)
comment "/*\n * These symbols should never be correlated, so their loc"...
function_definition (+117 nodes collapsed)
comment "/*\n * For each symbol in the original kernel, find its corre"...
function_definition (+738 nodes collapsed)
comment "/* \"sympos\" is used by livepatch to disambiguate duplicate s"...
function_definition (+390 nodes collapsed)
declaration (+25 nodes collapsed)
function_definition (+462 nodes collapsed)
function_definition (+100 nodes collapsed)
function_definition (+78 nodes collapsed)
comment "/*\n * Copy a symbol to the output object, optionally includi"...
function_definition (+187 nodes collapsed)
function_definition (+124 nodes collapsed)
comment "/*\n * Copy all changed functions (and their dependencies) fr"...
function_definition (+290 nodes collapsed)
function_definition (+80 nodes collapsed)
comment "/*\n * Determine whether a relocation should reference the se"...
function_definition (+105 nodes collapsed)
function_definition (+45 nodes collapsed)
function_definition (+86 nodes collapsed)
function_definition (+282 nodes collapsed)
comment "/* Get the object's module name as defined by the kernel (an"...
function_definition (+71 nodes collapsed)
comment "/*\n * Copying a function from its native compiled environmen"...
function_definition (+130 nodes collapsed)
function_definition (+136 nodes collapsed)
function_definition (+182 nodes collapsed)
comment "/*\n * Convert a relocation symbol reference to the needed fo"...
function_definition (+83 nodes collapsed)
comment "/*\n * Convert a regular relocation to a klp relocation (sort"...
function_definition (+759 nodes collapsed)
preproc_function_def
#define "#define"
identifier "dbg_clone_reloc"
preproc_params
( "("
identifier "sec"
, ","
identifier "offset"
, ","
identifier "patched_sym"
, ","
identifier "addend"
, ","
identifier "export"
, ","
identifier "klp"
) ")"
preproc_arg "dbg_indent(\"%s+0x%lx: %s%s0x%lx [%s%s%s%s%s%s]\",\t\t\t\t\\\n\t\t s"...
comment "/* Copy a reloc and its symbol to the output object */"
function_definition (+384 nodes collapsed)
comment "/* Copy all relocs needed for a symbol's contents */"
function_definition (+418 nodes collapsed)
function_definition (+178 nodes collapsed)
comment "/*\n * Special sections (alternatives, etc) are basically arr"...
function_definition (+500 nodes collapsed)
comment "/* Keep a special section entry if it references an included"...
function_definition (+123 nodes collapsed)
comment "/*\n * Klp relocations aren't allowed for __jump_table and .s"...
function_definition
storage_class_specifier
static "static"
primitive_type "int"
function_declarator
identifier "validate_special_section_klp_reloc"
parameter_list
( "("
parameter_declaration
struct_specifier
struct "struct"
type_identifier "elfs"
pointer_declarator
* "*"
identifier "e"
, ","
parameter_declaration
struct_specifier
struct "struct"
type_identifier "symbol"
pointer_declarator
* "*"
identifier "sym"
) ")"
compound_statement
{ "{"
declaration (+25 nodes collapsed)
declaration (+25 nodes collapsed)
declaration
struct_specifier
struct "struct"
type_identifier "symbol"
init_declarator
pointer_declarator
* "*"
identifier "code_sym"
= "="
null
NULL "NULL"
; ";"
declaration
sized_type_specifier
unsigned "unsigned"
long "long"
init_declarator
identifier "code_offset"
= "="
number_literal "0"
; ";"
declaration
struct_specifier
struct "struct"
type_identifier "reloc"
pointer_declarator
* "*"
identifier "reloc"
; ";"
declaration
primitive_type "int"
init_declarator
identifier "ret"
= "="
number_literal "0"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
unary_expression
! "!"
identifier "static_branch"
&& "&&"
unary_expression
! "!"
identifier "static_call"
) ")"
return_statement
return "return"
number_literal "0"
; ";"
expression_statement
call_expression
identifier "sym_for_each_reloc"
argument_list
( "("
field_expression
identifier "e"
-> "->"
field_identifier "patched"
, ","
identifier "sym"
, ","
identifier "reloc"
) ")"
; ""
compound_statement
{ "{"
declaration
type_qualifier
const "const"
primitive_type "char"
pointer_declarator
* "*"
identifier "sym_modname"
; ";"
declaration
struct_specifier
struct "struct"
type_identifier "export"
pointer_declarator
* "*"
identifier "export"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
call_expression
identifier "convert_reloc_sym"
argument_list
( "("
field_expression
identifier "e"
-> "->"
field_identifier "patched"
, ","
identifier "reloc"
) ")"
) ")"
continue_statement
continue "continue"
; ";"
comment "/* Static branch/call keys are always STT_OBJECT */"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
field_expression
field_expression
identifier "reloc"
-> "->"
field_identifier "sym"
-> "->"
field_identifier "type"
!= "!="
identifier "STT_OBJECT"
) ")"
compound_statement
{ "{"
comment "/* Save code location which can be printed below */"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
binary_expression
field_expression
field_expression
identifier "reloc"
-> "->"
field_identifier "sym"
-> "->"
field_identifier "type"
== "=="
identifier "STT_FUNC"
&& "&&"
unary_expression
! "!"
identifier "code_sym"
) ")"
compound_statement
{ "{"
expression_statement
assignment_expression
identifier "code_sym"
= "="
field_expression
identifier "reloc"
-> "->"
field_identifier "sym"
; ";"
expression_statement
assignment_expression
identifier "code_offset"
= "="
call_expression
identifier "reloc_addend"
argument_list
( "("
identifier "reloc"
) ")"
; ";"
} "}"
continue_statement
continue "continue"
; ";"
} "}"
if_statement
if "if"
parenthesized_expression
( "("
unary_expression
! "!"
call_expression
identifier "klp_reloc_needed"
argument_list
( "("
identifier "reloc"
) ")"
) ")"
continue_statement
continue "continue"
; ";"
expression_statement
assignment_expression
identifier "export"
= "="
call_expression
identifier "find_export"
argument_list
( "("
field_expression
identifier "reloc"
-> "->"
field_identifier "sym"
) ")"
; ";"
if_statement (+46 nodes collapsed)
comment "/* vmlinux keys are ok */"
if_statement (+21 nodes collapsed)
if_statement
if "if"
parenthesized_expression
( "("
identifier "static_branch"
) ")"
compound_statement
{ "{"
if_statement
if "if"
parenthesized_expression
( "("
call_expression
identifier "strstarts"
argument_list
( "("
field_expression
field_expression
identifier "reloc"
-> "->"
field_identifier "sym"
-> "->"
field_identifier "name"
, ","
string_literal
" "\""
string_content "__tracepoint_"
" "\""
) ")"
) ")"
compound_statement
{ "{"
expression_statement
call_expression
identifier "WARN"
argument_list
( "("
string_literal
" "\""
string_content "%s: disabling unsupported tracepoint %s"
" "\""
, ","
field_expression
identifier "code_sym"
-> "->"
field_identifier "name"
, ","
binary_expression
field_expression
field_expression
identifier "reloc"
-> "->"
field_identifier "sym"
-> "->"
field_identifier "name"
+ "+"
number_literal "13"
) ")"
; ";"
expression_statement
assignment_expression
identifier "ret"
= "="
number_literal "1"
; ";"
continue_statement
continue "continue"
; ";"
} "}"
if_statement
if "if"
parenthesized_expression
( "("
call_expression
identifier "strstr"
argument_list
( "("
field_expression
field_expression
identifier "reloc"
-> "->"
field_identifier "sym"
-> "->"
field_identifier "name"
, ","
string_literal
" "\""
string_content "__UNIQUE_ID_ddebug_"
" "\""
) ")"
) ")"
compound_statement
{ "{"
expression_statement
call_expression
identifier "WARN"
argument_list
( "("
string_literal
" "\""
string_content "%s: disabling unsupported pr_debug()"
" "\""
, ","
field_expression
identifier "code_sym"
-> "->"
field_identifier "name"
) ")"
; ";"
expression_statement
assignment_expression
identifier "ret"
= "="
number_literal "1"
; ";"
continue_statement
continue "continue"
; ";"
} "}"
expression_statement
call_expression
identifier "ERROR"
argument_list
( "("
string_literal
" "\""
string_content "%s+0x%lx: unsupported static branch key %s. Use static_key_"...
" "\""
, ","
field_expression
identifier "code_sym"
-> "->"
field_identifier "name"
, ","
identifier "code_offset"
, ","
field_expression
field_expression
identifier "reloc"
-> "->"
field_identifier "sym"
-> "->"
field_identifier "name"
) ")"
; ";"
return_statement
return "return"
number_literal "-1"
; ";"
} "}"
comment "/* static call */"
if_statement (+34 nodes collapsed)
expression_statement
call_expression
identifier "ERROR"
argument_list
( "("
string_literal
" "\""
string_content "%s()+0x%lx: unsupported static call key %s. Use KLP_STATIC_"...
" "\""
, ","
field_expression
identifier "code_sym"
-> "->"
field_identifier "name"
, ","
identifier "code_offset"
, ","
field_expression
field_expression
identifier "reloc"
-> "->"
field_identifier "sym"
-> "->"
field_identifier "name"
) ")"
; ";"
return_statement
return "return"
number_literal "-1"
; ";"
} "}"
return_statement
return "return"
identifier "ret"
; ";"
} "}"
function_definition (+153 nodes collapsed)
comment "/* Extract only the needed bits from special sections */"
function_definition (+78 nodes collapsed)
comment "/*\n * Create .init.klp_objects and .init.klp_funcs sections "...
function_definition (+1472 nodes collapsed)
comment "/*\n * Copy all .modinfo import_ns= tags to ensure all namesp"...
function_definition (+316 nodes collapsed)
function_definition (+400 nodes collapsed)