From mboxrd@z Thu Jan 1 00:00:00 1970 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=-5.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham 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 23BE5C2D0DA for ; Thu, 26 Dec 2019 09:44:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E592C2075E for ; Thu, 26 Dec 2019 09:44:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726418AbfLZJoW (ORCPT ); Thu, 26 Dec 2019 04:44:22 -0500 Received: from www62.your-server.de ([213.133.104.62]:36112 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726336AbfLZJoW (ORCPT ); Thu, 26 Dec 2019 04:44:22 -0500 Received: from sslproxy02.your-server.de ([78.47.166.47]) by www62.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1ikPgp-0007rj-Tf; Thu, 26 Dec 2019 10:44:20 +0100 Received: from [185.105.41.13] (helo=linux-9.fritz.box) by sslproxy02.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ikPgp-000K40-KG; Thu, 26 Dec 2019 10:44:19 +0100 Subject: Re: [PATCH v2 bpf-next] libbpf: support CO-RE relocations for LDX/ST/STX instructions To: Yonghong Song , Andrii Nakryiko , "bpf@vger.kernel.org" , "netdev@vger.kernel.org" , Alexei Starovoitov Cc: "andrii.nakryiko@gmail.com" , Kernel Team References: <20191223180305.86417-1-andriin@fb.com> From: Daniel Borkmann Message-ID: Date: Thu, 26 Dec 2019 10:44:18 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.101.4/25674/Wed Dec 25 10:52:07 2019) Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On 12/23/19 7:10 PM, Yonghong Song wrote: > On 12/23/19 10:03 AM, Andrii Nakryiko wrote: >> Clang patch [0] enables emitting relocatable generic ALU/ALU64 instructions >> (i.e, shifts and arithmetic operations), as well as generic load/store >> instructions. The former ones are already supported by libbpf as is. This >> patch adds further support for load/store instructions. Relocatable field >> offset is encoded in BPF instruction's 16-bit offset section and are adjusted >> by libbpf based on target kernel BTF. >> >> These Clang changes and corresponding libbpf changes allow for more succinct >> generated BPF code by encoding relocatable field reads as a single >> ST/LDX/STX instruction. It also enables relocatable access to BPF context. >> Previously, if context struct (e.g., __sk_buff) was accessed with CO-RE >> relocations (e.g., due to preserve_access_index attribute), it would be >> rejected by BPF verifier due to modified context pointer dereference. With >> Clang patch, such context accesses are both relocatable and have a fixed >> offset from the point of view of BPF verifier. >> >> [0] https://reviews.llvm.org/D71790 >> >> Signed-off-by: Andrii Nakryiko > Acked-by: Yonghong Song Applied, thanks!