Files
RedBear-OS/local/patches/base/P4-acpi-estale-graceful.patch
T
vasilito f6c2eb2a8e feat: ACPI Wave 1 boot-critical hardening (P19) + robust patch generation
- P19-init-startup-hardening: Replace panic-grade expect/unwrap in init
  startup paths (getns, register_scheme_to_ns, setrens, filename parsing)
  with graceful error handling and logging
- P19-acpid-startup-hardening: Replace panic-grade calls in acpid with
  graceful degradation (rxsdt read failure → warn + exit 0, SDT parse →
  error + exit 1, I/O privilege → fatal, scheme registration → fatal,
  setrens → warn + continue, event loop errors → log + continue)
- P18-9-msi-allocation-resilience: Regenerate with git diff -U0 -w format
  for maximum context resilience
- fetch.rs: Change --fuzz=0 to --fuzz=3 for resilient patch application
- AGENTS.md: Document robust patch generation technique as mandatory
- Add P4/P5/P6/P7 patches (estale, dmi, i2c, ps2d hardening)
- Add P21 kernel x2apic SMP fix patch
- Multiple local recipe source improvements (redox-drm, driver-manager,
  driver-acpi, thermald)
- Config updates for redbear-mini and redbear-device-services
- Subsystem assessment document
2026-05-18 14:07:42 +03:00

127 lines
5.9 KiB
Diff

--- a/drivers/gpio/intel-gpiod/src/main.rs
+++ b/drivers/gpio/intel-gpiod/src/main.rs
@@ -130,6 +130,12 @@
log::debug!("intel-gpiod: ACPI symbols are not ready yet");
return Ok(Vec::new());
}
+ // ESTALE (116): filesystem handle stale during initfs-to-rootfs transition
+ // ENOENT (2): /scheme/acpi not mounted yet (e.g., acpid not started)
+ Err(err) if err.raw_os_error() == Some(116) || err.kind() == std::io::ErrorKind::NotFound => {
+ log::info!("intel-gpiod: ACPI symbols unavailable ({}), running with no GPIO controllers", err);
+ return Ok(Vec::new());
+ }
Err(err) => return Err(err).context("failed to read /scheme/acpi/symbols"),
};
--- a/drivers/i2c/dw-acpi-i2cd/src/main.rs
+++ b/drivers/i2c/dw-acpi-i2cd/src/main.rs
@@ -117,6 +117,12 @@
log::debug!("dw-acpi-i2cd: ACPI symbols are not ready yet");
return Ok(Vec::new());
}
+ // ESTALE (116): filesystem handle stale during initfs-to-rootfs transition
+ // ENOENT (2): /scheme/acpi not mounted yet (e.g., acpid not started)
+ Err(err) if err.raw_os_error() == Some(116) || err.kind() == std::io::ErrorKind::NotFound => {
+ log::info!("dw-acpi-i2cd: ACPI symbols unavailable ({}), running with no I2C controllers", err);
+ return Ok(Vec::new());
+ }
Err(err) => return Err(err).context("failed to read /scheme/acpi/symbols"),
};
--- a/drivers/i2c/intel-lpss-i2cd/src/main.rs
+++ b/drivers/i2c/intel-lpss-i2cd/src/main.rs
@@ -117,6 +117,12 @@
log::debug!("intel-lpss-i2cd: ACPI symbols are not ready yet");
return Ok(Vec::new());
}
+ // ESTALE (116): filesystem handle stale during initfs-to-rootfs transition
+ // ENOENT (2): /scheme/acpi not mounted yet (e.g., acpid not started)
+ Err(err) if err.raw_os_error() == Some(116) || err.kind() == std::io::ErrorKind::NotFound => {
+ log::info!("intel-lpss-i2cd: ACPI symbols unavailable ({}), running with no I2C controllers", err);
+ return Ok(Vec::new());
+ }
Err(err) => return Err(err).context("failed to read /scheme/acpi/symbols"),
};
--- a/drivers/gpio/i2c-gpio-expanderd/src/main.rs
+++ b/drivers/gpio/i2c-gpio-expanderd/src/main.rs
@@ -121,6 +121,12 @@
log::debug!("i2c-gpio-expanderd: ACPI symbols are not ready yet");
return Ok(Vec::new());
}
+ // ESTALE (116): filesystem handle stale during initfs-to-rootfs transition
+ // ENOENT (2): /scheme/acpi not mounted yet (e.g., acpid not started)
+ Err(err) if err.raw_os_error() == Some(116) || err.kind() == std::io::ErrorKind::NotFound => {
+ log::info!("i2c-gpio-expanderd: ACPI symbols unavailable ({}), running with no GPIO expanders", err);
+ return Ok(Vec::new());
+ }
Err(err) => return Err(err).context("failed to read /scheme/acpi/symbols"),
};
--- a/drivers/input/i2c-hidd/src/acpi.rs
+++ b/drivers/input/i2c-hidd/src/acpi.rs
@@ -32,6 +32,12 @@
Err(err) if err.kind() == ErrorKind::WouldBlock || err.raw_os_error() == Some(11) => {
return Ok(Vec::new());
}
+ // ESTALE (116): filesystem handle stale during initfs-to-rootfs transition
+ // ENOENT (2): /scheme/acpi not mounted yet (e.g., acpid not started)
+ Err(err) if err.raw_os_error() == Some(116) || err.kind() == ErrorKind::NotFound => {
+ log::info!("i2c-hidd: ACPI symbols unavailable ({}), running with no HID devices", err);
+ return Ok(Vec::new());
+ }
Err(err) => return Err(err).context("failed to read /scheme/acpi/symbols"),
};
--- a/drivers/input/intel-thc-hidd/src/main.rs
+++ b/drivers/input/intel-thc-hidd/src/main.rs
@@ -95,8 +95,20 @@
}
fn resolve_acpi_companion(addr: &pci_types::PciAddress) -> Result<Option<String>> {
- let entries =
- fs::read_dir("/scheme/acpi/symbols").context("failed to read /scheme/acpi/symbols")?;
+ let entries = match fs::read_dir("/scheme/acpi/symbols") {
+ Ok(entries) => entries,
+ Err(err) if err.kind() == std::io::ErrorKind::WouldBlock || err.raw_os_error() == Some(11) => {
+ log::debug!("intel-thc-hidd: ACPI symbols are not ready yet");
+ return Ok(None);
+ }
+ // ESTALE (116): filesystem handle stale during initfs-to-rootfs transition
+ // ENOENT (2): /scheme/acpi not mounted yet (e.g., acpid not started)
+ Err(err) if err.raw_os_error() == Some(116) || err.kind() == std::io::ErrorKind::NotFound => {
+ log::info!("intel-thc-hidd: ACPI symbols unavailable ({}), skipping companion resolution", err);
+ return Ok(None);
+ }
+ Err(err) => return Err(err).context("failed to read /scheme/acpi/symbols"),
+ };
let expected_adr = (u64::from(addr.device()) << 16) | u64::from(addr.function());
for entry in entries {
@@ -136,8 +148,18 @@
}
fn scan_bound_i2c_hid_devices(companion: Option<&str>) -> Result<Vec<String>> {
- let entries =
- fs::read_dir("/scheme/acpi/symbols").context("failed to read /scheme/acpi/symbols")?;
+ let entries = match fs::read_dir("/scheme/acpi/symbols") {
+ Ok(entries) => entries,
+ Err(err) if err.kind() == std::io::ErrorKind::WouldBlock || err.raw_os_error() == Some(11) => {
+ log::debug!("intel-thc-hidd: ACPI symbols are not ready yet");
+ return Ok(Vec::new());
+ }
+ Err(err) if err.raw_os_error() == Some(116) || err.kind() == std::io::ErrorKind::NotFound => {
+ log::info!("intel-thc-hidd: ACPI symbols unavailable ({}), running with no HID devices", err);
+ return Ok(Vec::new());
+ }
+ Err(err) => return Err(err).context("failed to read /scheme/acpi/symbols"),
+ };
let mut devices = BTreeSet::new();
for entry in entries {