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

Missing Source Files from Database for XNU #145

Open
qu0dy opened this issue Dec 4, 2022 · 7 comments
Open

Missing Source Files from Database for XNU #145

qu0dy opened this issue Dec 4, 2022 · 7 comments
Labels

Comments

@qu0dy
Copy link

qu0dy commented Dec 4, 2022

Hi,

Most of the .c files are missing after compilation of XNU in DB.

Log entry:

/opt/homebrew/Caskroom/codeql/2.11.4/codeql/cpp/tools/osx64/extractor --trapfolder /private/tmp/xnu/build-xnu-xnu-8792.41.9/xnu-xnu-8792.41.9/xnu-database/trap/cpp --src_archive /private/tmp/xnu/build-xnu-xnu-8792.41.9/xnu-xnu-8792.41.9/xnu-database/src --mimic_config /private/tmp/xnu/build-xnu-xnu-8792.41.9/xnu-xnu-8792.41.9/xnu-database/working/compiler_mimic_cache/0bf1e9bd38ad --executable_filename /private/tmp/xnu/build-xnu-xnu-8792.41.9/xnu-xnu-8792.41.9/BUILD/obj/SETUP/installfile/installfile.o -w --error_limit 1000 --disable_system_macros --variadic_macros --gcc --gnu_version 40000 --clang --isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk -I/tmp/xnu/build-xnu-xnu-8792.41.9/xnu-xnu-8792.41.9/SETUP/installfile/ -I. --blocks -D__GCC_HAVE_DWARF2_CFI_ASM=1 -- installfile.c /tmp/xnu/build-xnu-xnu-8792.41.9/xnu-xnu-8792.41.9/SETUP/installfile/installfile.c

[E 02:03:00 36601] Warning[extractor-c++]: In construct_message: Catastrophic error: cannot open source file "installfile.c"

Env:

@github-actions github-actions bot added the CLI label Dec 4, 2022
@hvitved
Copy link

hvitved commented Dec 5, 2022

Thanks for your report. @github/codeql-c is this something you can look into, please?

@jketema
Copy link
Contributor

jketema commented Dec 5, 2022

Hi @qu0dy,

Thanks for the report.

Just to confirm: does the build script you linked to allow you to successfully build XNU when invoked by itself? If so, could you provide us with the complete build-tracer.log? The parts of the log you included do not quite provide sufficient information.

I also see you're running a beta version of MacOS Ventura, does the same problem occur with the latest released version of Ventura?

@qu0dy
Copy link
Author

qu0dy commented Dec 5, 2022

Hi @jketema,

Just to confirm: does the build script you linked to allow you to successfully build XNU when invoked by itself?

Yes, it's.

If so, could you provide us with the complete build-tracer.log?

Here is the log, it's quite large (~70mb).

I also see you're running a beta version of MacOS Ventura, does the same problem occur with the latest released version of Ventura?

Unfortunately I can't test it on stable MacOS version right now.

@qu0dy
Copy link
Author

qu0dy commented Dec 5, 2022

@jketema the issue resolved when I used:
codeql database create xnu-database --language=cpp --command="./build.sh"

Instead of:
codeql database create xnu-database --language=cpp --command="make ARCH_CONFIGS="x86_64" KERNEL_CONFIGS=RELEASE BUILD_WERROR=0".

I thought that I have to use it only with the latest step of XNU building.

@jketema
Copy link
Contributor

jketema commented Dec 5, 2022

@jketema the issue resolved when I used: codeql database create xnu-database --language=cpp --command="./build.sh"

Just to confirm: Did you check - using a CodeQL query - that the database actually contains the missing source files?

Instead of: codeql database create xnu-database --language=cpp --command="make ARCH_CONFIGS="x86_64" KERNEL_CONFIGS=RELEASE BUILD_WERROR=0".

I thought that I have to use it only with the latest step of XNU building.

Indeed it should. From the logs I can see that the clang compiler is not properly identified in this case. What is the output of

/applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/clang --version

when you run it instead of

codeql database create xnu-database --language=cpp --command="make ARCH_CONFIGS="x86_64" KERNEL_CONFIGS=RELEASE BUILD_WERROR=0"

?

@qu0dy
Copy link
Author

qu0dy commented Dec 5, 2022

Just to confirm: Did you check - using a CodeQL query - that the database actually contains the missing source files?

Yes, it does.

Indeed it should. From the logs I can see that the clang compiler is not properly identified in this case. What is the output of when you run it instead of

Here is a log, which produces correct db.

@jketema
Copy link
Contributor

jketema commented Dec 6, 2022

Hi @qu0dy,

Thanks for the confirmation and the logs. Since you have a workaround, there doesn't seem to be an immediate urgency to get this resolved. So, we'll track this in an internal ticket and revisit this at some later date.

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

No branches or pull requests

3 participants