Skip to content

Building libqasan for musl #2832

Closed
Closed

Description

@celi0n

I am fuzzing a binary linked to musl with Qasan. Therefore I need to build libqasan with gcc-musl, which results in the error:

invalid application of 'sizeof' to incomplete type 'FILE' at this line:

QASAN_LOAD(stream, sizeof(FILE));

Apparently in musl, FILE is opaque per the C standard, only glibc exposes its full definition.
The best patch I found for this issue would be to do:

#ifdef __GLIBC__
#define QASAN_FILE_CHECK_SIZE sizeof(FILE)
#else
#define QASAN_FILE_CHECK_SIZE sizeof(void *)
#endif

Not sure if the wrong size cause issue. AI says if it is lower, it wont cause false positive, but I don't know we can trust it.
What do you think ?

Activity

  1. vanhauser-thc commented on Jun 26, 2026

    @vanhauser-thc
    Member

    The patch would work. But instead if would rather like something

    #ifdef __MUSL__
    #define QASAN_FILE_CHECK_SIZE sizeof(void *)
    #else
    #define QASAN_FILE_CHECK_SIZE sizeof(FILE)
    #endif
    

    whatever the define for muslibc is ...
    please send a PR

  2. celi0n commented on Jun 26, 2026

    @celi0n
    Author
  3. vanhauser-thc commented on Jul 28, 2026

    @vanhauser-thc
    Member

    The proposed fix was wrong and impacted all other non-glibc

  4. added
    help wanted
    good first issue
    on Jul 28, 2026
  5. leinn32 commented on Aug 14, 2026

    @leinn32

    Checking at it!

  6. added a commit that references this issue on Aug 14, 2026
    fdd8f1b
  7. chaitanya-bhardwaj commented on Sep 10, 2026

    @chaitanya-bhardwaj

    Hi, seeing no activity here recently,

    I'd like to work on this issue. Is it still open to take?

    @vanhauser-thc

  8. vanhauser-thc commented on Sep 21, 2026

    @vanhauser-thc
    Member

    @Chaitanya-970 I do not think this is easily solvable.

  9. vanhauser-thc commented on Oct 25, 2026

    @vanhauser-thc
    Member

    fix is in dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issuehelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions