* Fedora kernel enabling Rust
@ 2024-10-17 22:03 Arnaldo Carvalho de Melo
2024-10-18 9:47 ` Alan Maguire
0 siblings, 1 reply; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2024-10-17 22:03 UTC (permalink / raw)
To: Alan Maguire, Miguel Ojeda; +Cc: Andrii Nakryiko, Jiri Olsa, dwarves
Hi,
While testing the latest patches on a fedora 40 system I
noticed:
Compilation Unit @ offset 0x77fda3d:
Length: 0xd527 (32-bit)
Version: 5
Unit Type: DW_UT_compile (1)
Abbrev Offset: 0x38012d
Pointer Size: 8
<0><77fda49>: Abbrev Number: 6 (DW_TAG_compile_unit)
<77fda4a> DW_AT_producer : (indirect string, offset: 0x4ec527): GNU C11 14.2.1 20240912 (Red Hat 14.2.1-3) -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m64 -mno-80387 -mno-fp-ret
-in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -mindirect-branch=thunk-extern -mindirect-branch-register -mindirect-branch-cs-prefix -mfunc
tion-return=thunk-extern -mharden-sls=all -mrecord-mcount -mfentry -march=x86-64 -g -O2 -std=gnu11 -p -fshort-wchar -funsigned-char -fno-common -fno-PIE -fno-strict-aliasing -fcf-protection=b
ranch -falign-jumps=1 -falign-loops=1 -fno-asynchronous-unwind-tables -fno-jump-tables -fpatchable-function-entry=16,16 -fno-delete-null-pointer-checks -fno-allow-store-data-races -fstack-pro
tector-strong -ftrivial-auto-var-init=zero -fno-stack-clash-protection -fmin-function-alignment=16 -fstrict-flex-arrays=3 -fno-strict-overflow -fstack-check=no -fconserve-stack -fsanitize=bou
nds-strict -fsanitize=shift
<77fda4e> DW_AT_language : 29 (C11)
<77fda4f> DW_AT_name : (indirect line string, offset: 0xfa3e): rust/exports.c
<77fda53> DW_AT_comp_dir : (indirect line string, offset: 0x4db): /usr/src/debug/kernel-6.11.3/linux-6.11.3-200.fc40.x86_64
<SNIP>
<78078ce> DW_AT_name : (indirect string, offset: 0x5310d): __UNIQUE_ID___addressable__RNvXshK_NtCshatLywNUlpX_8bindings12bindings_rawNtB6_28mei_connect_client_data_vtagNtNtCs2vSfyxKMEZc_4core7default7Default7default1222
<78078d2> DW_AT_decl_file : 4
<78078d3> DW_AT_decl_line : 740
<78078d5> DW_AT_decl_column : 1
<78078d5> DW_AT_type : <0x77fdac9>
<78078d9> DW_AT_location : 9 byte block: 3 0 0 0 0 0 0 0 0 (DW_OP_addr: 0)
<1><78078e3>: Abbrev Number: 1 (DW_TAG_variable)
<78078e4> DW_AT_name : (indirect string, offset: 0x51af69): _RNvXshL_NtCshatLywNUlpX_8bindings12bindings_rawNtB6_13hda_device_idNtNtCs2vSfyxKMEZc_4core7default7Default7default
<78078e8> DW_AT_decl_file : 4
<78078e9> DW_AT_decl_line : 741
<78078eb> DW_AT_decl_column : 1
<78078eb> DW_AT_type : <0x77fda8c>
<78078ef> DW_AT_external : 1
<78078ef> DW_AT_declaration : 1
<1><78078ef>: Abbrev Number: 2 (DW_TAG_variable)
<78078f0> DW_AT_name : (indirect string, offset: 0x83a79): __UNIQUE_ID___addressable__RNvXshL_NtCshatLywNUlpX_8bindings12bindings_rawNtB6_13hda_device_idNtNtCs2vSfyxKMEZc_4core7default7Default7default1223
That caused:
acme@number:~/git/pahole$ tests/btf_functions.sh
Validation of BTF encoding of functions; this may take some time: PAHOLE: Warning: Found invalid variable name when encoding btf, ignored (sym: '__UNIQUE_ID___addressable__RNvXsa_NtCs2vSfyxKMEZc_4core4charNtB5_11EscapeDebugNtNtNtNtB7_4iter6traits10exact_size17ExactSizeIterator3len57').
PAHOLE: Warning: Found invalid variable name when encoding btf, ignored (sym: '__UNIQUE_ID___addressable__RNvXse_NtCs2vSfyxKMEZc_4core4charNtB5_15CaseMappingIterNtNtNtNtB7_4iter6traits8iterator8Iterator4next59').
PAHOLE: Warning: Found invalid variable name when encoding btf, ignored (sym: '__UNIQUE_ID___addressable__RNvXse_NtCs2vSfyxKMEZc_4core4charNtB5_15CaseMappingIterNtNtNtNtB7_4iter6traits8iterator8Iterator9size_hint60').
PAHOLE: Warning: Found invalid variable name when encoding btf, ignored (sym: '__UNIQUE_ID___addressable__RNvXse_NtCs2vSfyxKMEZc_4core4charNtB5_15CaseMappingIterNtNtNtNtB7_4iter6traits8iterator8Iterator5count61').
PAHOLE: Warning: Found invalid variable name when encoding btf, ignored (sym: '__UNIQUE_ID___addressable__RNvXse_NtCs2vSfyxKMEZc_4core4charNtB5_15CaseMappingIterNtNtNtNtB7_4iter6traits8iterator8Iterator4last62').
PAHOLE: Warning: Found invalid variable name when encoding btf, ignored (sym: '__UNIQUE_ID___addressable__RNvXse_NtCs2vSfyxKMEZc_4core4charNtB5_15CaseMappingIterNtNtNtNtB7_4iter6traits8iterator8Iterator10advance_by63').
PAHOLE: Warning: Found invalid variable name when encoding btf, ignored (sym: '__UNIQUE_ID___addressable__RNvXsf_NtCs2vSfyxKMEZc_4core4charNtB5_15CaseMappingIterNtNtNtNtB7_4iter6traits12double_ended19DoubleEndedIterator9next_back64').
PAHOLE: Warning: Found invalid variable name when encoding btf, ignored (sym: '__UNIQUE_ID___addressable__RNvXsf_NtCs2vSfyxKMEZc_4core4charNtB5_15CaseMappingIterNtNtNtNtB7_4iter6traits12double_ended19DoubleEndedIterator15advance_back_by65').
PAHOLE: Warning: Found invalid variable name when encoding btf, ignored (sym: '__UNIQUE_ID___addressable__RNvXsg_NtCs2vSfyxKMEZc_4core4charNtB5_15CaseMappingIterNtNtNtNtB7_4iter6traits10exact_size17ExactSizeIterator3len66').
PAHOLE: Warning: Found invalid variable name when encoding btf, ignored (sym: '__UNIQUE_ID___addressable__RNvXsg_NtCs2vSfyxKMEZc_4core4charNtB5_15CaseMappingIterNtNtNtNtB7_4iter6traits10exact_size17ExactSizeIterator8is_empty67').
PAHOLE: Warning: Found invalid variable name when encoding btf, ignored (sym: '__UNIQUE_ID___addressable__RNvXs0_NtNtCs2vSfyxKMEZc_4core3net6parserNtNtB7_7ip_addr6IpAddrNtNtNtB9_3str6traits7FromStr8from_str95').
PAHOLE: Warning: Found invalid variable name when encoding btf, ignored (sym: '__UNIQUE_ID___addressable__RNvXs2_NtNtCs2vSfyxKMEZc_4core3net6parserNtNtB7_7ip_addr8Ipv4AddrNtNtNtB9_3str6traits7FromStr8from_str97').
At first I thought that was from Rust source code, but nope, its things
in C to connect to Rust, have you guys thought about this? The warning
is not that good, invalid why? Lenght of the symbol name?
Its the end of my work day, so I have yet to think this through, so just
reporting it here to initiate a discussion.
acme@number:~/git/pahole$ grep RUST /boot/config-6.11.3-200.fc40.x86_64
CONFIG_RUST_IS_AVAILABLE=y
CONFIG_RUST=y
CONFIG_RUSTC_VERSION_TEXT="rustc 1.81.0 (eeb90cda1 2024-09-04) (Fedora 1.81.0-1.fc40)"
CONFIG_HAVE_RUST=y
CONFIG_RUST_FW_LOADER_ABSTRACTIONS=y
CONFIG_BLK_DEV_RUST_NULL=m
CONFIG_RUST_PHYLIB_ABSTRACTIONS=y
CONFIG_AX88796B_RUST_PHY=y
CONFIG_HID_THRUSTMASTER=m
CONFIG_THRUSTMASTER_FF=y
CONFIG_TRUSTED_KEYS=y
CONFIG_HAVE_TRUSTED_KEYS=y
CONFIG_TRUSTED_KEYS_TPM=y
CONFIG_INTEGRITY_TRUSTED_KEYRING=y
CONFIG_IMA_SECURE_AND_OR_TRUSTED_BOOT=y
CONFIG_SYSTEM_TRUSTED_KEYRING=y
# CONFIG_SYSTEM_TRUSTED_KEYS="certs/rhel.pem"
CONFIG_SYSTEM_TRUSTED_KEYS=""
CONFIG_SECONDARY_TRUSTED_KEYRING=y
# CONFIG_SECONDARY_TRUSTED_KEYRING_SIGNED_BY_BUILTIN is not set
# CONFIG_RUST_DEBUG_ASSERTIONS is not set
CONFIG_RUST_OVERFLOW_CHECKS=y
# CONFIG_RUST_BUILD_ASSERT_ALLOW is not set
acme@number:~/git/pahole$
- Arnaldo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Fedora kernel enabling Rust
2024-10-17 22:03 Fedora kernel enabling Rust Arnaldo Carvalho de Melo
@ 2024-10-18 9:47 ` Alan Maguire
2024-10-22 18:45 ` Miguel Ojeda
0 siblings, 1 reply; 3+ messages in thread
From: Alan Maguire @ 2024-10-18 9:47 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Miguel Ojeda
Cc: Andrii Nakryiko, Jiri Olsa, dwarves, Stephen Brennan
On 17/10/2024 23:03, Arnaldo Carvalho de Melo wrote:
> Hi,
>
> While testing the latest patches on a fedora 40 system I
> noticed:
>
> Compilation Unit @ offset 0x77fda3d:
> Length: 0xd527 (32-bit)
> Version: 5
> Unit Type: DW_UT_compile (1)
> Abbrev Offset: 0x38012d
> Pointer Size: 8
> <0><77fda49>: Abbrev Number: 6 (DW_TAG_compile_unit)
> <77fda4a> DW_AT_producer : (indirect string, offset: 0x4ec527): GNU C11 14.2.1 20240912 (Red Hat 14.2.1-3) -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -mno-avx -m64 -mno-80387 -mno-fp-ret
> -in-387 -mpreferred-stack-boundary=3 -mskip-rax-setup -mtune=generic -mno-red-zone -mcmodel=kernel -mindirect-branch=thunk-extern -mindirect-branch-register -mindirect-branch-cs-prefix -mfunc
> tion-return=thunk-extern -mharden-sls=all -mrecord-mcount -mfentry -march=x86-64 -g -O2 -std=gnu11 -p -fshort-wchar -funsigned-char -fno-common -fno-PIE -fno-strict-aliasing -fcf-protection=b
> ranch -falign-jumps=1 -falign-loops=1 -fno-asynchronous-unwind-tables -fno-jump-tables -fpatchable-function-entry=16,16 -fno-delete-null-pointer-checks -fno-allow-store-data-races -fstack-pro
> tector-strong -ftrivial-auto-var-init=zero -fno-stack-clash-protection -fmin-function-alignment=16 -fstrict-flex-arrays=3 -fno-strict-overflow -fstack-check=no -fconserve-stack -fsanitize=bou
> nds-strict -fsanitize=shift
> <77fda4e> DW_AT_language : 29 (C11)
> <77fda4f> DW_AT_name : (indirect line string, offset: 0xfa3e): rust/exports.c
> <77fda53> DW_AT_comp_dir : (indirect line string, offset: 0x4db): /usr/src/debug/kernel-6.11.3/linux-6.11.3-200.fc40.x86_64
> <SNIP>
> <78078ce> DW_AT_name : (indirect string, offset: 0x5310d): __UNIQUE_ID___addressable__RNvXshK_NtCshatLywNUlpX_8bindings12bindings_rawNtB6_28mei_connect_client_data_vtagNtNtCs2vSfyxKMEZc_4core7default7Default7default1222
> <78078d2> DW_AT_decl_file : 4
> <78078d3> DW_AT_decl_line : 740
> <78078d5> DW_AT_decl_column : 1
> <78078d5> DW_AT_type : <0x77fdac9>
> <78078d9> DW_AT_location : 9 byte block: 3 0 0 0 0 0 0 0 0 (DW_OP_addr: 0)
> <1><78078e3>: Abbrev Number: 1 (DW_TAG_variable)
> <78078e4> DW_AT_name : (indirect string, offset: 0x51af69): _RNvXshL_NtCshatLywNUlpX_8bindings12bindings_rawNtB6_13hda_device_idNtNtCs2vSfyxKMEZc_4core7default7Default7default
> <78078e8> DW_AT_decl_file : 4
> <78078e9> DW_AT_decl_line : 741
> <78078eb> DW_AT_decl_column : 1
> <78078eb> DW_AT_type : <0x77fda8c>
> <78078ef> DW_AT_external : 1
> <78078ef> DW_AT_declaration : 1
> <1><78078ef>: Abbrev Number: 2 (DW_TAG_variable)
> <78078f0> DW_AT_name : (indirect string, offset: 0x83a79): __UNIQUE_ID___addressable__RNvXshL_NtCshatLywNUlpX_8bindings12bindings_rawNtB6_13hda_device_idNtNtCs2vSfyxKMEZc_4core7default7Default7default1223
>
> That caused:
>
> acme@number:~/git/pahole$ tests/btf_functions.sh
> Validation of BTF encoding of functions; this may take some time: PAHOLE: Warning: Found invalid variable name when encoding btf, ignored (sym: '__UNIQUE_ID___addressable__RNvXsa_NtCs2vSfyxKMEZc_4core4charNtB5_11EscapeDebugNtNtNtNtB7_4iter6traits10exact_size17ExactSizeIterator3len57').
> PAHOLE: Warning: Found invalid variable name when encoding btf, ignored (sym: '__UNIQUE_ID___addressable__RNvXse_NtCs2vSfyxKMEZc_4core4charNtB5_15CaseMappingIterNtNtNtNtB7_4iter6traits8iterator8Iterator4next59').
> PAHOLE: Warning: Found invalid variable name when encoding btf, ignored (sym: '__UNIQUE_ID___addressable__RNvXse_NtCs2vSfyxKMEZc_4core4charNtB5_15CaseMappingIterNtNtNtNtB7_4iter6traits8iterator8Iterator9size_hint60').
> PAHOLE: Warning: Found invalid variable name when encoding btf, ignored (sym: '__UNIQUE_ID___addressable__RNvXse_NtCs2vSfyxKMEZc_4core4charNtB5_15CaseMappingIterNtNtNtNtB7_4iter6traits8iterator8Iterator5count61').
> PAHOLE: Warning: Found invalid variable name when encoding btf, ignored (sym: '__UNIQUE_ID___addressable__RNvXse_NtCs2vSfyxKMEZc_4core4charNtB5_15CaseMappingIterNtNtNtNtB7_4iter6traits8iterator8Iterator4last62').
> PAHOLE: Warning: Found invalid variable name when encoding btf, ignored (sym: '__UNIQUE_ID___addressable__RNvXse_NtCs2vSfyxKMEZc_4core4charNtB5_15CaseMappingIterNtNtNtNtB7_4iter6traits8iterator8Iterator10advance_by63').
> PAHOLE: Warning: Found invalid variable name when encoding btf, ignored (sym: '__UNIQUE_ID___addressable__RNvXsf_NtCs2vSfyxKMEZc_4core4charNtB5_15CaseMappingIterNtNtNtNtB7_4iter6traits12double_ended19DoubleEndedIterator9next_back64').
> PAHOLE: Warning: Found invalid variable name when encoding btf, ignored (sym: '__UNIQUE_ID___addressable__RNvXsf_NtCs2vSfyxKMEZc_4core4charNtB5_15CaseMappingIterNtNtNtNtB7_4iter6traits12double_ended19DoubleEndedIterator15advance_back_by65').
> PAHOLE: Warning: Found invalid variable name when encoding btf, ignored (sym: '__UNIQUE_ID___addressable__RNvXsg_NtCs2vSfyxKMEZc_4core4charNtB5_15CaseMappingIterNtNtNtNtB7_4iter6traits10exact_size17ExactSizeIterator3len66').
> PAHOLE: Warning: Found invalid variable name when encoding btf, ignored (sym: '__UNIQUE_ID___addressable__RNvXsg_NtCs2vSfyxKMEZc_4core4charNtB5_15CaseMappingIterNtNtNtNtB7_4iter6traits10exact_size17ExactSizeIterator8is_empty67').
> PAHOLE: Warning: Found invalid variable name when encoding btf, ignored (sym: '__UNIQUE_ID___addressable__RNvXs0_NtNtCs2vSfyxKMEZc_4core3net6parserNtNtB7_7ip_addr6IpAddrNtNtNtB9_3str6traits7FromStr8from_str95').
> PAHOLE: Warning: Found invalid variable name when encoding btf, ignored (sym: '__UNIQUE_ID___addressable__RNvXs2_NtNtCs2vSfyxKMEZc_4core3net6parserNtNtB7_7ip_addr8Ipv4AddrNtNtNtB9_3str6traits7FromStr8from_str97').
>
>
> At first I thought that was from Rust source code, but nope, its things
> in C to connect to Rust, have you guys thought about this? The warning
> is not that good, invalid why? Lenght of the symbol name?
>
> Its the end of my work day, so I have yet to think this through, so just
> reporting it here to initiate a discussion.
>
> acme@number:~/git/pahole$ grep RUST /boot/config-6.11.3-200.fc40.x86_64
> CONFIG_RUST_IS_AVAILABLE=y
> CONFIG_RUST=y
> CONFIG_RUSTC_VERSION_TEXT="rustc 1.81.0 (eeb90cda1 2024-09-04) (Fedora 1.81.0-1.fc40)"
> CONFIG_HAVE_RUST=y
> CONFIG_RUST_FW_LOADER_ABSTRACTIONS=y
> CONFIG_BLK_DEV_RUST_NULL=m
> CONFIG_RUST_PHYLIB_ABSTRACTIONS=y
> CONFIG_AX88796B_RUST_PHY=y
> CONFIG_HID_THRUSTMASTER=m
> CONFIG_THRUSTMASTER_FF=y
> CONFIG_TRUSTED_KEYS=y
> CONFIG_HAVE_TRUSTED_KEYS=y
> CONFIG_TRUSTED_KEYS_TPM=y
> CONFIG_INTEGRITY_TRUSTED_KEYRING=y
> CONFIG_IMA_SECURE_AND_OR_TRUSTED_BOOT=y
> CONFIG_SYSTEM_TRUSTED_KEYRING=y
> # CONFIG_SYSTEM_TRUSTED_KEYS="certs/rhel.pem"
> CONFIG_SYSTEM_TRUSTED_KEYS=""
> CONFIG_SECONDARY_TRUSTED_KEYRING=y
> # CONFIG_SECONDARY_TRUSTED_KEYRING_SIGNED_BY_BUILTIN is not set
> # CONFIG_RUST_DEBUG_ASSERTIONS is not set
> CONFIG_RUST_OVERFLOW_CHECKS=y
> # CONFIG_RUST_BUILD_ASSERT_ALLOW is not set
> acme@number:~/git/pahole$
>
hi Arnaldo,
thanks for the report! This is as you suspected due to the name being
longer than KSYM_NAME_LEN as checked by btf_name_valid(), but we should
skip it anyway as __UNIQUE_ID is one of the filter prefixes we skip in
encoding. If we just reorder the checks we can avoid these warnings I
think. I've sent a patch for that [1]; if you could test it (or can
point me at a vmlinux with the symbols I can do so) that would be great.
Thanks!
Alan
[1]
https://lore.kernel.org/dwarves/20241018094301.1550149-1-alan.maguire@oracle.com/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Fedora kernel enabling Rust
2024-10-18 9:47 ` Alan Maguire
@ 2024-10-22 18:45 ` Miguel Ojeda
0 siblings, 0 replies; 3+ messages in thread
From: Miguel Ojeda @ 2024-10-22 18:45 UTC (permalink / raw)
To: Alan Maguire
Cc: Arnaldo Carvalho de Melo, Miguel Ojeda, Andrii Nakryiko,
Jiri Olsa, dwarves, Stephen Brennan
On Fri, Oct 18, 2024 at 11:47 AM Alan Maguire <alan.maguire@oracle.com> wrote:
>
> think. I've sent a patch for that [1]; if you could test it (or can
> point me at a vmlinux with the symbols I can do so) that would be great.
Thanks for quickly taking a look at this!
I tested it by running the `tests/btf_functions.sh` script that
Arnaldo shown, and indeed the warnings disappear when applying the
patch. I sent a `Tested-by` there in case it is useful.
In any case, but it is a good idea that you have a `vmlinux` around
that you can use for debugging this sort of things easily, so I
uploaded one to:
https://github.com/Rust-for-Linux/pahole-rust-cases/releases/download/rust-1.82.0-linux-v6.12-rc4/vmlinux
I also took the chance to update and add a few more object files to
this repository we had from the past:
https://github.com/Rust-for-Linux/pahole-rust-cases
I hope that helps!
Cheers,
Miguel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-10-22 18:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-17 22:03 Fedora kernel enabling Rust Arnaldo Carvalho de Melo
2024-10-18 9:47 ` Alan Maguire
2024-10-22 18:45 ` Miguel Ojeda
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox