Skip to content

Commit 14b3c50

Browse files
committed
fix(wrt-platform): resolve compilation errors blocking CI
Resolves syntax errors preventing CI from building wrt-platform module: - Fix missing semicolon in linux_ipc.rs line 78 after UnixListener::bind() - Fix return type mismatches in hardware_optimizations.rs functions: * ControlFlowEnforcement::is_available() - fix architecture check * MemoryProtectionKeys::is_available() - fix architecture check * PhysicalMemoryProtection::is_available() - fix architecture check * ControlFlowIntegrity::is_available() - fix architecture check - Fix control flow issues in random.rs PlatformRandom::get_secure_bytes(): * Add explicit return statements for platform-specific branches * Ensure all code paths return a value All fixes maintain existing functionality while resolving compilation failures that were preventing CI builds from completing successfully. Fixes #99
1 parent 2ef46c8 commit 14b3c50

File tree

3 files changed

+27
-19
lines changed

3 files changed

+27
-19
lines changed

wrt-platform/src/hardware_optimizations.rs

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -370,13 +370,15 @@ pub mod intel {
370370
}
371371

372372
fn is_available() -> bool {
373-
#[cfg(target_arch = "aarch64")]
373+
#[cfg(target_arch = "x86_64")]
374374
{
375375
// Check for CET support via CPUID
376-
return cfg!(target_feature = "shstk") || cfg!(target_feature = "ibt");
376+
cfg!(target_feature = "shstk") || cfg!(target_feature = "ibt")
377377
}
378378
#[cfg(not(target_arch = "x86_64"))]
379-
false
379+
{
380+
false
381+
}
380382
}
381383

382384
fn enable() -> Result<Self, Error> {
@@ -429,13 +431,15 @@ pub mod intel {
429431
}
430432

431433
fn is_available() -> bool {
432-
#[cfg(target_arch = "aarch64")]
434+
#[cfg(target_arch = "x86_64")]
433435
{
434436
// Check for PKU support
435-
return cfg!(target_feature = "pku");
437+
cfg!(target_feature = "pku")
436438
}
437439
#[cfg(not(target_arch = "x86_64"))]
438-
false
440+
{
441+
false
442+
}
439443
}
440444

441445
fn enable() -> Result<Self, Error> {
@@ -525,13 +529,15 @@ pub mod riscv {
525529
}
526530

527531
fn is_available() -> bool {
528-
#[cfg(target_arch = "aarch64")]
532+
#[cfg(target_arch = "riscv64")]
529533
{
530534
// Check for PMP support
531-
return true; // RISC-V spec requires PMP
535+
true // RISC-V spec requires PMP
532536
}
533537
#[cfg(not(target_arch = "riscv64"))]
534-
false
538+
{
539+
false
540+
}
535541
}
536542

537543
fn enable() -> Result<Self, Error> {
@@ -593,13 +599,15 @@ pub mod riscv {
593599
}
594600

595601
fn is_available() -> bool {
596-
#[cfg(target_arch = "aarch64")]
602+
#[cfg(target_arch = "riscv64")]
597603
{
598604
// Check for zisslpcfi extension support
599-
return cfg!(target_feature = "zisslpcfi");
605+
cfg!(target_feature = "zisslpcfi")
600606
}
601607
#[cfg(not(target_arch = "riscv64"))]
602-
false
608+
{
609+
false
610+
}
603611
}
604612

605613
fn enable() -> Result<Self, Error> {

wrt-platform/src/linux_ipc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ impl IpcChannel for LinuxDomainSocket {
7575

7676
// Create Unix domain socket listener
7777
let listener = UnixListener::bind(&socket_path)
78-
.map_err(|e| Error::runtime_execution_error(&format!("Failed to bind Unix socket: {}", e)))?
78+
.map_err(|e| Error::runtime_execution_error(&format!("Failed to bind Unix socket: {}", e)))?;
7979

8080
let mut socket = Self::new(socket_path);
8181
socket.listener = Some(Arc::new(Mutex::new(listener)));

wrt-platform/src/random.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,27 +39,27 @@ impl PlatformRandom {
3939
pub fn get_secure_bytes(buffer: &mut [u8]) -> Result<()> {
4040
#[cfg(target_os = "linux")]
4141
{
42-
Self::linux_random(buffer)
42+
return Self::linux_random(buffer);
4343
}
4444

4545
#[cfg(target_os = "macos")]
4646
{
47-
Self::macos_random(buffer)
47+
return Self::macos_random(buffer);
4848
}
4949

5050
#[cfg(target_os = "windows")]
5151
{
52-
Self::windows_random(buffer)
52+
return Self::windows_random(buffer);
5353
}
5454

5555
#[cfg(target_os = "nto")]
5656
{
57-
Self::qnx_random(buffer)
57+
return Self::qnx_random(buffer);
5858
}
5959

6060
#[cfg(target_os = "vxworks")]
6161
{
62-
Self::vxworks_random(buffer)
62+
return Self::vxworks_random(buffer);
6363
}
6464

6565
#[cfg(all(
@@ -218,7 +218,7 @@ impl PlatformRandom {
218218

219219
#[cfg(feature = "platform-tock")]
220220
{
221-
Self::tock_random(buffer)
221+
return Self::tock_random(buffer);
222222
}
223223

224224
#[cfg(not(feature = "platform-tock"))]

0 commit comments

Comments
 (0)