Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test failure: incomplete type for struct af_alg_iv #3160

Closed
tones111 opened this issue Mar 21, 2023 · 1 comment
Closed

test failure: incomplete type for struct af_alg_iv #3160

tones111 opened this issue Mar 21, 2023 · 1 comment
Labels
C-bug Category: bug

Comments

@tones111
Copy link
Contributor

When attempting to run the test suite I get an error that struct af_alg_iv is not defined.

$ cd libc-test && cargo test
<snip>
  cargo:warning=/home/paul/src/libc/target/debug/build/libc-test-3ad7e5dad55ad485/out/main.c: In function ‘__test_fsize_af_alg_iv_iv’:
  cargo:warning=/home/paul/src/libc/target/debug/build/libc-test-3ad7e5dad55ad485/out/main.c:25567:34: error: invalid application of ‘sizeof’ to incomplete type ‘__u8[]’ {aka ‘unsigned char[]’}
  cargo:warning=25567 |                     return sizeof(foo->iv);
  cargo:warning=      |                                  ^

The offending lines in the test are

                  uint64_t __test_fsize_af_alg_iv_iv(void) {
                     struct af_alg_iv* foo = NULL;
                     return sizeof(foo->iv);
                 }

which I don't believe can ever work since dereferencing a NULL pointer is undefined behavior.

My /usr/include/linux/if_alg.h defines it as
struct af_alg_iv { __u32 ivlen; __u8 iv[]; };

Compiler explorer shows the same error when trying to implement an equivalent call. Is this a case of main.c not getting generated correctly?

system information:

$ cargo --version -v
cargo 1.68.0 (115f34552 2023-02-26)
release: 1.68.0
commit-hash: 115f34552518a2f9b96d740192addbac1271e7e6
commit-date: 2023-02-26
host: x86_64-unknown-linux-gnu
libgit2: 1.5.0 (sys:0.16.0 vendored)
libcurl: 7.86.0-DEV (sys:0.4.59+curl-7.86.0 vendored ssl:OpenSSL/1.1.1q)
os: Arch Linux [64-bit]

kernel: v6.2.7'
gcc: 12.2.1

@tones111 tones111 added the C-bug Category: bug label Mar 21, 2023
@JohnTitor
Copy link
Member

The cause is your kernel is too new, see torvalds/linux@94dfc73.
You could skip tests locally in this case.

@JohnTitor JohnTitor closed this as not planned Won't fix, can't repro, duplicate, stale Mar 21, 2023
bors added a commit that referenced this issue Jun 24, 2023
Define `IPPROTO_ETHERNET` on Linux-like platforms.

Define the `IPPROTO_ETHERNET` constant on Linux-like platforms.

This value is also now a registered protocol number IANA, called "Ethernet":

https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml

I haven't run all the CI tests locally because my kernel is new too and I hit #3160.
bors added a commit that referenced this issue Jun 24, 2023
Define additional socket ioctls

Define several socket-related `ioctl`s which aren't currently captured. Updated to include `ioctl`s from BSD systems.

`libc-test` suite has not been run due to #3160.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

No branches or pull requests

2 participants