/
usr
/
src
/
linux-headers-5.15.0-181
/
scripts
/
/usr/src/linux-headers-5.15.0-181/scripts
mkdir
upload
Name
Size
Mode
Actions
atomic/
-
0755
rm
basic/
-
0755
rm
clang-tools/
-
0755
rm
coccinelle/
-
0755
rm
dtc/
-
0755
rm
dummy-tools/
-
0755
rm
gcc-plugins/
-
0755
rm
gdb/
-
0755
rm
genksyms/
-
0755
rm
kconfig/
-
0755
rm
ksymoops/
-
0755
rm
mod/
-
0755
rm
package/
-
0755
rm
selinux/
-
0755
rm
tracing/
-
0755
rm
.gitignore
160
0644
edit
dl
rm
adjust_autoksyms.sh
2122
0755
edit
dl
rm
as-version.sh
2081
0755
edit
dl
rm
asn1_compiler.c
36180
0644
edit
dl
rm
bin2c.c
743
0644
edit
dl
rm
bloat-o-meter
3445
0755
edit
dl
rm
bootgraph.pl
5780
0755
edit
dl
rm
bpf_doc.py
25582
0755
edit
dl
rm
cc-can-link.sh
166
0755
edit
dl
rm
cc-version.sh
1549
0755
edit
dl
rm
check-sysctl-docs
4472
0755
edit
dl
rm
checkdeclares.pl
1123
0755
edit
dl
rm
checkincludes.pl
1988
0755
edit
dl
rm
checkkconfigsymbols.py
16126
0755
edit
dl
rm
checkpatch.pl
229128
0755
edit
dl
rm
checkstack.pl
6001
0755
edit
dl
rm
checksyscalls.sh
7600
0755
edit
dl
rm
checkversion.pl
2211
0755
edit
dl
rm
check_extable.sh
5048
0755
edit
dl
rm
cleanfile
3542
0755
edit
dl
rm
cleanpatch
5182
0755
edit
dl
rm
coccicheck
8075
0755
edit
dl
rm
config
4899
0755
edit
dl
rm
const_structs.checkpatch
1009
0644
edit
dl
rm
decodecode
2952
0755
edit
dl
rm
decode_stacktrace.sh
7691
0755
edit
dl
rm
depmod.sh
1441
0755
edit
dl
rm
dev-needs.sh
6219
0755
edit
dl
rm
diffconfig
4222
0755
edit
dl
rm
documentation-file-ref-check
5687
0755
edit
dl
rm
export_report.pl
4605
0755
edit
dl
rm
extract-cert.c
3720
0644
edit
dl
rm
extract-ikconfig
1734
0755
edit
dl
rm
extract-module-sig.pl
3746
0755
edit
dl
rm
extract-sys-certs.pl
3836
0755
edit
dl
rm
extract-vmlinux
1695
0755
edit
dl
rm
extract_xc3028.pl
45686
0755
edit
dl
rm
faddr2line
8364
0755
edit
dl
rm
file-size.sh
86
0755
edit
dl
rm
find-unused-docs.sh
1304
0755
edit
dl
rm
gcc-goto.sh
511
0755
edit
dl
rm
gcc-ld
711
0755
edit
dl
rm
gcc-x86_32-has-stack-protector.sh
405
0755
edit
dl
rm
gcc-x86_64-has-stack-protector.sh
195
0755
edit
dl
rm
generate_initcall_order.pl
6090
0755
edit
dl
rm
gen_autoksyms.sh
1509
0755
edit
dl
rm
gen_ksymdeps.sh
556
0755
edit
dl
rm
get_abi.pl
15463
0755
edit
dl
rm
get_dvb_firmware
25128
0755
edit
dl
rm
get_feat.pl
14689
0755
edit
dl
rm
get_maintainer.pl
68744
0755
edit
dl
rm
gfp-translate
1732
0755
edit
dl
rm
headerdep.pl
3587
0755
edit
dl
rm
headers_check.pl
3819
0755
edit
dl
rm
headers_install.sh
3431
0755
edit
dl
rm
insert-sys-cert.c
13392
0644
edit
dl
rm
jobserver-exec
2213
0755
edit
dl
rm
kallsyms.c
18498
0644
edit
dl
rm
Kbuild.include
10392
0644
edit
dl
rm
Kconfig.include
2635
0644
edit
dl
rm
kernel-doc
70388
0755
edit
dl
rm
ld-version.sh
1864
0755
edit
dl
rm
leaking_addresses.pl
13112
0755
edit
dl
rm
Lindent
502
0755
edit
dl
rm
link-vmlinux.sh
11181
0755
edit
dl
rm
Makefile
1681
0644
edit
dl
rm
Makefile.asm-generic
1864
0644
edit
dl
rm
Makefile.build
20135
0644
edit
dl
rm
Makefile.clang
1602
0644
edit
dl
rm
Makefile.clean
2254
0644
edit
dl
rm
Makefile.compiler
2806
0644
edit
dl
rm
Makefile.dtbinst
1007
0644
edit
dl
rm
Makefile.extrawarn
3092
0644
edit
dl
rm
Makefile.gcc-plugins
2778
0644
edit
dl
rm
Makefile.headersinst
2950
0644
edit
dl
rm
Makefile.host
4743
0644
edit
dl
rm
Makefile.kasan
1715
0644
edit
dl
rm
Makefile.kcov
333
0644
edit
dl
rm
Makefile.kcsan
739
0644
edit
dl
rm
Makefile.lib
18455
0644
edit
dl
rm
Makefile.modfinal
2793
0644
edit
dl
rm
Makefile.modinst
2581
0644
edit
dl
rm
Makefile.modpost
4478
0644
edit
dl
rm
Makefile.package
6771
0644
edit
dl
rm
Makefile.ubsan
770
0644
edit
dl
rm
Makefile.userprogs
1607
0644
edit
dl
rm
makelst
808
0755
edit
dl
rm
markup_oops.pl
8110
0755
edit
dl
rm
min-tool-version.sh
558
0755
edit
dl
rm
mkcompile_h
2541
0755
edit
dl
rm
mksysmap
1369
0755
edit
dl
rm
mkuboot.sh
414
0755
edit
dl
rm
module.lds.S
1691
0644
edit
dl
rm
modules-check.sh
427
0755
edit
dl
rm
nsdeps
1765
0644
edit
dl
rm
objdiff
2905
0755
edit
dl
rm
pahole-flags.sh
749
0755
edit
dl
rm
pahole-version.sh
269
0755
edit
dl
rm
parse-maintainers.pl
4646
0755
edit
dl
rm
patch-kernel
10185
0755
edit
dl
rm
profile2linkerlist.pl
414
0755
edit
dl
rm
prune-kernel
708
0755
edit
dl
rm
recordmcount.c
17152
0644
edit
dl
rm
recordmcount.h
19832
0644
edit
dl
rm
recordmcount.pl
18049
0755
edit
dl
rm
remove-stale-files
1336
0755
edit
dl
rm
setlocalversion
3580
0755
edit
dl
rm
show_delta
3087
0755
edit
dl
rm
sign-file.c
10172
0644
edit
dl
rm
sorttable.c
8949
0644
edit
dl
rm
sorttable.h
10063
0644
edit
dl
rm
spdxcheck-test.sh
277
0644
edit
dl
rm
spdxcheck.py
10334
0755
edit
dl
rm
spelling.txt
32646
0644
edit
dl
rm
sphinx-pre-install
25035
0755
edit
dl
rm
split-man.pl
604
0755
edit
dl
rm
stackdelta
1887
0755
edit
dl
rm
stackusage
794
0755
edit
dl
rm
subarch.include
619
0644
edit
dl
rm
syscallhdr.sh
1935
0755
edit
dl
rm
syscallnr.sh
1485
0755
edit
dl
rm
syscalltbl.sh
1489
0755
edit
dl
rm
tags.sh
10110
0755
edit
dl
rm
tools-support-relr.sh
546
0755
edit
dl
rm
ubuntu-retpoline-extract-one
7434
0644
edit
dl
rm
unifdef.c
35637
0644
edit
dl
rm
ver_linux
2648
0755
edit
dl
rm
xen-hypercalls.sh
386
0755
edit
dl
rm
xz_wrap.sh
563
0755
edit
dl
rm
Edit:
/usr/src/linux-headers-5.15.0-181/scripts/ubuntu-retpoline-extract-one
(7434B)
#!/bin/bash exec </dev/null object="$1" src="$2" bit16="$3" SECTION=".discard.retpoline_safe" # Form an associative lookup for the symbol numbers in the ELF symbol table. # Uses 8 character 0 expanded hexadecimal key for ease of consumption. __symbolmap_init() { readelf -W --syms "$1" | awk '($4 == "SECTION" && $1 ~ /^[0-9]*:/) { printf("%08x %08x\n", int($1), int($7)); }' | \ while read symbol_num section_num do echo "symbolmap_$symbol_num='$section_num'" done } symbolmap_init() { eval $(__symbolmap_init "$1") } symbolmap() { eval RET="\$symbolmap_$1" if [ "$RET" = '' ]; then echo "symbolmap: $1: invalid section" 1>&2 exit 1 fi } # Form an associative lookup for the section numbers in the ELF symbol table. # Uses 8 character 0 expanded hexadecimal key for ease of consumption. __sectionmap_init() { readelf -W --headers "$1" | \ awk ' { sub("\\[", ""); sub("\\]", ""); } ($1 ~ /^[0-9][0-9]*/) { printf("%08x %s %s %s\n", int($1), $2, $3, $4); } ' | \ { while read section_num section_name section_type section_vma do echo "sectionmap_$section_num='$section_name'" echo "sectionvma_$section_num='$section_vma'" case "$section_type" in REL|RELA) section_relocation="$section_type" ;; esac done echo "section_relocation='$section_relocation'" } } sectionmap_init() { eval $(__sectionmap_init "$1") } sectionmap() { eval RET="\$sectionmap_$1" if [ "$RET" = '' ]; then echo "sectionmap: $1: invalid section" 1>&2 exit 1 fi } sectionvma() { eval RET="\$sectionvma_$1" if [ "$RET" = '' ]; then echo "sectionvma: $1: invalid section" 1>&2 exit 1 fi } # Read and parse the hex-dump output. hex="[0-9a-f]" hex_8="$hex$hex$hex$hex$hex$hex$hex$hex" hexspc="[0-9a-f ]" hexspc_8="$hexspc$hexspc$hexspc$hexspc$hexspc$hexspc$hexspc$hexspc" raw32() { readelf --hex-dump "$2" "$1" 2>/dev/null | sed \ -e '/^Hex/d' -e '/^$/d' -e '/^ *NOTE/d' \ -e 's/ *[^ ][^ ]* *\('"$hex_8"'\) \('"$hexspc_8"'\) \('"$hexspc_8"'\) \('"$hexspc_8"'\) .*/\1 \2 \3 \4 /' \ -e 's/\('"$hex$hex"'\)\('"$hex$hex"'\)\('"$hex$hex"'\)\('"$hex$hex"'\) /\4\3\2\1 /g' \ -e 's/ $//g' -e 's/ /\n/g' } #-e 's/\([^ ][^ ][^ ][^ ][^ ][^ ][^ ][^ ]\) \([^ ][^ ][^ ][^ ][^ ][^ ][^ ][^ ]\) /\2\1 /g' \ rela() { #file="$(basename "$1")" file="$1" # Read relocation information for a 64bit binary. Each relocation entry # is 3 long longs so we collect 6 quads here. Note that the dump is in # listed in increasing byte order not withstanding the quad split. # # The record says to take the value of <symbol> add <symbol offset> and # shove that into <write offset> in the segment of the <symbol>. # # Format: # <write offset> 64 bits # <symbol number> 32 bits # <relocation type> 32 bits # <symbol offset> 64 bits raw32 "$1" ".rela$SECTION" | \ { a1=''; a2=''; a3=''; a4=''; a5='' while read a6 do [ "$a1" = '' ] && { a1="$a6"; continue; } [ "$a2" = '' ] && { a2="$a6"; continue; } [ "$a3" = '' ] && { a3="$a6"; continue; } [ "$a4" = '' ] && { a4="$a6"; continue; } [ "$a5" = '' ] && { a5="$a6"; continue; } #echo ">$a1< >$a2< >$a3< >$a4< >$a5< >$a6<" 1>&2 #echo "type<$a3> symbol<$a4> offset<$a2$a1> addr<$a6a5>" 1>&2 symbolmap "$a4"; section_num="$RET" #echo "section_num<$section_num>" 1>&2 sectionmap "$section_num"; section="$RET" sectionvma "$section_num"; vma="$RET" #echo "section<$section> vma<$vma>" 1>&2 # Adjust the segment addressing by the segment offset. printf -v addr "%u" "0x$a6$a5" printf -v vma "%u" "0x$vma" let offset="$addr + $vma" printf -v offset "%x" "$offset" echo "$file-$section-$offset" a1=''; a2=''; a3=''; a4=''; a5='' done } | sed -e 's/-00*\([0-9a-f]\)/-\1/' } # Form an associative lookup for the raw contents for an ELF section. # Uses 8 character 0 expanded hexadecimal key for ease of consumption. contentmap_init() { raw32 "$1" "$2" >"$tmp" let offset=0 while read value do printf -v offset_hex "%08x" $offset eval contentmap_$offset_hex=\'$value\' let offset="$offset + 4" done <"$tmp" rm -f "$tmp" } contentmap() { eval RET="\$contentmap_$1" if [ "$RET" = '' ]; then echo "contentmap: $1: invalid offset" 1>&2 exit 1 fi } rel() { # Load up the current contents of the $SECTION segment # as the offsets (see below) are recorded there and we will need # those to calculate the actual address. contentmap_init "$1" "$SECTION" #file="$(basename "$1")" file="$1" # Read relocation information for a 32bit binary. Each relocation entry # is 3 longs so we collect 3 quads here. Note that the dump is in # listed in increasing byte order not withstanding the quad split. # # The record says to take the value of <symbol> and add that to the # existing contents of <write offset> in the segment of the <symbol>. # # Format: # <write offset> 32 bits # <symbol number> 24 bits # <relocation type> 8 bits raw32 "$1" ".rel$SECTION" | \ { a1='' while read a2 do [ "$a1" = '' ] && { a1="$a2"; continue; } #echo ">$a1< >$a2<" contentmap "$a1"; offset="$RET" symbolmap "00${a2%??}"; section_num="$RET" sectionmap "$section_num"; section="$RET" sectionvma "$section_num"; vma="$RET" #echo ">$a1< >$a2< >$offset< >$section<" echo "$file-$section-$offset" a1='' done } | sed -e 's/-00*\([0-9a-f]\)/-\1/' } tmp=$(mktemp --tmpdir "retpoline-extract-XXXXXX") disassemble() { local object="$1" local src="$2" local options="$3" local selector="$4" objdump $options --disassemble --no-show-raw-insn "$object" | \ awk -F' ' ' BEGIN { file="'"$object"'"; src="'"$src"'"; } /Disassembly of section/ { segment=$4; sub(":", "", segment); } /^[0-9a-f][0-9a-f]* <.*>:/ { tag=$0; sub(".*<", "", tag); sub(">.*", "", tag); } $0 ~ /(call|jmp)q? *\*0x[0-9a-f]*\(%rip\)/ { next } $0 ~ /(call|jmp)q? *\*.*%/ { sub(":", "", $1); if ('"$selector"') { offset=$1 $1=tag print(file "-" segment "-" offset " " src " " segment " " $0); } } ' } # Accumulate potentially vulnerable indirect call/jmp sequences. We do this # by examining the raw disassembly for affected forms, recording the location # of each. case "$bit16" in '') disassemble "$object" "$src" '' 'segment != ".init.text"' ;; *) disassemble "$object" "$src" '--disassembler-options=i8086' 'segment != ".init.text" && segment != ".text32" && segment != ".text64"' disassemble "$object" "$src" '--disassembler-options=i386' 'segment == ".text32"' disassemble "$object" "$src" '--disassembler-options=x86-64' 'segment == ".text64"' ;; esac | sort -k 1b,1 >"$object.ur-detected" [ ! -s "$object.ur-detected" ] && rm -f "$object.ur-detected" # Load up the symbol table and section mappings. symbolmap_init "$object" sectionmap_init "$object" # Accumulate annotated safe indirect call/jmp sequences. We do this by examining # the $SECTION sections (and their associated relocation information), # each entry represents the address of an instruction which has been marked # as ok. case "$section_relocation" in REL) rel "$object" ;; RELA) rela "$object" ;; esac | sort -k 1b,1 >"$object.ur-safe" [ ! -s "$object.ur-safe" ] && rm -f "$object.ur-safe" # We will perform the below join on the summarised and sorted fragments # formed above. This is performed in retpoline-check. #join -v 1 -j 1 "$tmp.extracted" "$tmp.safe" | sed -s 's/[^ ]* *//' rm -f "$tmp"
Save
cmd:
run