Skip to content

Commit

Permalink
Sync PatcherSupportPkg
Browse files Browse the repository at this point in the history
  • Loading branch information
khronokernel committed Mar 10, 2024
1 parent b42eb6e commit cdb40d8
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 13 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# OpenCore Legacy Patcher changelog

## 1.4.2
- Resolve Auto-Join support for Modern Wireless on macOS 14.4
- Applicable for BCM94360, 4360, 4350, 4331 and 43224 chipsets
- Resolve WiFi support for Legacy Wireless on macOS 12.7.4 and 13.6.5
- Applicable for BCM94328, BCM94322 and Atheros chipsets
- Resolve USB 1.1 on macOS Ventura regression from OCLP 1.4.0
- Increment Binaries:
- PatcherSupportPkg 1.4.8 - release

## 1.4.1
- Update updater implementation
Expand Down
47 changes: 37 additions & 10 deletions data/sys_patch_dict.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Dictionary defining patch sets used during Root Volume patching (sys_patch.py)
# Copyright (C) 2022-2023, Mykola Grymalyuk

import packaging.version

from data import os_data


Expand All @@ -9,7 +11,7 @@ class SystemPatchDictionary():
Library for generating patch sets for sys_patch.py and supporting modules
Usage:
>>> patchsets = SystemPatchDictionary(22, 0, [20, 21, 22]).patchset_dict
>>> patchsets = SystemPatchDictionary(22, 0, [20, 21, 22], "13.0").patchset_dict
Patchset Schema:
Expand Down Expand Up @@ -49,12 +51,13 @@ class SystemPatchDictionary():
Note: Stubbed binaries are OS specific, thus use the 'self.os_major' variable to denounce which folder variant to use
"""

def __init__(self, os_major: int, os_minor: int, non_metal_os_support: list) -> None:
def __init__(self, os_major: int, os_minor: int, non_metal_os_support: list, marketing_version: str) -> None:
"""
Parameters:
os_major (int): Major XNU Kernel version
os_minor (int): Minor XNU Kernel version
non_metal_os_support (list): List of supported non-metal OSes (XNU Major Versions)
marketing_version (str): Marketing version of the OS
'non_metal_os_support' is assumed to be sorted from oldest to newest
"""
Expand All @@ -64,6 +67,9 @@ def __init__(self, os_major: int, os_minor: int, non_metal_os_support: list) ->
self.os_float: float = float(f"{self.os_major}.{self.os_minor}")
self.non_metal_os_support: list = non_metal_os_support
self.patchset_dict: dict = {}
self.marketing_version: str = marketing_version

self.affected_by_cve_2024_23227: bool = self.__is_affect_by_cve_2024_23227()

# XNU Kernel versions
self.macOS_12_0_B7: float = 21.1
Expand Down Expand Up @@ -120,6 +126,27 @@ def __resolve_monterey_framebuffers(self) -> str:
return "12.5-23.4"


def __is_affect_by_cve_2024_23227(self) -> bool:
"""
CVE-2024-23227 broke our airportd patches for 12.7.4, 13.6.5 and 14.4
Note that since the XNU version's security patch level is not increment
"""

if self.os_major > os_data.os_data.sonoma:
return True

parsed_version = packaging.version.parse(self.marketing_version)
if self.marketing_version.startswith("12"):
return parsed_version >= packaging.version.parse("12.7.4")
if self.marketing_version.startswith("13"):
return parsed_version >= packaging.version.parse("13.6.5")
if self.marketing_version.startswith("14"):
return parsed_version >= packaging.version.parse("14.4")

return False


def _generate_sys_patch_dict(self):
"""
Generates the sys_patch_dict dictionary
Expand Down Expand Up @@ -1151,7 +1178,7 @@ def _generate_sys_patch_dict(self):
},
"Install": {
"/usr/libexec": {
"airportd": "11.7.10" if self.os_float < self.macOS_14_4 else "11.7.10-23.4",
"airportd": "11.7.10" if self.affected_by_cve_2024_23227 is False else "11.7.10-Sandbox",
},
"/System/Library/CoreServices": {
"WiFiAgent.app": "11.7.10",
Expand Down Expand Up @@ -1207,16 +1234,16 @@ def _generate_sys_patch_dict(self):
},
"Install": {
"/usr/libexec": {
"airportd": "13.6.2" if self.os_float < self.macOS_14_4 else "13.6.2-23.4",
"wifip2pd": "13.6.2",
"airportd": "13.6.5",
"wifip2pd": "13.6.5",
},
"/System/Library/Frameworks": {
"CoreWLAN.framework": "13.6.2",
"CoreWLAN.framework": "13.6.5",
},
"/System/Library/PrivateFrameworks": {
"CoreWiFi.framework": "13.6.2",
"IO80211.framework": "13.6.2",
"WiFiPeerToPeer.framework": "13.6.2",
"CoreWiFi.framework": "13.6.5",
"IO80211.framework": "13.6.5",
"WiFiPeerToPeer.framework": "13.6.5",
},
},
},
Expand Down Expand Up @@ -1308,7 +1335,7 @@ def _generate_sys_patch_dict(self):
},
"Install": {
"/System/Library/Extensions": {
"IOUSBHostFamily.kext": "12.6.2",
"IOUSBHostFamily.kext": "12.6.2" if self.os_major < self.macOS_14_4 else "12.6.2-23.4",
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion resources/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Constants:
def __init__(self) -> None:
# Patcher Versioning
self.patcher_version: str = "1.4.2" # OpenCore-Legacy-Patcher
self.patcher_support_pkg_version: str = "1.4.7" # PatcherSupportPkg
self.patcher_support_pkg_version: str = "1.4.8" # PatcherSupportPkg
self.copyright_date: str = "Copyright © 2020-2024 Dortania"
self.patcher_name: str = "OpenCore Legacy Patcher"

Expand Down
2 changes: 1 addition & 1 deletion resources/sys_patch/sys_patch_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def _generate_patchset(self) -> dict:
dict: Dictionary of patches to be applied from sys_patch_dict.py
"""

all_hardware_patchset: dict = sys_patch_dict.SystemPatchDictionary(self.constants.detected_os, self.constants.detected_os_minor, self.constants.legacy_accel_support).patchset_dict
all_hardware_patchset: dict = sys_patch_dict.SystemPatchDictionary(self.constants.detected_os, self.constants.detected_os_minor, self.constants.legacy_accel_support, self.constants.detected_os_version).patchset_dict
required_patches: dict = {}

utilities.cls()
Expand Down
2 changes: 1 addition & 1 deletion resources/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def _validate_root_patch_files(self, major_kernel: int, minor_kernel: int) -> No
minor_kernel (int): Minor kernel version
"""

patchset = sys_patch_dict.SystemPatchDictionary(major_kernel, minor_kernel, self.constants.legacy_accel_support).patchset_dict
patchset = sys_patch_dict.SystemPatchDictionary(major_kernel, minor_kernel, self.constants.legacy_accel_support, self.constants.detected_os_version).patchset_dict
host_os_float = float(f"{major_kernel}.{minor_kernel}")

for patch_subject in patchset:
Expand Down

0 comments on commit cdb40d8

Please sign in to comment.