From patchwork Mon Apr 12 16:24:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Olsa X-Patchwork-Id: 419837 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=BAYES_00,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7E34C43461 for ; Mon, 12 Apr 2021 16:27:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8058D613E4 for ; Mon, 12 Apr 2021 16:27:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244222AbhDLQ1j convert rfc822-to-8bit (ORCPT ); Mon, 12 Apr 2021 12:27:39 -0400 Received: from us-smtp-delivery-44.mimecast.com ([205.139.111.44]:46924 "EHLO us-smtp-delivery-44.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244297AbhDLQZi (ORCPT ); Mon, 12 Apr 2021 12:25:38 -0400 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-130-xCfcqp_7ObyxpbgdmtugIw-1; Mon, 12 Apr 2021 12:25:16 -0400 X-MC-Unique: xCfcqp_7ObyxpbgdmtugIw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1ADC891270; Mon, 12 Apr 2021 16:25:15 +0000 (UTC) Received: from krava.cust.in.nbox.cz (unknown [10.40.195.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6F3006A034; Mon, 12 Apr 2021 16:25:03 +0000 (UTC) From: Jiri Olsa To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko Cc: netdev@vger.kernel.org, bpf@vger.kernel.org, Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , =?utf-8?q?Toke_H=C3=B8iland-J=C3=B8rgensen?= , Julia Lawall Subject: [PATCHv4 bpf-next 0/5] bpf: Tracing and lsm programs re-attach Date: Mon, 12 Apr 2021 18:24:57 +0200 Message-Id: <20210412162502.1417018-1-jolsa@kernel.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jolsa@kernel.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org hi, while adding test for pinning the module while there's trampoline attach to it, I noticed that we don't allow link detach and following re-attach for trampolines. Adding that for tracing and lsm programs. You need to have patch [1] from bpf tree for test module attach test to pass. v4 changes: - fix wrong cleanup goto jump reported by Julia thanks, jirka [1] https://lore.kernel.org/bpf/20210326105900.151466-1-jolsa@kernel.org/ --- Jiri Olsa (5): bpf: Allow trampoline re-attach for tracing and lsm programs selftests/bpf: Add re-attach test to fentry_test selftests/bpf: Add re-attach test to fexit_test selftests/bpf: Add re-attach test to lsm test selftests/bpf: Test that module can't be unloaded with attached trampoline kernel/bpf/syscall.c | 23 +++++++++++++++++------ kernel/bpf/trampoline.c | 2 +- tools/testing/selftests/bpf/prog_tests/fentry_test.c | 51 ++++++++++++++++++++++++++++++++++++--------------- tools/testing/selftests/bpf/prog_tests/fexit_test.c | 51 ++++++++++++++++++++++++++++++++++++--------------- tools/testing/selftests/bpf/prog_tests/module_attach.c | 23 +++++++++++++++++++++++ tools/testing/selftests/bpf/prog_tests/test_lsm.c | 48 ++++++++++++++++++++++++++++++++++++++---------- tools/testing/selftests/bpf/test_progs.h | 2 +- 7 files changed, 152 insertions(+), 48 deletions(-)