-
Notifications
You must be signed in to change notification settings - Fork 0
Algorithmic Compiler Fixes and Comprehensive Diagnostics Report #283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,7 @@ | |
| use super::HashMap; | ||
| use super::hashmap::HashMapIter; | ||
|
|
||
| #[derive(Clone)] | ||
| pub struct HashSet<T> | ||
| where | ||
| T: Eq + core::hash::Hash + Clone, | ||
|
Comment on lines
+7
to
10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== locate hashset =="
fd -a 'hashset\.rs$' . || true
echo "== file excerpt =="
if [ -f src/klib/hashset.rs ]; then
wc -l src/klib/hashset.rs
sed -n '1,220p' src/klib/hashset.rs
else
echo "src/klib/hashset.rs not found"
fi
echo "== search for HashSet usages/definitions =="
rg -n "struct HashSet|impl .*HashSet|HashSet<|insert\\(|contains\\(|remove\\(" src -S || trueRepository: AaryanSinghChauhan09/SigmaOS Length of output: 50385 Remove the type-wide
Keep 🤖 Prompt for AI Agents |
||
|
|
@@ -80,6 +81,32 @@ where | |
| } | ||
| } | ||
|
|
||
| impl<T> core::fmt::Debug for HashSet<T> | ||
| where | ||
| T: Eq + core::hash::Hash + Clone + core::fmt::Debug, | ||
| { | ||
| fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { | ||
| let mut set = f.debug_set(); | ||
| for item in self.iter() { | ||
| set.entry(item); | ||
| } | ||
| set.finish() | ||
| } | ||
| } | ||
|
|
||
| impl<T> core::iter::FromIterator<T> for HashSet<T> | ||
| where | ||
| T: Eq + core::hash::Hash + Clone, | ||
| { | ||
| fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self { | ||
| let mut set = HashSet::new(); | ||
| for item in iter { | ||
| set.insert(item); | ||
| } | ||
| set | ||
| } | ||
| } | ||
|
|
||
| #[cfg(test)] | ||
| mod tests { | ||
| use super::*; | ||
|
|
@@ -112,4 +139,4 @@ mod tests { | |
| let items: Vec<i32> = set.iter().cloned().collect(); | ||
| assert_eq!(items.len(), 2); | ||
| } | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,8 +3,10 @@ pub mod vec; | |
| pub mod buddy_allocator; | ||
| pub mod paging; | ||
| pub mod uvm; | ||
| pub mod hash; | ||
| pub mod hashmap; | ||
| pub mod hashset; | ||
|
|
||
| pub use vec::Vec; | ||
|
|
||
| #[cfg(not(target_os = "none"))] | ||
| pub use std::collections::HashMap; | ||
| pub use hashmap::HashMap; | ||
| pub use hashset::HashSet; | ||
|
Comment on lines
+6
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== candidate files =="
git ls-files | rg '(^src/klib/|^src/.*\.rs$|WHAT_IS_WORKING_AND_NOT_WORKING\.md)$' | sed -n '1,120p'
echo "== klib outline/files =="
if [ -d src/klib ]; then
find src/klib -maxdepth 2 -type f -print | sort
for f in src/klib/mod.rs src/klib/hash.rs src/klib/hashmap.rs src/klib/hashset.rs src/klib/vec.rs; do
if [ -f "$f" ]; then
echo "--- $f ($(wc -l < "$f") lines) ---"
ast-grep outline "$f" --view compact || true
fi
done
fi
echo "== relevant README section =="
sed -n '120,160p' WHAT_IS_WAITING_AND_NOT_WORKING.md 2>/dev/null || true
sed -n '130,155p' WHAT_IS_WORKING_AND_NOT_WORKING.md 2>/dev/null || trueRepository: AaryanSinghChauhan09/SigmaOS Length of output: 6170 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== klib relevant source snippets =="
for f in src/klib/mod.rs src/klib/hashmap.rs src/klib/hashset.rs src/klib/vec.rs src/klib/hash.rs; do
if [ -f "$f" ]; then
echo "--- $f : first 260 lines ---"
sed -n '1,260p' "$f" | cat -n
fi
done
echo "== usages of klib collections in docs/tests/src (import/call patterns) =="
rg -n "crate::klib::(Vec|HashMap|HashSet)|use crate::klib::|klib::HashMap|klib::HashSet|klib::Vec|HashMap::|HashSet::|Vec::" -S -g '*.rs' -g '*.md' . | sed -n '1,240p'Repository: AaryanSinghChauhan09/SigmaOS Length of output: 44989 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== full klib HashMap entry/remove/other methods =="
sed -n '260,447p' src/klib/hashmap.rs | cat -n
echo "== full klib HashSet remaining implementations =="
sed -n '100,260p' src/klib/hashset.rs | cat -n
echo "== Hash trait implementation status for custom collections =="
rg -n "impl.*Hash for HashMap|impl.*Hash for HashSet|impl.*Hash for Vec|impl Entry|trait Entry|or_insert|remove\\(" src/klib src -g '*.rs' | sed -n '1,220p'Repository: AaryanSinghChauhan09/SigmaOS Length of output: 24083 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== exact HashMapEntry/occupied entries =="
rg -n "enum Entry|struct OccupiedEntry|struct VacantEntry|impl<'a, K, V> OccupiedEntry|impl<'a, K, V> VacantEntry|pub struct HashMapEntry|pub enum HashMapEntry|fn entry\\(&mut self, key: K\\) ->" src/klib/hashmap.rs
sed -n '1,120p' src/klib/hashmap.rs | cat -n
echo "== exact custom collection trait/status and remove values in source =="
python3 - <<'PY'
from pathlib import Path
p = Path("src/klib/hashmap.rs")
s = p.read_text()
checks = {
"HashMap entry returns Entry": "pub fn entry(&mut self, key: K) -> Entry<'_, K, V>" in s,
"HashMap OccupiedEntry has entry value as mutable reference": '_marker: core::marker::PhantomData<K>' in s and "value: &'a mut V" in s,
"HashMap Entry or_insert_with returns mutable reference": "pub fn or_insert_with<F>(self, default: F) -> &'a mut V" in s,
"HashMap remove returns value": "pub fn remove<Q: ?Sized>(&mut self, key: &Q) -> Option<V>" in s,
"HashMapEntry trait not present": "Entry<'_, K, V> {" not in s,
"OccupiedEntry replace/remove methods absent": all(m not in s for m in [
"pub fn take(self) -> V",
"pub fn remove(self) -> V",
"pub fn replace(self, value: V) -> V",
"pub fn replace_entry(self, value: V) -> V",
]),
"Remove leaves Drop values": "let (_, value) = bucket.remove(i)" in s and "let value = bucket.remove(i)" not in s and "Value" not in s,
}
for name, ok in checks.items():
print(f"{name}: {ok}")
PY
echo "== src/sigpkg/resolver imports and std HashMap/HashSet usage =="
sed -n '1,70p' src/sigpkg/resolver.rs | cat -n
rg -n "std::collections::HashMap|HashMap::new|HashSet::new|insert\\(|remove\\(" src/sigpkg/resolver.rs | sed -n '1,80p'Repository: AaryanSinghChauhan09/SigmaOS Length of output: 7525 Establish collection contract parity before the migration.
📍 Affects 2 files
🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,6 +37,14 @@ impl<T> Vec<T> { | |
| } | ||
| } | ||
| } | ||
| pub fn pop(&mut self) -> Option<T> { | ||
| if self.len == 0 { | ||
| None | ||
| } else { | ||
| self.len -= 1; | ||
| unsafe { Some(core::ptr::read(self.data.add(self.len))) } | ||
| } | ||
| } | ||
|
Comment on lines
+40
to
+47
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🔴 Critical | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "== files =="
git ls-files | rg '(^|/)src/klib/vec\.rs$|Cargo\.toml$' || true
echo "== vec.rs outline =="
ast-grep outline src/klib/vec.rs --view compact || true
echo "== relevant vec.rs lines =="
cat -n src/klib/vec.rs | sed -n '1,150p'
echo "== rust availability/version =="
rustc --version || trueRepository: AaryanSinghChauhan09/SigmaOS Length of output: 6217 🌐 Web query:
💡 Result: In Rust, calling core::ptr::read on a zero-sized type (ZST) is permitted even with a null pointer, provided certain conditions are met [1][2]. While historical versions of the documentation stated that even for ZSTs the pointer must be non-null and properly aligned [3], recent changes have clarified and refined these requirements [4][2]. According to the current official documentation for core::ptr::read, a null pointer is permitted if the total size of the access is zero (i.e., the type is a ZST) [5][1]. However, there is a strict requirement regarding alignment: even when the type is a ZST, the pointer must be properly aligned [5]. The documentation explicitly states: "Note that even if T has size 0, the pointer must be properly aligned." [5] To summarize the requirements for core::ptr::read with a ZST: 1. The pointer is not required to be non-null [5][1]. 2. The pointer must be properly aligned for the type T [5]. It is important to distinguish "valid for reads" from "valid for zero-sized access." The general definition of "valid for reads/writes" in Rust explicitly excludes null pointers [1][6]. Core functions like core::ptr::read have specific exceptions documented for zero-sized accesses that allow null pointers, but these exceptions do not change the fact that null pointers are fundamentally invalid for general pointer dereferencing or conversion into references [1][2]. Citations:
🌐 Web query:
💡 Result: In Rust, the behavior of std::alloc::alloc regarding zero-sized types (ZSTs) is strictly defined by the underlying requirements of the GlobalAlloc trait [1][2]. 1. Undefined Behavior: Passing a layout with a size of zero to std::alloc::alloc results in undefined behavior (UB) [1][3]. The documentation for GlobalAlloc explicitly states that the provided layout must have a non-zero size [1]. 2. No Allocation: Because zero-sized types do not require memory, calling an allocator is unnecessary and explicitly disallowed at this API level [4][5]. Collections or structures handling ZSTs are expected to avoid allocation entirely, typically by using a dangling, non-null, and well-aligned pointer (such as those provided by std::ptr::dangling) as a sentinel value [4][6][5]. 3. Alignment Requirement: While the allocator API requires non-zero size for the allocation request, the alignment of the layout is still enforced [1][7]. Even when representing a ZST (e.g., when a collection holds ZSTs), a valid Layout must have a non-zero alignment that is a power of two [7]. When using a dangling pointer for a ZST, the pointer must still satisfy the alignment requirements of the type it represents [6]. 4. Distinction from Allocator Trait: This constraint is specific to GlobalAlloc [1]. The unstable Allocator trait is more flexible and does permit zero-sized allocations; however, it is the responsibility of the allocator implementation to handle these cases (e.g., by returning a dangling pointer) [8][9]. To maintain compatibility and avoid unnecessary costs, even code using the Allocator trait is generally advised to avoid calling the allocator for ZSTs [10][8]. In summary, you must never call std::alloc::alloc with a zero-sized layout [1]. Instead, for ZSTs, use a sentinel value like std::ptr::dangling which is non-null and aligned according to the type's requirements [4][6]. Citations:
🌐 Web query:
💡 Result: In Rust, passing a null pointer to core::slice::from_raw_parts is undefined behavior (UB), regardless of the length of the slice or the size of the type T [1][2][3]. Even for zero-length slices or slices of zero-sized types (ZSTs), the provided pointer must be both non-null and properly aligned [1][3]. The requirement for non-null, aligned pointers exists because Rust references (including slices) are guaranteed to be non-null and aligned [1][3]. This invariant allows the compiler to perform optimizations—such as using a null pointer as a niche for Option<&[T]>—that would break if arbitrary pointers were allowed [1][3][4]. Violating this requirement is considered instant undefined behavior, not merely on-access undefined behavior [4]. For scenarios involving zero-length slices (such as when working with FFI code that may provide null pointers for empty collections), you must explicitly check for null before calling from_raw_parts [1][2][3]. If the pointer is null, you should use an empty slice literal (e.g., &[]) instead of calling the function [1][3]. If you need to construct a pointer that is safe to pass to from_raw_parts for a zero-length slice, you can use std::ptr::NonNull::dangling to obtain an aligned, non-null pointer [1][3][4]. Citations:
Use an aligned dangling pointer for zero-sized For 🤖 Prompt for AI Agents |
||
| pub fn len(&self) -> usize { self.len } | ||
| pub fn is_empty(&self) -> bool { self.len == 0 } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,8 @@ pub mod sigma_unveil; | |
| pub mod vault; | ||
| pub mod vpn; | ||
| pub mod vulnerability; | ||
| pub mod kali_stack; | ||
| pub mod nemoclaw; | ||
|
Comment on lines
+28
to
+29
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift Fix the collection deallocator before making these modules public.
Repeated calls to 🤖 Prompt for AI Agents |
||
|
|
||
| pub use self::sigma_pledge::{PledgeNamespace, PledgePromise as SigmaPledgePromise, SyscallFilter}; | ||
| pub use self::sigma_unveil::{UnveilEntry, UnveilManager, UnveilPermissions, UnveilState}; | ||
|
|
@@ -101,3 +103,11 @@ pub use parrot_parity::{ | |
| AnonSurfShunt, AppSandboxEngine, ForensicStorageFilter, RoutingMode, SandboxPolicy, | ||
| GLOBAL_ANONSURF, GLOBAL_FORENSIC, GLOBAL_SANDBOX, | ||
| }; | ||
| pub use kali_stack::{ | ||
| CronDaemon, CronJob, DmesgLog, FirewallRule, IptablesFirewall, KaliError, | ||
| PluggableAuthenticationModule, SudoPrivilegeEscalation, SwapSpaceManager, TmuxMultiplexer, | ||
| TmuxPane, | ||
| }; | ||
|
Comment on lines
+106
to
+110
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win Reject invalid protocol lengths before evaluating a firewall rule.
Normalize the protocol to one fixed representation and compare exact values before indexing. 🤖 Prompt for AI Agents🩺 Stability & Availability | 🔴 Critical | 🏗️ Heavy lift Remove unsynchronized mutation through The newly public Change the method to take 🤖 Prompt for AI Agents |
||
| pub use nemoclaw::{ | ||
| DefaultDenyNetworkPolicy, NemoClawError, OpenShellAgentSandbox, PrivacyRouter, | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -402,7 +402,8 @@ impl EncryptedFileVault { | |
| let mut files_processed = 0; | ||
| let mut bytes_processed = 0u64; | ||
|
|
||
| for (original_path, encrypted_file) in self.files.clone() { | ||
| let cloned_files: Vec<(PathBuf, EncryptedFile)> = self.files.iter().map(|(k, v)| (k.clone(), v.clone())).collect(); | ||
| for (original_path, encrypted_file) in cloned_files { | ||
|
Comment on lines
+405
to
+406
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift Make master-key rotation transactional. This snapshot loop writes each file with Stage ciphertext and metadata in temporary files. Commit all changes and 🤖 Prompt for AI Agents |
||
| // Decrypt with old key | ||
| let encrypted_data = std::fs::read(&encrypted_file.encrypted_path) | ||
| .map_err(|e| VaultError::IoError(e.to_string()))?; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: AaryanSinghChauhan09/SigmaOS
Length of output: 5492
🏁 Script executed:
Repository: AaryanSinghChauhan09/SigmaOS
Length of output: 50385
Implement
execute_workflowinstead of returningOkunconditionally.LocalLlmOrchestrator::execute_workflowdoes not validateself.active_agents, select a device, dispatch to the local LLM, or inspect task output. Every call returnsOk, so callers cannot observeAgentNotFound,ExecutionFailed,Timeout, orInvalidTask. Return an explicit error until the backend exists, or wire the method into an actual execution path.🤖 Prompt for AI Agents