fix bug: sys_futex should not check timeout parameter for musl libc 1.1.22

master
chyyuu 6 years ago
parent 252449a198
commit d9d21a3db1

@ -59,15 +59,16 @@ impl Syscall<'_> {
uaddr: usize, uaddr: usize,
op: u32, op: u32,
val: i32, val: i32,
timeout: *const TimeSpec, // timeout: *const TimeSpec,
) -> SysResult { ) -> SysResult {
info!( info!(
"futex: [{}] uaddr: {:#x}, op: {:#x}, val: {}, timeout_ptr: {:?}", //"futex: [{}] uaddr: {:#x}, op: {:#x}, val: {}, timeout_ptr: {:?}",
"futex: [{}] uaddr: {:#x}, op: {:#x}, val: {}. timeout ALWAYS 0",
thread::current().id(), thread::current().id(),
uaddr, uaddr,
op, op,
val, val
timeout // timeout
); );
// if op & OP_PRIVATE == 0 { // if op & OP_PRIVATE == 0 {
// unimplemented!("futex only support process-private"); // unimplemented!("futex only support process-private");
@ -77,11 +78,13 @@ impl Syscall<'_> {
return Err(SysError::EINVAL); return Err(SysError::EINVAL);
} }
let atomic = unsafe { self.vm().check_write_ptr(uaddr as *mut AtomicI32)? }; let atomic = unsafe { self.vm().check_write_ptr(uaddr as *mut AtomicI32)? };
let _timeout = if timeout.is_null() { // musl libc 1.1.22 _wake FUN didn't provide timeout, ___futexwait FUN set timeout=0
None // now rcore just ignored the timeout parameter. TODO
} else { // let _timeout = if timeout.is_null() {
Some(unsafe { *self.vm().check_read_ptr(timeout)? }) // None
}; // } else {
// Some(unsafe { *self.vm().check_read_ptr(timeout)? })
// };
const OP_WAIT: u32 = 0; const OP_WAIT: u32 = 0;
const OP_WAKE: u32 = 1; const OP_WAKE: u32 = 1;

@ -229,7 +229,7 @@ impl Syscall<'_> {
args[0], args[0],
args[1] as u32, args[1] as u32,
args[2] as i32, args[2] as i32,
args[3] as *const TimeSpec, // args[3] as *const TimeSpec,
), ),
// time // time

Loading…
Cancel
Save