Initialize vendor/uarch out-parameters for unhandled implementers#395
Conversation
…arch The default case of the implementer switch only logs a warning and returns without writing *vendor or *uarch. Callers such as get_core_info_from_midr() in src/arm/windows/init.c pass uninitialized stack variables, so for any unhandled implementer the reported vendor and uarch are whatever happened to be on the stack. Initialize both out-parameters to cpuinfo_vendor_unknown / cpuinfo_uarch_unknown at function entry so the decode result is deterministic for every implementer, present or future.
|
Hi @maxim-davgalev! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
|
Does #385 cover this? |
Yes, #385 covers part of this. #395 addresses two defects in cpuinfo_arm_decode_vendor_uarch:
So, as #385 fixes logic for Apple's implementer 'a' (0x61), I can drop the Apple-case patch and update the PR and issue #394. |
|
I've updated the PR and issue #394. |
Initialize the vendor/uarch out-parameters at function entry in
cpuinfo_arm_decode_vendor_uarch (src/arm/uarch.c), so an unhandled
implementer yields unknown values rather than uninitialized stack values.
Fixes #394