| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
| |
Here mmap/munmap wrapper remain unsafe since mmap returns a pointer
causes a memory leak when munmap is not called while dropping, and
munmap has strict rule (PAGE_SIZE aligned) for addr defined on
munmap(2).
|
| | |
|
| |
|
|
|
|
|
|
|
| |
The existing implementation was unsafe because UB could occur if a
user-space pointer referenced by the struct sock_fprog was incorrectly
passed. Rust safe model allows pointer creation and makes
dereferencing unsafe. In this case, dereferencing happenes in
kernel-space, Rust cannot guarantee this. So it must be handled
separately.
|
| |
|
|
|
|
| |
Treating optval as just a &[u8] in setsockopt() is not appropriate for
usage patterns where a struct is put into optval. Rust treats casting
a struct to &[u8] as unsafe.
|
| | |
|
|
|
When I updated nix to 0.31, `nix::fcntl::flock` became deprecated and
unusable. At first I try to refactor `lock_pid_file()` to use the
`lock` method of the `nix::fcntl::Flock` struct, but a situation arose
where `set_len(0)` could not be called due to ownership issues. Linux
system calls are fundamentally simple, stable, and backward
compatible. Therefore, a compat layer is not necessary.
Anticipating that this might happen again, this commit introduce the
`libc_s`, which handles simple error processing for unsafe ffis in
libc syscall bindings.
|