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

Valgrind complains about ptls_fusion_is_supported_by_cpu #380

Open
huitema opened this issue Mar 16, 2022 · 0 comments
Open

Valgrind complains about ptls_fusion_is_supported_by_cpu #380

huitema opened this issue Mar 16, 2022 · 0 comments

Comments

@huitema
Copy link
Collaborator

huitema commented Mar 16, 2022

The code of the function is:

int ptls_fusion_is_supported_by_cpu(void)
{
    unsigned leaf1_ecx, leaf7_ebx;

    { /* GCC-specific code to obtain CPU features */
        unsigned leaf_cnt;
        __asm__("cpuid" : "=a"(leaf_cnt) : "a"(0) : "ebx", "ecx", "edx");
        if (leaf_cnt < 7)
            return 0;
        __asm__("cpuid" : "=c"(leaf1_ecx) : "a"(1) : "ebx", "edx");
        __asm__("cpuid" : "=b"(leaf7_ebx) : "a"(7), "c"(0) : "edx");
    }

    /* AVX2 */
    if ((leaf7_ebx & (1 << 5)) == 0)
        return 0;
    /* AES */
    if ((leaf1_ecx & (1 << 25)) == 0)
        return 0;
    /* PCLMUL */
    if ((leaf1_ecx & (1 << 1)) == 0)
        return 0;

    return 1;
}

Valgrind complains that the "Conditional jump or move depends on uninitialized value". This is very annoying, because the message will fill the valgrind logs when testing code that uses picotls.

I think this could be fixed by changing the declaration to unsigned leaf_cnt = 0;.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant