In the Linux kernel, the following vulnerability has been resolved:
drm/sti: Fix return type of sti_{dvo,hda,hdmi}connectormode_valid()
With clang's kernel control flow integrity (kCFI, CONFIGCFICLANG), indirect call targets are validated against the expected function pointer prototype to make sure the call target is valid to help mitigate ROP attacks. If they are not identical, there is a failure at run time, which manifests as either a kernel panic or thread getting killed. A proposed warning in clang aims to catch these at compile time, which reveals:
drivers/gpu/drm/sti/stihda.c:637:16: error: incompatible function pointer types initializing 'enum drmmodestatus (*)(struct drmconnector *, struct drmdisplaymode *)' with an expression of type 'int (struct drmconnector *, struct drmdisplaymode *)' [-Werror,-Wincompatible-function-pointer-types-strict] .modevalid = stihdaconnectormodevalid, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/sti/stidvo.c:376:16: error: incompatible function pointer types initializing 'enum drmmodestatus (*)(struct drmconnector *, struct drmdisplaymode *)' with an expression of type 'int (struct drmconnector *, struct drmdisplaymode *)' [-Werror,-Wincompatible-function-pointer-types-strict] .modevalid = stidvoconnectormodevalid, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/gpu/drm/sti/stihdmi.c:1035:16: error: incompatible function pointer types initializing 'enum drmmodestatus (*)(struct drmconnector *, struct drmdisplaymode *)' with an expression of type 'int (struct drmconnector *, struct drmdisplaymode *)' [-Werror,-Wincompatible-function-pointer-types-strict] .modevalid = stihdmiconnectormodevalid, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
->modevalid() in 'struct drmconnectorhelperfuncs' expects a return type of 'enum drmmodestatus', not 'int'. Adjust the return type of sti_{dvo,hda,hdmi}connectormode_valid() to match the prototype's to resolve the warning and CFI failure.
{
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2022/50xxx/CVE-2022-50261.json",
"cna_assigner": "Linux"
}