Checking GKI KMI compatibility for GKI modules

Not all exported symbols from GKI modules are part of KMI. Only those
found in the symbol list (abi_symbollist.report) are. So Module.symvers
alone is not enough to check GKI KMI compatibility.

This change references abi_symbollist.report (from the old GKI) to
decide what symbols really need to be checked.

Released Android 14 GKI 6.1
- 2023-07: 10521792
- 2023-08: 10672300
- 2023-09: 10816536

Bug: 300218636
Test: $ cd development/gki/kmi_abi_chk
      $ ./kmi_compatibility_test.sh sym-6.1/Module.symvers-10672300 sym-6.1/Module.symvers-10521792
Current kernel symbol file, sym-6.1/Module.symvers-10672300, is checking against:
	sym-6.1/Module.symvers-10521792
0x39780159	wwan_create_port	drivers/net/wwan/wwan	EXPORT_SYMBOL_GPL
0x35acf01e	wwan_register_ops	drivers/net/wwan/wwan	EXPORT_SYMBOL_GPL
sym-6.1/Module.symvers-10521792 contains symbol(s) not found in, or incompatible with, sym-6.1/Module.symvers-10672300.
      $ ./kmi_compatibility_test.sh sym-6.1/Module.symvers-10672300 sym-6.1/Module.symvers-10521792 abi_symbollist.report
ABI list: abi_symbollist.report
Current kernel symbol file, sym-6.1/Module.symvers-10672300, is checking against:
	sym-6.1/Module.symvers-10521792

Change-Id: Icb2e7949a6e576eded0c88311abca2e835826039
This commit is contained in:
Isaac Chen
2023-10-12 10:29:15 +08:00
parent 97b8ff21a5
commit 154c022bbb
5 changed files with 20760 additions and 9 deletions

View File

@@ -16,15 +16,18 @@
# Usage:
# development/gki/kmi_abi_chk/kmi_static_chk.sh \
# <current_symbol_info> <previous_symbol_info> ...
# <current_symbol_info> <previous_symbol_info> (abi_symbollist.report)
#
# abi_symbollist.report is from the previous/old GKI and optional.
# If it's not on the command line, all symbols from the previous/old GKI
# are considered KMI and will be checked.
if [[ "$#" -lt 2 ]]; then
echo "Usage: $0 <current_symbol_info> <previous_symbol_info> ..."
echo "Usage: $0 <current_symbol_info> <previous_symbol_info> (abi_symbollist.report)"
exit 1
fi
ret=0
for f in "$@"; do
for f in $1 $2; do
if [[ ! -e "$f" ]]; then
echo "Kernel symbol file $f does not exist!" >&2
ret=1
@@ -34,12 +37,25 @@ for f in "$@"; do
fi
done
unset abi_list
if [[ "$#" -gt 2 ]]; then
if [[ ! -e "$3" ]]; then
echo "ABI symbol list $3 does not exist!" >&2
ret=1
else
abi_list=$3
fi
fi
if [[ ! ret -eq 0 ]]; then
exit $ret
fi
tmp=$(mktemp /tmp/linux-symvers.XXXXXX)
trap "rm -f $tmp" EXIT
tmp_symvers_new=$(mktemp /tmp/linux-symvers.XXXXXX)
tmp_symvers_old=$(mktemp /tmp/linux-symvers.XXXXXX)
tmp_abi_lst_old=$(mktemp /tmp/linux-symvers.XXXXXX)
trap "rm -f $tmp_symvers_new tmp_symvers_old tmp_abi_lst_old" EXIT
curr=$1
shift
@@ -58,18 +74,29 @@ shift
# break KMI ABI, because the requirement is "relaxed". We want this case to
# pass so a keyword like "...EXPORT_SYMBOL" in the current symbol file can
# still match "...EXPORT_SYMBOL_GPL" in the previous symbol file.
grep "EXPORT_SYMBOL" $curr | sed 's/[ \t]*$//' > $tmp
grep "EXPORT_SYMBOL" $curr | sed 's/[ \t]*$//' > $tmp_symvers_new
if [[ -v abi_list ]]; then
awk '{print $1}' $abi_list > $tmp_abi_lst_old
echo "ABI list: $abi_list"
fi
echo "Current kernel symbol file, $curr, is checking against:"
for f in "$@"; do
for f in $1; do
if [[ -v abi_list ]]; then
grep -wf $tmp_abi_lst_old $f > $tmp_symvers_old
else
cp $f $tmp_symvers_old
fi
echo " $f"
# if nothing is found, grep returns 1, which means every symbol in the
# previous release (usually in *.symvers-$BID) can be found in the current
# release, so is considered successful here.
# if grep returns 0, which means some symbols are found in the previous
# symbol file but not in the current symbol file, then something wrong!
if grep -vf $tmp $f; then
if grep -vf $tmp_symvers_new $tmp_symvers_old; then
ret=1
echo "$f contains symbol(s) not found in, or incompatible with, $curr." >&2
fi

View File

@@ -1 +1 @@
Module.symvers-10342778
Module.symvers-10816536

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff