Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10422689ybi; Wed, 24 Jul 2019 22:57:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqyvuForjzmzPN1/gra7fUrAcqig5ZeeX+LWu7babe5prs9fkssFecDU7tjNfqhewX89Q3sx X-Received: by 2002:a17:90a:2525:: with SMTP id j34mr93691645pje.11.1564034255113; Wed, 24 Jul 2019 22:57:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564034255; cv=none; d=google.com; s=arc-20160816; b=N6wwEuw7LNweOD27kp9XD01yd91B4/+IM6KKhKfCTvCzov9B02ns9ZvrlC5XL23kAb L8rKSKmJWKjOuTXpn7qOPY0LmK0Py5b8f4d9ZJwWO/gq6R6I9YLMOchTHLfaZd8fz3RP qhUUF8TF9dM8awPPwmv+HYWu0E7w7vGyNuwJ+PV9LHVgc063n0g7S/KLpDhsMmjripBI W+VnhxEMwIE+r7RJw+ExwjoXgUBoO0E0n4DBVcjjBpKuGy+wQoooVwIVwMwlBgAPHfq5 Wezqvgrqk2BTMCwY7f7FipATSYtS/i1eWSiioSwo3IQ+AhI4M/FqBPwkl6kZUFCBWM1k Og7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=rl5fChSurVvBxHdFSZ6VYHut3iUx3FDWLQF/LLhY02o=; b=yj6L+lRlzzk+FL/f/yul/knqnv/ZGLT3MWLsSTjJS3FkMhvoRUxYlKK2KTB0PzgQPV tPOkEoRXKN6kgvyGTrq0EDr72qDilIwJMHqQV9+q4QKEhMaFmoFJj7QuQW8VMTkts/iz +cYY0h/Fu4ZfZfdNvev3oyAGbiAUeLOFnqvmgK1TxbfAj2TwncDUa/YSMHHcPRlxgMgR 06rPBCKXLk0YS0CpG7uLuvTvXm8Si7l/lAF2fGx/fRjV8Q6/FSZvJAXhTqGfuNB49Eon JXFBeVI8vgdLl1hCdmyrOZqx6kKYMgA5sicIM8imE4HTRc2dF8VN59UShexS+KxsJnaZ CDcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=koFSEeZs; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e1si14021624plt.276.2019.07.24.22.57.20; Wed, 24 Jul 2019 22:57:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=koFSEeZs; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404481AbfGYFks (ORCPT + 99 others); Thu, 25 Jul 2019 01:40:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:55404 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404472AbfGYFkq (ORCPT ); Thu, 25 Jul 2019 01:40:46 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6707422BEF; Thu, 25 Jul 2019 05:40:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564033244; bh=Pi54KJDX+OcWbvK6G50o5iySA586M1xu3zaALpLCW2Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=koFSEeZsj9ThyRjtdEMmY2yjWPtmvCpl13X+6lvHvvIWWmL7gq+/N5BH6UhTQfv7T 4dwyZcNp+e+iBsePgRjHAUjAQjMPSOBN4yzSJFTLOV9RhFDBGBhBWQIxKpszu8MwzO ajT2QnDpLLsUXXYaNetlpyG2shR1HMqsQhIEAQSw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiri Benc , Yonghong Song , Daniel Borkmann , Sasha Levin Subject: [PATCH 4.19 142/271] selftests: bpf: fix inlines in test_lwt_seg6local Date: Wed, 24 Jul 2019 21:20:11 +0200 Message-Id: <20190724191707.367144731@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191655.268628197@linuxfoundation.org> References: <20190724191655.268628197@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 11aca65ec4db09527d3e9b6b41a0615b7da4386b ] Selftests are reporting this failure in test_lwt_seg6local.sh: + ip netns exec ns2 ip -6 route add fb00::6 encap bpf in obj test_lwt_seg6local.o sec encap_srh dev veth2 Error fetching program/map! Failed to parse eBPF program: Operation not permitted The problem is __attribute__((always_inline)) alone is not enough to prevent clang from inserting those functions in .text. In that case, .text is not marked as relocateable. See the output of objdump -h test_lwt_seg6local.o: Idx Name Size VMA LMA File off Algn 0 .text 00003530 0000000000000000 0000000000000000 00000040 2**3 CONTENTS, ALLOC, LOAD, READONLY, CODE This causes the iproute bpf loader to fail in bpf_fetch_prog_sec: bpf_has_call_data returns true but bpf_fetch_prog_relo fails as there's no relocateable .text section in the file. To fix this, convert to 'static __always_inline'. v2: Use 'static __always_inline' instead of 'static inline __attribute__((always_inline))' Fixes: c99a84eac026 ("selftests/bpf: test for seg6local End.BPF action") Signed-off-by: Jiri Benc Acked-by: Yonghong Song Signed-off-by: Daniel Borkmann Signed-off-by: Sasha Levin --- tools/testing/selftests/bpf/test_lwt_seg6local.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/bpf/test_lwt_seg6local.c b/tools/testing/selftests/bpf/test_lwt_seg6local.c index 0575751bc1bc..e2f6ed0a583d 100644 --- a/tools/testing/selftests/bpf/test_lwt_seg6local.c +++ b/tools/testing/selftests/bpf/test_lwt_seg6local.c @@ -61,7 +61,7 @@ struct sr6_tlv_t { unsigned char value[0]; } BPF_PACKET_HEADER; -__attribute__((always_inline)) struct ip6_srh_t *get_srh(struct __sk_buff *skb) +static __always_inline struct ip6_srh_t *get_srh(struct __sk_buff *skb) { void *cursor, *data_end; struct ip6_srh_t *srh; @@ -95,7 +95,7 @@ __attribute__((always_inline)) struct ip6_srh_t *get_srh(struct __sk_buff *skb) return srh; } -__attribute__((always_inline)) +static __always_inline int update_tlv_pad(struct __sk_buff *skb, uint32_t new_pad, uint32_t old_pad, uint32_t pad_off) { @@ -125,7 +125,7 @@ int update_tlv_pad(struct __sk_buff *skb, uint32_t new_pad, return 0; } -__attribute__((always_inline)) +static __always_inline int is_valid_tlv_boundary(struct __sk_buff *skb, struct ip6_srh_t *srh, uint32_t *tlv_off, uint32_t *pad_size, uint32_t *pad_off) @@ -184,7 +184,7 @@ int is_valid_tlv_boundary(struct __sk_buff *skb, struct ip6_srh_t *srh, return 0; } -__attribute__((always_inline)) +static __always_inline int add_tlv(struct __sk_buff *skb, struct ip6_srh_t *srh, uint32_t tlv_off, struct sr6_tlv_t *itlv, uint8_t tlv_size) { @@ -228,7 +228,7 @@ int add_tlv(struct __sk_buff *skb, struct ip6_srh_t *srh, uint32_t tlv_off, return update_tlv_pad(skb, new_pad, pad_size, pad_off); } -__attribute__((always_inline)) +static __always_inline int delete_tlv(struct __sk_buff *skb, struct ip6_srh_t *srh, uint32_t tlv_off) { @@ -266,7 +266,7 @@ int delete_tlv(struct __sk_buff *skb, struct ip6_srh_t *srh, return update_tlv_pad(skb, new_pad, pad_size, pad_off); } -__attribute__((always_inline)) +static __always_inline int has_egr_tlv(struct __sk_buff *skb, struct ip6_srh_t *srh) { int tlv_offset = sizeof(struct ip6_t) + sizeof(struct ip6_srh_t) + -- 2.20.1