2

I need to save some configuration from a DriverKit driver. I was reading How to save kext configuration between sessions and in this case it seems that the preferred way is to save the config from a user land app. Since DriverKit drivers are in user land is there an easier way to do this or is the preferred solution the same as for kexts?

Preferably the configuration should be saved in some place that is persistent, even if the app that installs the Dext is removed from the system, this to be able to carry over configuration when the app is uninstalled and then reinstalled.

tuple_cat
  • 1,165
  • 2
  • 7
  • 22
  • 1
    I'm not aware of any changes to this moving from kexts to dexts, but I've not seen any communication from Apple specifically about this exact issue. Given that dexts aren't "full" user space processes and don't have standard file I/O functions in the SDK headers, saving/loading configuration from user clients seems the way forward. (I believe dexts can be loaded before the system has mounted the root file system, just like kexts.) – pmdj Aug 20 '20 at 09:25
  • ok. I am thinking about dropping the requirement of being able to store configuration even if the dext owning app is uninstalled, and then it seems that one can use the providers plist file to store config. In this case the configuration is per device, and each device has a unique id. I was then thinking of adding one dictionary per unique device in the providers plist. – tuple_cat Aug 20 '20 at 11:31
  • I’m not sure what you mean by “providers plist”, can you elaborate? – pmdj Aug 20 '20 at 11:32
  • I mean the dictionary with the `idVendor` and `idProduct` which the device matched on in the dictionary with key `IOKitPersonalities` in the dexts plist file. – tuple_cat Aug 20 '20 at 11:43
  • Sure, you can put what you like in the IOKit personality dictionaries, but that's not saving *from* the driver, because those properties are completely static as they're covered by the dext bundle signature. If that's fine for your purposes then great, that's a good place for per-device-type configuration, but that's not what your original question appears to be about. – pmdj Aug 21 '20 at 09:43
  • Do you mean static as it will be the same for all instantiated drivers? If so I plan to solve it by adding an identifier to each config entry that is written that is unique for each physical device (something like serial number of that device) – tuple_cat Aug 21 '20 at 12:09
  • Static as in defined at build time. I don't see how you're going to update the plist at runtime/deployment time - its content is baked into the code signature. – pmdj Aug 21 '20 at 13:02
  • Yes, you are right. I will have to come up with some other solution. – tuple_cat Aug 26 '20 at 08:18

0 Answers0