From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="kFtZY927" Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CB8141BE for ; Tue, 5 Dec 2023 10:29:49 -0800 (PST) Received: from pwmachine.numericable.fr (85-170-33-133.rev.numericable.fr [85.170.33.133]) by linux.microsoft.com (Postfix) with ESMTPSA id 547B120B74C1; Tue, 5 Dec 2023 10:29:48 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 547B120B74C1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1701800989; bh=p9QL8Kt+5UQsFI8AQQL6+xEd4o+jfXrxLwgxf2qRJFw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kFtZY927UcOLS++18VuUQTd0Jp/H8okYShmfcOVrZ0Z1qWebTP3shnCIqKSYenHs6 8D+0VDxVdGmXFxiR7K0DQuVxTR+dTJALKYDVQTrQntvfB1Ensrr+YJWRxvRMv0N/U/ 1y07tSVWMePQUC5rr1Wk/yZqXszxxDc0xn8JRg/4= From: Francis Laniel To: stable@vger.kernel.org Cc: Greg KH , Francis Laniel , Masami Hiramatsu Subject: [PATCH 4.14.y 2/2] selftests/ftrace: Add new test case which checks non unique symbol Date: Tue, 5 Dec 2023 19:29:23 +0100 Message-Id: <20231205182923.128898-2-flaniel@linux.microsoft.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231205182923.128898-1-flaniel@linux.microsoft.com> References: <20231205182923.128898-1-flaniel@linux.microsoft.com> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Commit 03b80ff8023adae6780e491f66e932df8165e3a0 upstream. If name_show() is non unique, this test will try to install a kprobe on this function which should fail returning EADDRNOTAVAIL. On kernel where name_show() is not unique, this test is skipped. Link: https://lore.kernel.org/all/20231020104250.9537-3-flaniel@linux.microsoft.com/ Cc: stable@vger.kernel.org Signed-off-by: Francis Laniel Acked-by: Masami Hiramatsu (Google) Signed-off-by: Masami Hiramatsu (Google) --- .../ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc new file mode 100644 index 000000000000..bc9514428dba --- /dev/null +++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_non_uniq_symbol.tc @@ -0,0 +1,13 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# description: Test failure of registering kprobe on non unique symbol +# requires: kprobe_events + +SYMBOL='name_show' + +# We skip this test on kernel where SYMBOL is unique or does not exist. +if [ "$(grep -c -E "[[:alnum:]]+ t ${SYMBOL}" /proc/kallsyms)" -le '1' ]; then + exit_unsupported +fi + +! echo "p:test_non_unique ${SYMBOL}" > kprobe_events -- 2.34.1