github / codeql

CodeQL: the libraries and queries that power security researchers around the world, as well as code scanning in GitHub Advanced Security
https://codeql.github.com
MIT License
7.36k stars 1.47k forks source link

Catastrophic error ("internal error: assertion failed at: "decls.c", line 21165 in mark_decl_after_first_in_comma_list") when compiling a CodeQL database from Chromium #16783

Closed flowerhack closed 39 minutes ago

flowerhack commented 1 month ago

Hi hello,

I'm a committer for the Chromium project & we've been experimenting with building CodeQL databases of Chromium.

This bug is similar to the one I previously reported (in that it's a "catastrophic error" that occurs when building a CodeQL database of Chromium), but it seems to have a different root cause, and thus, I'm filing this bug + the reproducer for it separately.

Additionally, I think this bug might be a duplicate of this bug which was reported by someone else, which was left open with a request for a reproducing test case, which I happily provide here.

The Bug

Warning[extractor-c++]: In construct_text_message: "../../base/functional/function_ref.h", line 69: internal error: assertion failed at: "decls.c", line 21165 in mark_decl_after_first_in_comma_list

        std::convertible_to<internal::ExtractReturnType<RunType>, R> &&
                                                                  ^

Reproducing The Bug

I have created a standalone file which can be used to reproduce this bug, which is attached here as importer_list_ii.cc.txt (please remove the .txt extension; this was to make the Github attachment uploader happy).

Reproduction steps (assumes that importer_list_ii.cc is in /YOUR/ROOT/HERE; assumes Clang 19; assumes Linux):

(1) codeql database init --language=cpp --source-root=/YOUR/ROOT/HERE/SOME-EMPTY-SOURCE-DIR /YOUR/ROOT/HERE/repro-failure --overwrite

(2) codeql database trace-command /YOUR/ROOT/HERE/repro-failure --working-dir=/YOUR/ROOT/HERE -- clang -Wno-constant-conversion -Wno-shorten-64-to-32 -Wenum-compare-conditional '-Wno-c++11-narrowing-const-reference' -Wno-undefined-bool-conversion -Wno-tautological-undefined-compare '-std=c++20' -Wno-trigraphs -gsimple-template-names -fno-exceptions -fno-rtti '-nostdinc++' --sysroot=../../build/linux/debian_bullseye_amd64-sysroot -fvisibility-inlines-hidden -c ~/importer_list_ii.cc -o ~/importer_list.o

(3) codeql database finalize -j=-1 /YOUR/ROOT/HERE/repro-failure

At the conclusion of these steps there should be logs in build-tracer.log and logs/extractor indicating the failure.

In addition to (1) importer_list_ii.cc (the reproducer file), please find attached (2) the build-tracer.log and (3) the relevant extractor logfile (8f379.log) from running this on my own machine, which will hopefully be useful for debugging/triage.

I do have the logs for the entire Chromium build available upon request, but as you might imagine, those files are very large and may not be as useful to you as this standalone reproducer.

A fix for this bug (or, guidance on how we might be holding it wrong!) would be extremely helpful for us here in Chromium. Please let me know if you need any more information. Thank you!

importer_list_ii.cc.txt build-tracer.log 8f379.log

jketema commented 1 month ago

Hi @flowerhack ,

As with the other issue, thanks for the report and the reproducer. I've filed an internal issue for this, and hopefully we can get to this fairly soon.

jketema commented 1 month ago

Reported to our frontend provider.

Manouchehri commented 4 days ago

@jketema For this ticket and the other recent Chrome errors with CodeQL, we've gone ahead and uploaded a full log for you folks:

https://6873d51718aa43a6389a532434554150.eu.r2.cloudflarestorage.com/public-logs/127-0-6533-41-build-tracer.log?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=44e997288dd46c00a6a8f590b2b7e419%2F20240717%2Fauto%2Fs3%2Faws4_request&X-Amz-Date=20240717T171126Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=93c708cd5e92f773391c3a25fb8ad4808e31b97b5cf71577c6bc4aeca0c11596

Right now, CodeQL is unusable for Chromium due to these catastrophic errors. =(

jketema commented 39 minutes ago

We've received a patch. This will be fixed in CodeQL 2.18.2.