Skip to content

Commit

Permalink
Ignore verbs without alc-verbs HDEF property or alcverbs=1 boot-arg
Browse files Browse the repository at this point in the history
  • Loading branch information
vit9696 committed Nov 5, 2020
1 parent 188f7ed commit 5d49bac
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
23 changes: 22 additions & 1 deletion AppleALC/ALCUserClientProvider/ALCUserClientProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

#include "ALCUserClientProvider.hpp"
#include <Headers/kern_iokit.hpp>

OSDefineMetaClassAndStructors(ALCUserClientProvider, IOService);

Expand All @@ -27,7 +28,27 @@ bool ALCUserClientProvider::start(IOService* provider) {
DBGLOG("client", "timeout in waiting for IOHDACodecDevice, will retry");
return false;
}


auto hdaController = mHDACodecDevice->getParentEntry(gIOServicePlane);
if (!hdaController) {
DBGLOG("client", "codec is missing AppleHDAController");
return false;
}

auto hdefDevice = hdaController->getParentEntry(gIOServicePlane);
if (!hdefDevice) {
DBGLOG("client", "controller is missing HDEF device");
return false;
}

uint32_t enableHdaVerbs = 0;
WIOKit::getOSDataValue(hdefDevice, "alc-verbs", enableHdaVerbs);
PE_parse_boot_argn("alcverbs", &enableHdaVerbs, sizeof(enableHdaVerbs));
DBGLOG("client", "device %s to send custom verbs", enableHdaVerbs != 0 ? "allows" : "disallows");
if (enableHdaVerbs == 0) {
return false;
}

// We are ready for verbs
DBGLOG("client", "ALCUserClient is ready for hda-verbs");
setProperty("ReadyForALCVerbs", kOSBooleanTrue);
Expand Down
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ AppleALC Changelog
==================
#### v1.5.5
- Fixed kext loading issues on 10.8 and similar operating system
- Added a requirement to inject `alc-verbs` or use `alc-verbs=1` argument for custom verbs

#### v1.5.4
- Improved Ice Lake controller patches by fewtarius
Expand Down

1 comment on commit 5d49bac

@vit9696
Copy link
Collaborator Author

@vit9696 vit9696 commented on 5d49bac Nov 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Andrey1970AppleLife @black-dragon74 @khronokernel I had to guard that as in theory custom verbs can be used as an extra attack vector. Please make sure the guides and tools take it into account.

Please sign in to comment.