1#!/bin/bash 2# SPDX-License-Identifier: GPL-2.0 3# 4# A patch which deletes a function leaves a symbol in the original with no 5# counterpart in the patched object. klp diff cannot correlate it, and must 6# say so and carry on: livepatching cannot remove code from a running kernel, 7# so what matters is that the surviving caller is patched and the deleted 8# function is not dragged into the patch module. 9# 10# Cloning it would be worse than useless -- dead code in the patch, plus 11# whatever it references, resolved against a kernel where it may not exist. 12 13. "$(dirname "$0")/../lib.sh" 14 15setup 16build_pair function_removal.c 17 18# One-sided by construction: present in the original, gone from the patched. 19has_input_symbol orig.o going_away || 20 fail "fixture has no going_away in the original" 21has_input_symbol patched.o going_away && 22 fail "fixture still has going_away in the patched object" 23 24run_diff 25 26assert_diff_log 'no correlation: going_away' 27 28# The caller changed, so it is patched ... 29assert_patched caller 30# ... and the deleted function comes along in no form at all. 31assert_not_patched going_away 32assert_no_symbol going_away 33 34pass "deleted function reported as uncorrelated and left out of the patch" 35