Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2556964rdb; Fri, 8 Dec 2023 11:32:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IF8Dv/lLALwEGAneMH+K25/uqj8+nhTSkXOujlVvvs7CyObnh/RlFU/Wukk0Ur4MfwXP4JG X-Received: by 2002:a17:90a:9f45:b0:28a:93d:814c with SMTP id q5-20020a17090a9f4500b0028a093d814cmr620576pjv.50.1702063947708; Fri, 08 Dec 2023 11:32:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702063947; cv=none; d=google.com; s=arc-20160816; b=SmfgeQ4iI3ZcGi2FtZo4kuOXsF6CAAnQotL76jj178OdCAjlrNsYqZ5+DywJSQMMEv MbDjTKUp+wwptUnX9GHgfs8HADuqOHuxdhy36OSIFh9NPwAWM5BEnIPrz3eOSg9ya0rV 3LSlZX3tyjRg3ZZntBHIJgDdBjN/pre0sigo9Mytq5deLbHOFochbkL1lxnvYzzUa1q/ +Jno36xYiyMLgX2/grvX9W0SNFxuY0d5Kqms+xzbEBIx3HQRqlPrOW/hzyLktmlL7kAJ nYgHM/kBq7HU5BVNPX6x0lGi8u42T8NacqQMno9n0fz7nquS3Ye/GrOMaUvFtrk7zeq3 /l7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=O6ndbVL4uxU82m7aXPrJdtt1Twlz3kSpUXUFiW9WyCw=; fh=fQgCWRvTCP/t++nK1ImfffmCDgAeoMpK4D1rM2RjSwU=; b=hYMN6l1qf0EOg0TlJmB/nin/hqPP51hYIfBdD4TDuRxTxzonIf0eNeyirNIS1axjHF z4nuYOzViwRF6wE/E5C45VPH7nfoa6gVMpBixFCi7r2A/0NtK1NszVwUzDJm5jPzEfL4 T30/SUeoeNkhW9Nun7vmzTrgTIEfYu+dHY45031JyqbgTKeUun1BlHHOdEI7PGr6Itwh VNyMInY9/g27htUdx4uRf6Vy/xrjIRVq5ttjoRbm0rlTz41WUx2kP8rnJUyElkNQvL73 E78ETLndueWrr/onB5DiZvVhXsui5Qk2r31TM0OFkkKqQcwt2VlMqgsbZ4xQHDn7zs4r WmmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=mjAHWZfG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id b10-20020a17090a800a00b0028065b30a0dsi3221718pjn.124.2023.12.08.11.32.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 11:32:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=mjAHWZfG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 3E1EE81065A9; Fri, 8 Dec 2023 11:32:26 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233858AbjLHTcQ (ORCPT + 99 others); Fri, 8 Dec 2023 14:32:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229572AbjLHTcP (ORCPT ); Fri, 8 Dec 2023 14:32:15 -0500 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4C6E1712; Fri, 8 Dec 2023 11:32:21 -0800 (PST) Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-3332efd75c9so2257767f8f.2; Fri, 08 Dec 2023 11:32:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702063940; x=1702668740; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=O6ndbVL4uxU82m7aXPrJdtt1Twlz3kSpUXUFiW9WyCw=; b=mjAHWZfGoD3lu4E36aDFtxDI1kMWUbIwmOgOWNytWN7tiWP1KFySw0yfgSnVXNPNay 9zeLLJXlUnZV+lwzasHiMQsmSgs/hLSCxLQBEZp1DCT/aW8buqjFeYSQ+/VN+VKV6+wU vL4Z73edPTFA6virPYQ1k1hlDFPhF64YmdhT+3Zlog0KAJIH2y2iVsZsDNF5swxsq++O EW3LIk4o3csmd13mRXnvqBd2YW/A3RjPWlx7y2f/QeMOwCAzehzhf9UpNhbpnKCn/m+a KEHd5XdYwH4lhxmXFr0UH639ZYhWBbQPFOQZ3RL2K1tVUilJ1Ihmr5M5tCH7WMfrUvuB dRxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702063940; x=1702668740; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=O6ndbVL4uxU82m7aXPrJdtt1Twlz3kSpUXUFiW9WyCw=; b=r58FgFkZbtWk4lk4NmLVR4WZd70WHOj/TtV+jfXyZbmNwK+bfdhEPeELfEZfhpDR3X OXEBZmAcKkp/9GzVU9qf8NFbZYCko7HQV0QECE5rfYRjUlgo8jFu/QdFfGYL4ELFq+Sh JbB5V/qLTDxtSAXF8MjElxxv8ZGzAcG/TwOEYGIF/kPviL747sAhW6uYaUFtlqoxJho4 2AewdNIIYKAnoFzEPaXc6jSnQgXnkcWVSXc/HD80YJuI5vsvXnoHJhWxw7YCd1eEZpoA 0gPqHY6SNPZb0TtOOcjfNgK77tZBalDRK66INvnUbmUq+PI4ApFDblEAPoL1xsxmGUKx lR0Q== X-Gm-Message-State: AOJu0Yyy8hx8/2h/StttI/w507W39GN8CYcraDlbSt7E2GRa/IQc3Bue obIytGwk1MgpCP6gfT9v+h1HPfsNnM9HSXyxkZ0= X-Received: by 2002:a05:600c:1d95:b0:40b:5f03:b3ca with SMTP id p21-20020a05600c1d9500b0040b5f03b3camr131680wms.236.1702063939942; Fri, 08 Dec 2023 11:32:19 -0800 (PST) MIME-Version: 1.0 References: <20231204181614.GA7299@noisy.programming.kicks-ass.net> <20231204183354.GC7299@noisy.programming.kicks-ass.net> <20231206163814.GB36423@noisy.programming.kicks-ass.net> <20231206183713.GA35897@noisy.programming.kicks-ass.net> <20231207093105.GA28727@noisy.programming.kicks-ass.net> <20231208102940.GB28727@noisy.programming.kicks-ass.net> <20231208134041.GD28727@noisy.programming.kicks-ass.net> In-Reply-To: <20231208134041.GD28727@noisy.programming.kicks-ass.net> From: Alexei Starovoitov Date: Fri, 8 Dec 2023 11:32:07 -0800 Message-ID: Subject: Re: [PATCH v2 2/2] x86/cfi,bpf: Fix BPF JIT call To: Peter Zijlstra Cc: Jiri Olsa , Song Liu , Song Liu , Paul Walmsley , Palmer Dabbelt , Albert Ou , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , X86 ML , "H. Peter Anvin" , "David S. Miller" , David Ahern , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Arnd Bergmann , Sami Tolvanen , Kees Cook , Nathan Chancellor , Nick Desaulniers , linux-riscv , LKML , Network Development , bpf , linux-arch , clang-built-linux , Josh Poimboeuf , Joao Moreira , Mark Rutland Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 08 Dec 2023 11:32:26 -0800 (PST) On Fri, Dec 8, 2023 at 5:41=E2=80=AFAM Peter Zijlstra wrote: > > On Fri, Dec 08, 2023 at 11:29:40AM +0100, Peter Zijlstra wrote: > > The only problem I now have is the one XXX, I'm not entirely sure what > > signature to use there. > > > @@ -119,6 +119,7 @@ int bpf_struct_ops_test_run(struct bpf_p > > op_idx =3D prog->expected_attach_type; > > err =3D bpf_struct_ops_prepare_trampoline(tlinks, link, > > &st_ops->func_models[op_i= dx], > > + /* XXX */ NULL, > > image, image + PAGE_SIZE)= ; > > if (err < 0) > > goto out; > > Duh, that should ofcourse be something of dummy_ops_test_ret_fn type. > Let me go fix that. Right. That should work. A bit wasteful to generate real code just to read hash from it via cfi_get_func_hash(), but it's a neat idea. I guess it's hard to get kcfi from __ADDRESSABLE in plain C and sprinkling asm("cfi_xxx: .long __kcfi_typeid..."); is worse? Even if it's a macro ? That macro would be used to define cfi_bpf_hash and all other stubs?