patches and low-level development discussion
 help / color / mirror / code / Atom feed
From: Yureka <yuka@yuka.dev>
To: Alyssa Ross <hi@alyssa.is>
Cc: devel@spectrum-os.org
Subject: Re: [PATCH v4 2/5] tools: add xdp-forwarder
Date: Tue, 23 Sep 2025 17:50:21 +0200	[thread overview]
Message-ID: <25dd22ba-e501-4fa5-800c-6b3602bddfa4@yuka.dev> (raw)
In-Reply-To: <87qzvxkwwv.fsf@alyssa.is>


On 9/23/25 17:31, Alyssa Ross wrote:
> Yureka <yuka@yuka.dev> writes:
>
>> On 9/23/25 17:14, Alyssa Ross wrote:
>>> Yureka Lilian <yureka@cyberchaos.dev> 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 <yureka@cyberchaos.dev>
>>>> +# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
>>>> +
>>>> +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

  reply	other threads:[~2025-09-23 15:50 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-23 13:19 [PATCH v4 0/5] Yureka Lilian
2025-09-23 13:19 ` [PATCH v4 1/5] tools: rename guestSupport -> appSupport Yureka Lilian
2025-09-23 15:00   ` Alyssa Ross
2025-09-23 15:12     ` Yureka
2025-09-23 15:19   ` Alyssa Ross
2025-09-23 13:20 ` [PATCH v4 2/5] tools: add xdp-forwarder Yureka Lilian
2025-09-23 13:58   ` Alyssa Ross
2025-09-23 15:14   ` Alyssa Ross
     [not found]     ` <3b730bf9-15f7-43c9-8ea7-4ebd20e9d3e5@yuka.dev>
2025-09-23 15:31       ` Alyssa Ross
2025-09-23 15:50         ` Yureka [this message]
2025-09-23 16:17           ` Alyssa Ross
2025-09-23 15:16   ` Alyssa Ross
2025-09-24  9:52     ` Yureka
2025-09-23 13:20 ` [PATCH v4 3/5] docs/architecture: add paragraph about networking Yureka Lilian
2025-09-23 13:20 ` [PATCH v4 4/5] vm/sys/net: build against pkgsMusl Yureka Lilian
2025-09-23 15:20   ` Alyssa Ross
2025-09-23 13:20 ` [PATCH RFC v4 5/5] vm/sys/net: integrate xdp-forwarder Yureka Lilian
2025-09-23 15:24   ` Alyssa Ross
2025-09-23 15:24   ` Yureka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=25dd22ba-e501-4fa5-800c-6b3602bddfa4@yuka.dev \
    --to=yuka@yuka.dev \
    --cc=devel@spectrum-os.org \
    --cc=hi@alyssa.is \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).