From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from atuin.qyliss.net (localhost [IPv6:::1]) by atuin.qyliss.net (Postfix) with ESMTP id 7149CCEB4; Tue, 23 Sep 2025 15:50:26 +0000 (UTC) Received: by atuin.qyliss.net (Postfix, from userid 993) id 2F311CE7B; Tue, 23 Sep 2025 15:50:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on atuin.qyliss.net X-Spam-Level: X-Spam-Status: No, score=-0.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DMARC_PASS,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=4.0.1 Received: from mail.cyberchaos.dev (mail.cyberchaos.dev [IPv6:2a0f:4ac0::3a11]) by atuin.qyliss.net (Postfix) with ESMTPS id 2EB68CE79 for ; Tue, 23 Sep 2025 15:50:23 +0000 (UTC) Message-ID: <25dd22ba-e501-4fa5-800c-6b3602bddfa4@yuka.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yuka.dev; s=mail; t=1758642622; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9P5CouWibQNr2eT5KatRf5S1tu28kZL/bOVjF5k5ZEg=; b=vI0T7nw2FOUhjdYHlOkz62lr6jkqUHStbsOCwSXuLni0DtdDxwRiCUDv4pW1SPlqbAujJ/ Ccg7PcZ/XIVZvOX9yi1kp0Lq7QZ37QyAzpXw57YVRHGO1iNpz8BL3HFAa62EZSHVNQQIBY lVfkdpkot4F8rxYRL6tA/vIGhjjMDrk= Date: Tue, 23 Sep 2025 17:50:21 +0200 MIME-Version: 1.0 Subject: Re: [PATCH v4 2/5] tools: add xdp-forwarder To: Alyssa Ross References: <20250923132012.28013-1-yureka@cyberchaos.dev> <20250923132012.28013-3-yureka@cyberchaos.dev> <87plbhurp5.fsf@alyssa.is> <3b730bf9-15f7-43c9-8ea7-4ebd20e9d3e5@yuka.dev> <87qzvxkwwv.fsf@alyssa.is> Content-Language: en-US From: Yureka In-Reply-To: <87qzvxkwwv.fsf@alyssa.is> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Message-ID-Hash: MIENHWAGFRUW3KEJGJ4TRUCLNIMP2KF2 X-Message-ID-Hash: MIENHWAGFRUW3KEJGJ4TRUCLNIMP2KF2 X-MailFrom: yuka@yuka.dev X-Mailman-Rule-Hits: member-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address CC: devel@spectrum-os.org X-Mailman-Version: 3.3.9 Precedence: list List-Id: Patches and low-level development discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On 9/23/25 17:31, Alyssa Ross wrote: > Yureka writes: > >> On 9/23/25 17:14, Alyssa Ross wrote: >>> Yureka Lilian writes: >>>> @@ -88,12 +94,15 @@ stdenv.mkDerivation (finalAttrs: { >>>> mesonFlags = [ >>>> (lib.mesonBool "app" appSupport) >>>> (lib.mesonBool "host" hostSupport) >>>> + (lib.mesonBool "driver" driverSupport) >>>> "-Dhostfsrootdir=/run/virtiofs/virtiofs0" >>>> "-Dtests=false" >>>> "-Dunwind=false" >>>> "-Dwerror=true" >>>> ]; >>>> >>>> + hardeningDisable = lib.optionals driverSupport [ "zerocallusedregs" ]; >>>> + >>> Could we instead do this in bpf_o_cmd, so it's not disabled for >>> userspace programs? >> This environment variable works on the stdenv level, so it is difficult >> to mix it in from the meson recipe. Any way to do this would add NixOS >> specifics to the meson recipe and doesn't feel quite right. > The environment variable in stdenv just adds > -fzero-call-used-regs=used-gpr to the compiler flags, before the ones > given on the command line, so I was thinking we could just add > -fzero-call-used-regs=skip (the default) to bpf_o_cmd, to explicitly say > we don't want it for these compiler invocations. It'll override the > option given by the compiler wrapper, and won't do anything Nix-specific > — it would be the right thing for other distros that change compiler > defaults as well, which I think is not that uncommon. Sadly this does not work, because passing -fzero-call-used-regs=skip results in clang: error: unsupported option '-fzero-call-used-regs=skip' for target 'bpf' >>>> diff --git a/tools/xdp-forwarder/meson.build b/tools/xdp-forwarder/meson.build >>>> new file mode 100644 >>>> index 0000000..e6d91ca >>>> --- /dev/null >>>> +++ b/tools/xdp-forwarder/meson.build >>>> @@ -0,0 +1,48 @@ >>>> +# SPDX-License-Identifier: EUPL-1.2+ >>>> +# SPDX-FileCopyrightText: 2025 Yureka Lilian >>>> +# SPDX-FileCopyrightText: 2025 Demi Marie Obenour >>>> + >>>> +libbpf = dependency('libbpf', version : '1.6.2') >>>> + >>>> +executable('set-router-iface', 'set_router_iface.c', >>>> + dependencies : libbpf, >>>> + install : true) >>>> + >>>> +clang = find_program('clang') >>> Should be native: true I think. >> I can't find a parameter 'native' for find_program() in the meson docs. >> Can you explain why this option is needed? Is it to prevent passing two >> --target args when cross-compiling? > It's to prevent it trying to execute clang for the system you're > building for. You'd use find_program(…, native: false) (the default) if > you wanted to embed the path to that program in your binary, for > example. > > Documentation is here: > https://mesonbuild.com/Reference-manual_functions.html#find_program_native