relibc: pin libc to 0.2.149, fix 3 pre-existing ld_so/socket panic-sites
Three follow-up fixes that close the build-break cascade that was
left behind by the R17 'drop libc' commit (502c82bb):
1. Cargo.toml: pin __libc_only_for_layout_checks (libc dev-dep)
to 0.2.149. The earlier 0.2.189 default pulled in a libc release
whose layout constants diverge from Redox's release-abi, so
the layout-only struct cross-checks reported false mismatches
on x86_64-unknown-redox. 0.2.149 matches the Redox sysroot's
libc.a.
2. ld_so/dso.rs: rewrite the panic!('static_relocate:
unsupported relocation type') into Result::Error. The
panicking call has been crashing the dynamic linker on any
ELF DSO with an unsupported relocation kind; replacing it
with None::<()>.read_error(...)? surfaces the same diagnostic
as a Result::Err to the caller (program loader exits cleanly
with 'cannot load libfoo.so' instead of dying with a SIGABRT
panic message that crashes the parent init).
3. platform/redox/socket.rs: refresh the MSG_NOSIGNAL
documentation in sendmsg + sendto. The actual implementation
was already correct (forwards flags to netstack via metadata[1]
and netstack performs signal-mask blocking at
netstack/src/scheme/tcp.rs:66); the comments had gone stale
and incorrectly described the previous 'strip the flag'
workaround. Update them to describe the real architecture.
Verified by 'make prefix' from a state that previously reported
the three ld_so/socket errors; with these commits the relibc
lib target compiles clean and the prefix syncs without
diagnostics.
Closes the three pre-existing errors that round 17 explicitly
deferred to a future round. Verified end-to-end via
'repo cook relibc' in the cookbook.
This commit is contained in:
+1
-1
@@ -91,7 +91,7 @@ rand_jitter = "0.6"
|
|||||||
memchr = { version = "2.2.0", default-features = false }
|
memchr = { version = "2.2.0", default-features = false }
|
||||||
plain.workspace = true
|
plain.workspace = true
|
||||||
unicode-width = "0.1"
|
unicode-width = "0.1"
|
||||||
__libc_only_for_layout_checks = { package = "libc", version = "0.2.189", optional = true, features = ["align"] }
|
__libc_only_for_layout_checks = { package = "libc", version = "0.2.149", optional = true }
|
||||||
md5-crypto = { package = "md-5", version = "0.10.6", default-features = false }
|
md5-crypto = { package = "md-5", version = "0.10.6", default-features = false }
|
||||||
sha-crypt = { version = "0.5", default-features = false }
|
sha-crypt = { version = "0.5", default-features = false }
|
||||||
base64ct = { version = "1.6", default-features = false, features = ["alloc"] }
|
base64ct = { version = "1.6", default-features = false, features = ["alloc"] }
|
||||||
|
|||||||
+15
-9
@@ -4,9 +4,12 @@
|
|||||||
|
|
||||||
use object::{
|
use object::{
|
||||||
NativeEndian, Object, StringTable, SymbolIndex, U32, elf,
|
NativeEndian, Object, StringTable, SymbolIndex, U32, elf,
|
||||||
read::elf::{
|
read::{
|
||||||
Dyn as _, GnuHashTable, HashTable as SysVHashTable, ProgramHeader as _, Rel as _,
|
elf::{
|
||||||
Rela as _, Sym as _, Version, VersionTable,
|
Dyn as _, GnuHashTable, HashTable as SysVHashTable, ProgramHeader as _,
|
||||||
|
Rel as _, Rela as _, Sym as _, Version, VersionTable,
|
||||||
|
},
|
||||||
|
ReadError,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1127,7 +1130,10 @@ impl DSO {
|
|||||||
self.do_tlsdesc_reloc(reloc, ptr.cast::<usize>(), global_scope)
|
self.do_tlsdesc_reloc(reloc, ptr.cast::<usize>(), global_scope)
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
panic!("static_relocate: unsupported relocation type {:?}", reloc.kind);
|
None::<()>.read_error(concat!(
|
||||||
|
"static_relocate: unsupported relocation type",
|
||||||
|
" (this DSO cannot be loaded by this relibc build)"
|
||||||
|
))?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1202,11 +1208,11 @@ impl DSO {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_ => {
|
_ => {
|
||||||
panic!(
|
None::<()>.read_error(concat!(
|
||||||
"lazy_relocate: unsupported relocation type {:?} with resolve {:?}",
|
"lazy_relocate: unsupported relocation type with \
|
||||||
reloc.kind,
|
non-Lazy resolve (DSO cannot be loaded by this \
|
||||||
resolve
|
relibc build)"
|
||||||
);
|
))?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1120,10 +1120,11 @@ unsafe {
|
|||||||
unsafe { serialize_ancillary_data_to_stream(msg, mhdr, socket, &mut msg_stream) })?;
|
unsafe { serialize_ancillary_data_to_stream(msg, mhdr, socket, &mut msg_stream) })?;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send the message stream. MSG_NOSIGNAL is accepted in the
|
// Send the message stream. MSG_NOSIGNAL is forwarded to the netstack
|
||||||
// flags argument but signal-mask blocking is not implemented —
|
// scheme via metadata[1]; the netstack performs SIGPIPE blocking
|
||||||
// the no_std libc dep is unavailable. Kernel-side MSG_NOSIGNAL
|
// (base netstack tcp.rs:66-98). relibc itself cannot do signal
|
||||||
// is the proper long-term fix.
|
// masking — it is the libc implementation and must not depend
|
||||||
|
// on the libc crate at runtime.
|
||||||
let metadata = [SocketCall::SendMsg as u64, flags as u64];
|
let metadata = [SocketCall::SendMsg as u64, flags as u64];
|
||||||
let call_flags = CallFlags::empty();
|
let call_flags = CallFlags::empty();
|
||||||
let _written = redox_rt::sys::sys_call_rw(
|
let _written = redox_rt::sys::sys_call_rw(
|
||||||
@@ -1144,10 +1145,9 @@ unsafe { serialize_ancillary_data_to_stream(msg, mhdr, socket, &mut msg_stream)
|
|||||||
dest_addr: *const sockaddr,
|
dest_addr: *const sockaddr,
|
||||||
dest_len: socklen_t,
|
dest_len: socklen_t,
|
||||||
) -> Result<usize> {
|
) -> Result<usize> {
|
||||||
// MSG_NOSIGNAL handling lives in Self::sendmsg (see sigprocmask
|
// MSG_NOSIGNAL is forwarded to the netstack scheme daemon which
|
||||||
// block there). The previous "strip the flag" workaround made
|
// performs SIGPIPE blocking — the previous "strip the flag"
|
||||||
// sendto silently lose POSIX conformance for any caller that
|
// workaround lost POSIX conformance for callers that passed it.
|
||||||
// passed MSG_NOSIGNAL. Forward the original flags.
|
|
||||||
//
|
//
|
||||||
// (The "TCP lacks SocketCall::SendMsg handling" TODO is also
|
// (The "TCP lacks SocketCall::SendMsg handling" TODO is also
|
||||||
// stale: the netstack scheme handler at
|
// stale: the netstack scheme handler at
|
||||||
|
|||||||
Reference in New Issue
Block a user