profile
viewpoint

bjorn3/inline_asm_catalogue 9

Catalogue of asm! snippets to help the discussion about stabilization of inline asm

bjorn3/goodgame_empire_import 4

A importer for goodgame empire

bjorn3/fractals 3

Just some experiments

bjorn3/cargo-bisect-rustc-bot-jobs 1

This repo contains the cargo bisect-rustc jobs for my bot

bjorn3/goodgame_empire_helpers 1

Helpers for goodgame empire

bjorn3/addr2line 0

A cross-platform `addr2line` clone written in Rust, using `gimli`

bjorn3/backtrace-rs 0

Backtraces in Rust

pull request commentrust-lang/rust

Prevent `__rust_begin_short_backtrace` frames from being tail-call optimised away

spurious network error

eggyal

comment created time in an hour

Pull request review commentheadcrab-rs/headcrab

Add watchpoint

 impl LinuxTarget {          Ok(tasks)     }++    #[cfg(target_arch = "x86_64")]+    pub fn set_watchpoint(+        &mut self,+        watchpoint: Watchpoint,+    ) -> Result<usize, Box<dyn std::error::Error>> {+        let empty = self.find_empty_watchpoint();+        if empty.is_none() {+            return Err(Box::new(WatchpointError::NoEmptyWatchpoint));+        }+        let index = empty.unwrap();++        let rw_bits: u32 = match watchpoint.typ {+            WatchpointType::Execute => 0b00,+            WatchpointType::Read => 0b11,+            WatchpointType::ReadWrite => 0b11,+            WatchpointType::Write => 0b01,+        } << 16 + index * 2;++        let size_bits: u32 = (watchpoint.size as u32) << 18 + index * 2;++        let enable_bit: u32 = 1 << (2 * index);++        let bit_mask: u32 = (0b11 << (2 * index)) | (0b1111 << (16 + 4 * index));++        let mut dr7: u64 = 0;++        unsafe {+            self.read().read(&mut dr7, *DEBUG_REG + 7 * 4).apply()?;+        }++        // Check if hardware watchpoint is already used+        if dr7 & (1 << (2 * index)) != 0 {+            // Panic for now+            panic!("Invalid debug register state")+        }++        dr7 = (dr7 & !(bit_mask as u64)) | (enable_bit | rw_bits | size_bits) as u64;++        // FIXME: Wait for write implementation+        // Write addr and dr7+        unimplemented!();++        self.watchpoints[index] = Some(watchpoint);++        Ok(index)+    }++    #[cfg(target_arch = "x86_64")]+    pub fn clear_watchpoint(+        &mut self,+        index: usize,+    ) -> Result<Watchpoint, Box<dyn std::error::Error>> {+        if self.watchpoints[index].is_none() {+            return Err(Box::new(WatchpointError::DoesNotExist(index)));+        }++        let mut dr7: u64 = 0;+        unsafe {+            self.read().read(&mut dr7, *DEBUG_REG + 7 * 4).apply()?;+        }++        let bit_mask: u32 = (0b11 << (2 * index)) | (0b1111 << (16 + 4 * index));+        dr7 = dr7 & !(bit_mask as u64);++        // FIXME: Wait for write implementation+        // Write addr and dr7+        unimplemented!();++        let watchpoint = std::mem::replace(&mut self.watchpoints[index], None);+        Ok(watchpoint.unwrap())+    }++    #[cfg(target_arch = "x86_64")]+    pub fn clear_all_watchpoints(&mut self) -> Result<(), Box<dyn std::error::Error>> {+        for index in 0..SUPPORTED_HARDWARE_WATCHPOINTS {+            match self.watchpoints[index] {+                Some(_) => {+                    self.clear_watchpoint(index)?;+                }+                None => (),+            };+        }+        Ok(())+    }++    #[cfg(target_arch = "x86_64")]+    fn find_empty_watchpoint(&self) -> Option<usize> {+        let mut empty = None;+        for i in 0..SUPPORTED_HARDWARE_WATCHPOINTS {+            if self.watchpoints[i].is_none() {+                empty = Some(i);+                break;+            }+        }+        return empty;

self.watchpoints.iter().find(|w| w.is_some())

JJendryka

comment created time in an hour

Pull request review commentheadcrab-rs/headcrab

Add watchpoint

 use std::{  lazy_static::lazy_static! {     static ref PAGE_SIZE: usize = unsafe { libc::sysconf(libc::_SC_PAGESIZE) as usize };+    static ref DEBUG_REG: usize = unsafe {

Also this needs to be #[cfg[target_arch="x86_64")].

JJendryka

comment created time in 2 hours

Pull request review commentheadcrab-rs/headcrab

Add watchpoint

 impl LinuxTarget {          Ok(tasks)     }++    #[cfg(target_arch = "x86_64")]+    pub fn set_watchpoint(+        &mut self,+        watchpoint: Watchpoint,+    ) -> Result<usize, Box<dyn std::error::Error>> {+        let empty = self.find_empty_watchpoint();+        if empty.is_none() {+            return Err(Box::new(WatchpointError::NoEmptyWatchpoint));+        }+        let index = empty.unwrap();++        let rw_bits: u32 = match watchpoint.typ {+            WatchpointType::Execute => 0b00,+            WatchpointType::Read => 0b11,+            WatchpointType::ReadWrite => 0b11,+            WatchpointType::Write => 0b01,+        } << 16 + index * 2;++        let size_bits: u32 = (watchpoint.size as u32) << 18 + index * 2;++        let enable_bit: u32 = 1 << (2 * index);++        let bit_mask: u32 = (0b11 << (2 * index)) | (0b1111 << (16 + 4 * index));++        let mut dr7: u64 = 0;++        unsafe {+            self.read().read(&mut dr7, *DEBUG_REG + 7 * 4).apply()?;

This needs PTRACE_PEEKUSER I think, not PTRACE_PEEK/read_process_vm like read uses.

JJendryka

comment created time in an hour

Pull request review commentheadcrab-rs/headcrab

Add watchpoint

 use std::{  lazy_static::lazy_static! {     static ref PAGE_SIZE: usize = unsafe { libc::sysconf(libc::_SC_PAGESIZE) as usize };+    static ref DEBUG_REG: usize = unsafe {

DEBUG_REG_OFFSET

JJendryka

comment created time in 2 hours

Pull request review commentheadcrab-rs/headcrab

Add watchpoint

 impl LinuxTarget {          Ok(tasks)     }++    #[cfg(target_arch = "x86_64")]

Please make this function available on all platforms and instead return an error on unsupported platforms.

JJendryka

comment created time in 2 hours

Pull request review commentheadcrab-rs/headcrab

Add watchpoint

 pub struct AttachOptions {     pub kill_on_exit: bool, } +pub struct Watchpoint {+    typ: WatchpointType,+    addr: usize,+    size: WatchSize,+    on_trap: std::boxed::Box<dyn FnMut(&Self)>,

Treating this like a software breakpoint, aka returning a signal from step/unpause is more flexible, as the user of headcrab can for example allow the enduser to inspect/modify the program state before continuing.

JJendryka

comment created time in 2 hours

Pull request review commentrust-lang/rust

Prevent `__rust_begin_short_backtrace` frames from being tail-call optimised away

 pub fn begin_panic<M: Any + Send>(msg: M) -> ! {         intrinsics::abort()     } -    rust_panic_with_hook(&mut PanicPayload::new(msg), None, Location::caller());+    return crate::sys_common::backtrace::__rust_end_short_backtrace(move || {

Could you also do this in begin_panic_handler?

eggyal

comment created time in 8 hours

issue commentheadcrab-rs/headcrab

data breakpoint support

Lldb code to write DR* registers on x86_64:

Linux: https://github.com/llvm/llvm-project/blob/e46c6644db8432584e82ef7ddfc9d0f36543f205/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp#L1067-L1127 FreeBSD: https://github.com/llvm/llvm-project/blob/2946cd701067404b99c39fb29dc9c74bd7193eb3/lldb/source/Plugins/Process/FreeBSD/RegisterContextPOSIXProcessMonitor_x86.cpp#L552-L607 Windows: https://github.com/llvm/llvm-project/blob/5b5274eaf8c26064b6d10b43171f6252c10f576e/lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_x86_64.cpp#L766-L799 macOS is not supported: https://github.com/llvm/llvm-project/blob/cdc514e4c67f268b07863bbac3d8d7e0d088186c/lldb/source/Plugins/Process/Darwin/NativeThreadDarwin.cpp#L96-L101

spacejam

comment created time in 8 hours

pull request commentheadcrab-rs/headcrab

Add disassembler and line info parsing

I switched the source.rs test to use hello instead of known_asm. This means that gimli-rs/addr2line#187 is no longer a problem. (There is already a fix for it on master by the way, but is is not yet released)

bjorn3

comment created time in 11 hours

push eventbjorn3/headcrab

bjorn3

commit sha 83ab0dfb1b79c6e93740ae8c6de027bf5fe69da4

Get source location for address

view details

bjorn3

commit sha 1e2a66de841d47c3ba7f654208c030954d9d2e6c

Disassembly support in the repl

view details

bjorn3

commit sha 374bc0d148655714dfa515308843e66de07bba88

Fix RelocatedDwarf::from_maps for segments mapped starting from the middle

view details

push time in 11 hours

push eventbjorn3/headcrab

bjorn3

commit sha 7aec2acd99fc509395323e776274cd479e20e2b5

Get source location for address

view details

bjorn3

commit sha b9201831234e7f3042750cb24cfe065c5802f600

Disassembly support in the repl

view details

bjorn3

commit sha 574eaafe43b1b9cebcbe68cb2ca007be5678645b

Fix RelocatedDwarf::from_maps for segments mapped starting from the middle

view details

push time in 11 hours

push eventbjorn3/headcrab

bjorn3

commit sha ae83550c5a9f331be8372c154d21307417982095

Disassembly support in the repl

view details

bjorn3

commit sha 5e4ab9214854882b52118176a739453092f03e06

Fix RelocatedDwarf::from_maps for segments mapped starting from the middle

view details

push time in 11 hours

push eventbjorn3/headcrab

bjorn3

commit sha fd063d2db9e57e1ca4f09720bf698444314885f0

[WIP] Disassembly support in the repl

view details

push time in 12 hours

push eventbjorn3/headcrab

Fábio Botelho

commit sha dc3246a8419623132ac067dd70234670549c7e04

Get a list of threads from Linux debuggee - introduces a Thread struct - retrieves a list of threads in linux Notes: - I decided to use procfs because libproc-rs does not support getting the list of threads from linux right now [1]. I imagine this crate being useful in the future anyhow. [1] https://github.com/andrewdavidmackenzie/libproc-rs/blob/123d1762727c9c5d4e81888d8ea1a7f9701ddb45/src/libproc/proc_pid.rs#L260

view details

Fábio Botelho

commit sha 8614be86762d1578f651f3b3973629e02569e14a

Compile procfs only on linux Fails to compile on OSX. It's not needed there anywhere, so this is better.

view details

Fábio Botelho

commit sha f0ee9be0f0bdddb644e4e4b1843b84efa539c4d9

Move location of Linux dependencies

view details

Fábio Botelho

commit sha dc4d5494f9db3cbe7d8b5c9c45354e81d411fc29

Add trailing newline

view details

Fábio Botelho

commit sha 370ebaed3d997485e80adacc2363a762be5b87f5

Improve comments Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>

view details

Fábio Botelho

commit sha da9e7917acb2c63bb5ae9b984ee8eb9839f2fb2f

Move threads to LinuxTarget only That is the only place it's being used.

view details

Fábio Botelho

commit sha 009d9c0cb1fb5d022e3adbd2631a103c324e9ec0

Fix threads test - Was printing the wrong message. - Was not waiting for the thread to start before retrieving the list - of threads. Seen it failed on CI.

view details

Fábio Botelho

commit sha 9af14554de1e9d5a86836c5b2afee463ac824650

Supress warning on threads Adding to supress warning until it's used on a integration test or by something else.

view details

Fábio Botelho

commit sha 3e4f9b39e1f0156ecf93961acfac92877d11d27c

Use i32 as thread id type It's the original type in the kernel.

view details

Fábio Botelho

commit sha f1ce89696638bcfcafed00c2eeb08533dd30f0b6

Make method public And remove silly dead code supression :D

view details

Fábio Botelho

commit sha ed6215d3900b1abf2ddfb31968527f3824af8405

Merge branch 'list-threads' of github.com:fabiim/headcrab into list-threads

view details

Fábio Botelho

commit sha 0471ff8f59601bb398b353eb5d3a7022638c5f51

Use Into<String> Makes API more flexible. Co-authored-by: Nikita Baksalyar <nikita.baksalyar@gmail.com>

view details

Fábio Botelho

commit sha 65a29a7469d19596487c73efd920d97624d99b4d

Fix suggestion commit error The aplly suggestion did remove the previous code?

view details

Fábio Botelho

commit sha 771f7072a518769f8d64a1503f350cd1a3cf0153

Use the environment to get number of threads Note that is inconsistent: https://github.com/rust-lang/rust/issues/74845

view details

Fábio Botelho

commit sha 9012e7aee1ec67f625d345f5ed4c0d1c0a580d8a

Merge branch 'master' into list-threads

view details

bjorn3

commit sha 504791ad6174b386fb77a5322d22a08786252b1e

Handle pie executables on Linux (#59) * Handle pie executables * Add ADDR_NO_RANDOMIZE const Co-authored-by: Nikita Baksalyar <nikita.baksalyar@gmail.com> * Fix formatting * Fix const type Co-authored-by: Nikita Baksalyar <nikita.baksalyar@gmail.com>

view details

Fábio Botelho

commit sha 51ed53c3d1bff92ff03bc12788984438b2652c1c

Merge branch 'master' into list-threads

view details

Fábio Botelho

commit sha 53fe03edf5e3095a92790821f42097664b5ed2f5

Fix bad merge conflict resolution - Banged the thread change - Had duplicate procfs entries

view details

Fábio Botelho

commit sha 1a0b66c7eba2c9d76843889362a25b3b3f4c4720

Ignore tasks not found Some tasks might not be there between getting them from the iterator and actually trying to read their page.

view details

Fábio Botelho

commit sha 1da2a2d029e800b9bef95feb5314fd42e57a93c9

Stop retrying when incomplete It does not make much sense. Threads come and go, we don't have any consistency guarantees when calling the threads method. If the thread info is not ready it can be caught in a subsequent call to threads

view details

push time in 12 hours

delete branch bjorn3/headcrab

delete branch : unwind_the_stack

delete time in 14 hours

push eventbjorn3/headcrab

Fábio Botelho

commit sha dc3246a8419623132ac067dd70234670549c7e04

Get a list of threads from Linux debuggee - introduces a Thread struct - retrieves a list of threads in linux Notes: - I decided to use procfs because libproc-rs does not support getting the list of threads from linux right now [1]. I imagine this crate being useful in the future anyhow. [1] https://github.com/andrewdavidmackenzie/libproc-rs/blob/123d1762727c9c5d4e81888d8ea1a7f9701ddb45/src/libproc/proc_pid.rs#L260

view details

Fábio Botelho

commit sha 8614be86762d1578f651f3b3973629e02569e14a

Compile procfs only on linux Fails to compile on OSX. It's not needed there anywhere, so this is better.

view details

Fábio Botelho

commit sha f0ee9be0f0bdddb644e4e4b1843b84efa539c4d9

Move location of Linux dependencies

view details

Fábio Botelho

commit sha dc4d5494f9db3cbe7d8b5c9c45354e81d411fc29

Add trailing newline

view details

Fábio Botelho

commit sha 370ebaed3d997485e80adacc2363a762be5b87f5

Improve comments Co-authored-by: bjorn3 <bjorn3@users.noreply.github.com>

view details

Fábio Botelho

commit sha da9e7917acb2c63bb5ae9b984ee8eb9839f2fb2f

Move threads to LinuxTarget only That is the only place it's being used.

view details

Fábio Botelho

commit sha 009d9c0cb1fb5d022e3adbd2631a103c324e9ec0

Fix threads test - Was printing the wrong message. - Was not waiting for the thread to start before retrieving the list - of threads. Seen it failed on CI.

view details

Fábio Botelho

commit sha 9af14554de1e9d5a86836c5b2afee463ac824650

Supress warning on threads Adding to supress warning until it's used on a integration test or by something else.

view details

Fábio Botelho

commit sha 3e4f9b39e1f0156ecf93961acfac92877d11d27c

Use i32 as thread id type It's the original type in the kernel.

view details

Fábio Botelho

commit sha f1ce89696638bcfcafed00c2eeb08533dd30f0b6

Make method public And remove silly dead code supression :D

view details

Fábio Botelho

commit sha ed6215d3900b1abf2ddfb31968527f3824af8405

Merge branch 'list-threads' of github.com:fabiim/headcrab into list-threads

view details

Fábio Botelho

commit sha 0471ff8f59601bb398b353eb5d3a7022638c5f51

Use Into<String> Makes API more flexible. Co-authored-by: Nikita Baksalyar <nikita.baksalyar@gmail.com>

view details

Fábio Botelho

commit sha 65a29a7469d19596487c73efd920d97624d99b4d

Fix suggestion commit error The aplly suggestion did remove the previous code?

view details

Fábio Botelho

commit sha 771f7072a518769f8d64a1503f350cd1a3cf0153

Use the environment to get number of threads Note that is inconsistent: https://github.com/rust-lang/rust/issues/74845

view details

Fábio Botelho

commit sha 9012e7aee1ec67f625d345f5ed4c0d1c0a580d8a

Merge branch 'master' into list-threads

view details

Fábio Botelho

commit sha 51ed53c3d1bff92ff03bc12788984438b2652c1c

Merge branch 'master' into list-threads

view details

Fábio Botelho

commit sha 53fe03edf5e3095a92790821f42097664b5ed2f5

Fix bad merge conflict resolution - Banged the thread change - Had duplicate procfs entries

view details

Fábio Botelho

commit sha 1a0b66c7eba2c9d76843889362a25b3b3f4c4720

Ignore tasks not found Some tasks might not be there between getting them from the iterator and actually trying to read their page.

view details

Fábio Botelho

commit sha 1da2a2d029e800b9bef95feb5314fd42e57a93c9

Stop retrying when incomplete It does not make much sense. Threads come and go, we don't have any consistency guarantees when calling the threads method. If the thread info is not ready it can be caught in a subsequent call to threads

view details

Jakub Jendryka

commit sha bb0a7fcc0784bdb1b21051d9c5eddb83e23503ff

Implement PTRACE_PEEKTEXT fallback

view details

push time in 14 hours

issue closedheadcrab-rs/headcrab

Support headcrab compilation on Windows

Currently headcrab fails to compile on windows due to dependencies not being based on the platform entirely. The idea is to get the code building on windows platform.

closed time in 15 hours

DeltaManiac

issue commentheadcrab-rs/headcrab

Support headcrab compilation on Windows

Wait, this ia only about compiling, not about actually debugging.

DeltaManiac

comment created time in 15 hours

IssuesEvent

push eventbjorn3/rustc_codegen_cranelift

Veetaha

commit sha 50ecea0c18eb9fa572828217ce87315c9e5a5b80

Remove cargo home perms workaround

view details

bjorn3

commit sha 0cdec787bb651777c76ace211b73738eb1b8ce2f

Merge pull request #1069 from Veetaha/feat/remove-perms-workaround Remove cargo home perms workaround

view details

push time in 15 hours

PR merged bjorn3/rustc_codegen_cranelift

Remove cargo home perms workaround

Thanks for the workaround @bjorn3, but it's time to remove it!

https://github.com/actions/cache/issues/133

+0 -5

0 comment

1 changed file

Veetaha

pr closed time in 15 hours

Pull request review commentheadcrab-rs/headcrab

Naive and frame pointer stack unwinders

 pub fn continue_to_end(target: &LinuxTarget) {         status => panic!("Status: {:?}", status),     } }++/// Turn the `pause` instruction inside the `breakpoint` function into a breakpoint.+#[cfg(target_os = "linux")]+#[allow(dead_code)]+pub fn patch_breakpoint(target: &LinuxTarget, debuginfo: &RelocatedDwarf) {+    // Test that `a_function` resolves to a function.+    let breakpoint_addr = debuginfo.get_symbol_address("breakpoint").unwrap() + 4 /* prologue */;

This only works on x86_64 anyway. The test uses core::arch::x86_64::_mm_pause(). This is a temporary hack until we get real breakpoint support.

bjorn3

comment created time in 16 hours

push eventbjorn3/headcrab

bjorn3

commit sha ee57cca9c0fb9d3e50d71f44864bbb6eebf35339

Fix comment Co-authored-by: Nikita Baksalyar <nikita.baksalyar@gmail.com>

view details

push time in 16 hours

issue commentbytecodealliance/wasmtime

Optimizing the wasi web polyfill?

Over the past few days I wrote a pure js web polyfill for a subset of wasi: https://github.com/bjorn3/rust/blob/compile_rustc_wasm4/rustc.html It is just enough to get rustc compiled to wasi working.

kripken

comment created time in a day

issue commentrust-lang/stdarch

Deprecate MXCSR intrinsics

You can write it to the stack inside the asm! block and then reference the stack from LDMXCSR and STMXCSR.

gnzlbg

comment created time in a day

pull request commentrust-lang/triagebot

Handle absent sender_short_name in zulip-hook

In my testing it looks like Zulip is no longer always sending a sender_short_name in the outgoing hook request. Possibly related to zulip/zulip@b375581.

Sorry for reporting a leak :)

https://blog.zulip.com/2020/07/30/zulip-server-3-1-release/

Removed unused short_name field from the User model. This field had no purpose and could leak the local part of email addresses when email address visibility was restricted.

dtolnay

comment created time in 2 days

Pull request review commentrust-lang/rust

Add `-Z combine_cgu` flag

 impl Input { #[derive(Clone, Hash)] pub struct OutputFilenames {     pub out_directory: PathBuf,-    filestem: String,+    pub filestem: String,

Why this change?

0dvictor

comment created time in 2 days

issue commentphil-opp/blog_os

Race condition when printing in interrupt handlers

You have to call lock() on spin::Mutex<Writer> to get a &mut Writer. You can't directly return &mut Writer from Deref or DerefMut as lock() technically returns a lock guard that derefs to &mut Writer. This &mut Writer can't outlive the lock guard. If you were to return &mut Writer, the lock guard would need to be dropped, invalidating the &mut Writer.

xermicus

comment created time in 2 days

pull request commentrust-lang/rust

Use TLS less in rustc_span

#72121 has landed.

Aaron1011

comment created time in 2 days

issue commentrust-analyzer/rust-analyzer

Type checking doesn't work when `rocket` library is a dependency

That is https://github.com/rust-analyzer/rust-analyzer/issues/3155

brundonsmith

comment created time in 2 days

issue commentrust-analyzer/rust-analyzer

Type checking doesn't work when `rocket` library is a dependency

You can also create a file called rust-toolchain in the project dir with the text nightly. That way everyone cloning your project will use nightly by default.

brundonsmith

comment created time in 2 days

issue commentrust-analyzer/rust-analyzer

Type checking doesn't work when `rocket` library is a dependency

Run rustup override set nightly in the project dir. This makes all commands in that dir use nightly by default.

brundonsmith

comment created time in 2 days

IssuesEvent

issue closedrust-analyzer/rust-analyzer

Type checking doesn't work when `rocket` library is a dependency

To reproduce:

  1. Create a new Rust bin project via cargo
  2. Paste this into main.rs:
fn main() {
    let foo:&str = 12;
}
  1. Add this to Cargo.toml:
[dependencies]
rocket = "0.4.5"
  1. Note that there's no type error in main.rs
  2. Removing the dependency brings the error back

Things to note:

  • Syntax errors and parameter names still show up, so rust-analyzer is functioning in some capacity
  • Rocket does a lot of fancy macro stuff (though it doesn't have to be used for this to happen); could that be relevant?

closed time in 2 days

brundonsmith

issue commentrust-analyzer/rust-analyzer

Type checking doesn't work when `rocket` library is a dependency

Are you using nightly?

error: failed to run custom build command for `rocket v0.4.5`

Caused by:
  process didn't exit successfully: `/home/bjorn/test_project/target/debug/build/rocket-f9eb5b1b9f1891f5/build-script-build` (exit code: 101)
--- stderr
Error: Rocket (core) requires a 'dev' or 'nightly' version of rustc.
Installed version: 1.44.1 (2020-06-17)
Minimum required:  1.35.0-nightly (2019-04-05)
See the getting started guide (https://rocket.rs/v0.5/guide/getting-started/) for more information.
thread 'main' panicked at 'Aborting compilation due to incompatible compiler.', /home/bjorn/.cargo/registry/src/github.com-1ecc6299db9ec823/rocket-0.4.5/build.rs:29:13

Version 0.4.5 of rocket still requires a nightly compiler. Only starting from the not yet released version 0.5.0 does rocket support a stable compiler.

brundonsmith

comment created time in 2 days

Pull request review commentheadcrab-rs/headcrab

Support Windows Build

 //! This is a simple test to attach to already running debugee process +#[cfg(unix)]

Please use #![cfg(unix)]. This test uses fork which is only available on unix. While the actual test is currently #[cfg(target_os = "linux)], the goal is that it will run on all unix systems.

DeltaManiac

comment created time in 2 days

Pull request review commentheadcrab-rs/headcrab

Support Windows Build

 security-framework-sys = "1.0" [target.'cfg(target_os="linux")'.dependencies] procfs = "0.8.0" +
DeltaManiac

comment created time in 2 days

issue commentgoogle/evcxr

Speed feels slow

I am curious how much difference -Cprefer-dynamic makes. That dynamically links libstd.so instead of statically.

bCom5

comment created time in 2 days

Pull request review commentheadcrab-rs/headcrab

Support Windows Build

 /// Functions to work with target processes: reading & writing memory, process control functions, etc. pub mod target; +#[cfg(target_os="unix,linux")]
#[cfg(unix)]
DeltaManiac

comment created time in 2 days

Pull request review commentheadcrab-rs/headcrab

Support Windows Build

 //! This is a simple test to attach to already running debugee process +#[cfg(target_os = "linux")]
#![cfg(unix)] // Requires `fork`

//! This is a simple test to attach to already running debugee process

DeltaManiac

comment created time in 2 days

Pull request review commentheadcrab-rs/headcrab

Support Windows Build

 security-framework-sys = "1.0" # Dependencies specific to Linux [target.'cfg(target_os="linux")'.dependencies] procfs = "0.8.0"+[target.'cfg(any(target_os = "linux", target_os = "unix"))'.dependencies]

There is already a

[target.'cfg(unix)'.dependencies]

section above.

DeltaManiac

comment created time in 2 days

Pull request review commentheadcrab-rs/headcrab

Support Windows Build

 security-framework-sys = "1.0" # Dependencies specific to Linux [target.'cfg(target_os="linux")'.dependencies] procfs = "0.8.0"+[target.'cfg(any(target_os = "linux", target_os = "unix"))'.dependencies]+nix = "0.17.0"+libproc = "0.7.2"+libc = "0.2.72"+object = "0.20"

object should remain as dependency on all OSes I think. It is necessary for symbolication in case of remote debugging of unix targets. gimli is also necessary for that, so I think that one should also be moved from cfg(unix) to all platforms.

DeltaManiac

comment created time in 2 days

Pull request review commentheadcrab-rs/headcrab

Support Windows Build

+name: windows ++on:+  push:+    branches: [ master ]+  pull_request:+    branches: [ master ]++env:+  CARGO_TERM_COLOR: always++jobs:+  build:++    runs-on: windows-latest++    steps:+    - uses: actions/checkout@v2+    - name: Format+      run: cargo fmt --all -- --check+    - name: Clippy+      run: cargo clippy+    - name: Build+      run: cargo build --verbose+    - name: Run tests+      run: cargo test --verbose

nit: missing trailing newline

DeltaManiac

comment created time in 2 days

Pull request review commentrust-lang/rust

Separate unsized fn params from unsized locals

 impl<'a, 'tcx> Visitor<'tcx> for GatherLocalsVisitor<'a, 'tcx> {         intravisit::walk_local(self, local);     } +    fn visit_param(&mut self, param: &'tcx hir::Param<'tcx>) {+        self.within_fn_param = true;+        intravisit::walk_param(self, param);+        self.within_fn_param = false;+    }+     // Add pattern bindings.     fn visit_pat(&mut self, p: &'tcx hir::Pat<'tcx>) {         if let PatKind::Binding(_, _, ident, _) = p.kind {             let var_ty = self.assign(p.span, p.hir_id, None); -            if !self.fcx.tcx.features().unsized_locals {-                self.fcx.require_type_is_sized(var_ty, p.span, traits::VariableType(p.hir_id));+            if self.within_fn_param {+                if !self.fcx.tcx.features().unsized_fn_params {+                    self.fcx.require_type_is_sized(var_ty, p.span, traits::SizedArgumentType(None));+                }+            } else {+                if !self.fcx.tcx.features().unsized_locals {+                    self.fcx.require_type_is_sized(var_ty, p.span, traits::VariableType(p.hir_id));+                }             }

What about fn a(box box b: Box<Box<[u8]>>) {}? I think that should keep using unsized_locals and not unsized_fn_params.

JohnTitor

comment created time in 3 days

push eventbjorn3/rust

bjorn3

commit sha 051645cb3707b4070fe21f12c85346acdfe1767c

[polyfill] Compile hello world

view details

push time in 3 days

issue commentphil-opp/blog_os

Race condition when printing in interrupt handlers

impl Deref for WrappedWriter {
    type Target = WrappedWriter;

    fn deref(&self) -> &Self::Target {
        return self;
    }
}

It is not valid for a type to deref to itself. Target should be something like spin::Mutex<Writer>.

xermicus

comment created time in 3 days

issue commentphil-opp/blog_os

Race condition when printing in interrupt handlers

@nicolae536 What is your Deref implementation for vga_buffer::writer::WrappedWriter?

xermicus

comment created time in 3 days

push eventbjorn3/rust

bjorn3

commit sha eda979663e32960f42918d42ea9fd409f3577d7c

[polyfill] Write support

view details

bjorn3

commit sha 94ad5342615a5556ea68f82d79ef27f041a554d6

[polyfill] Fix it up to linking

view details

bjorn3

commit sha e271dbdec93bc9406e2eacb441a8ea3a6ffbde73

[polyfill] Fix write support

view details

bjorn3

commit sha bbd77e184d87b6b98e2f7ada6c3837034cbe568d

[polyfill] Make object file downloadable

view details

push time in 3 days

pull request commentheadcrab-rs/headcrab

Fix spelling in comments and variable names

Thanks!

hunger

comment created time in 3 days

push eventheadcrab-rs/headcrab

Tobias Hunger

commit sha 4e62c244a5b4424be10bb611951e2a0d72809424

Fix spelling in comments and variable names This makes my spellchecker happy, so that I can use it to avoid adding more typos in the future:-)

view details

Tobias Hunger

commit sha ed69dbec9fd5214b2690bde7979894dae36447d7

Modernize: #[macro_use] is no longer needed Just use the macro directly without it.

view details

bjorn3

commit sha cb5ea0e75e2065a5fdbddf9200c0b17f82e14083

Merge pull request #66 from hunger/master Fix spelling in comments and variable names

view details

push time in 3 days

PR merged headcrab-rs/headcrab

Fix spelling in comments and variable names

This makes my spellchecker happy, so that I can use it to avoid adding more typos in the future:-)

+9 -12

3 comments

3 changed files

hunger

pr closed time in 3 days

push eventbjorn3/rust

bjorn3

commit sha 0e95b73e15d849fadb1c5e1f8667a45c39341cc7

[polyfill] Use DataView instead of Uint32Array

view details

bjorn3

commit sha c139193d7a30da805b5059726890851c7f629c02

[polyfill] Cleanup

view details

bjorn3

commit sha 819ddfb38af2a57e5a437ac9158cff22eca739b9

[polyfill] Create files

view details

push time in 3 days

push eventbjorn3/rust

bjorn3

commit sha 30b89e78c4228ea99aea31e18d0d5d2ad0f1bc57

[polyfill] Load enough of the sysroot for a no_std crate

view details

bjorn3

commit sha 045591421c867bbe1ca7c239009f011a348470f3

[polyfill] Add example no_std binary

view details

bjorn3

commit sha 18557381f1eb7fb9289371ef6fff8a7a387b3fe0

[polyfill] Refactor vfs

view details

push time in 3 days

push eventbjorn3/rust

bjorn3

commit sha df70c331092e90f0e263c5df66336eb1ef8bbf6c

[polyfill] Fix sysroot loading

view details

push time in 3 days

push eventbjorn3/rust

bjorn3

commit sha 603465e0dfc14a8be9eaf495462312445036adcb

[polyfill] Fix fd_readdir

view details

push time in 3 days

issue commentrust-analyzer/rust-analyzer

hitting unreachable code when opening files

Nightly recently changed the unstable proc-macro abi. This is likely a symptom of this. For now you can disable proc-macro support in rust-analyzer. (rust-analyzer.procMacros I think)

Emilgardis

comment created time in 4 days

push eventbjorn3/rust

bjorn3

commit sha a711f7bd6505be4340d479fa597b198d94d76b9e

[polyfill] Env vars

view details

push time in 4 days

push eventbjorn3/rust

bjorn3

commit sha 6220e12d87e863a6e136eaad1cd52cf351ab004c

[polyfill] Implement readdir

view details

push time in 4 days

push eventbjorn3/rust

bjorn3

commit sha 679c4e9ddbb57721af94685100eecbb5c6069327

[polyfill] Implement file reading

view details

push time in 4 days

push eventbjorn3/rust

bjorn3

commit sha 8c4d5b763a0d5811da2da9e5e50cf4c544230718

[polyfill] Simplify

view details

bjorn3

commit sha 102b479c5922347c10555a6b4b1f750e402daae4

[polyfill] Support path_open

view details

push time in 4 days

push eventbjorn3/rust

bjorn3

commit sha 50fb8be5427689892eece7ff5cccc35a84d336df

[polyfill] Support preopen and generalize fd handling

view details

push time in 4 days

pull request commentheadcrab-rs/headcrab

Fix spelling in comments and variable names

First two commits LGTM. Re the third commit: I prefer mod.rs, as vscode otherwise puts it at the bottom of directory listing far away from the directory it's submodules are in.

hunger

comment created time in 4 days

pull request commentrust-lang/rust

Update stdarch

vektor-0.2.1 is the only legitimate regression. https://crater-reports.s3.amazonaws.com/pr-73166/try%235fdfba63a96c5e8ae0ebf6b8b66853110277087d/reg/faster-0.5.1/log.txt

The rest is out of disk space, network error or failed to find candidate crate for test.

jethrogb

comment created time in 4 days

Pull request review commentbytecodealliance/wasmtime

Don't re-parse wasm for debuginfo

 pub trait ModuleEnvironment<'data>: TargetEnvironment {     /// Declare a passive data segment.     fn declare_passive_data(&mut self, data_index: DataIndex, data: &'data [u8]) -> WasmResult<()>; +    /// Indicates how many functions the code section reports and the byte+    /// offset of where the code sections tarts.

*starts

alexcrichton

comment created time in 4 days

push eventbjorn3/rust

bjorn3

commit sha 588d1671e7e798637cd6ceb3b12ca0ef48078992

Start wasi polyfill

view details

bjorn3

commit sha 2ec27197881988e2cd1247a37f87719752ef93c4

[polyfill] Argumnt handling

view details

push time in 4 days

push eventbjorn3/bjorn3.github.io

bjorn3

commit sha 19f82f476025389358d6da2ffa2e57f33f5c0ab7

Add files via upload

view details

push time in 4 days

create barnchbjorn3/bjorn3.github.io

branch : master

created branch time in 4 days

created repositorybjorn3/bjorn3.github.io

created time in 4 days

create barnchbjorn3/bjorn3.github.io

branch : master

created branch time in 4 days

created repositorybjorn3/bjorn3.github.io

created time in 4 days

created repositorybjorn3/bjorn3.github.io

created time in 4 days

issue commentbytecodealliance/wasmtime

Wasm file traps with wasmtime

I rebuilt rustc_binary.wasm yesterday. It worked perfectly.

bjorn3

comment created time in 4 days

issue openedbytecodealliance/wasi.dev

Update polyfill for latest wasi

created time in 4 days

pull request commentheadcrab-rs/headcrab

Add attach options

Rustfmt failed

JJendryka

comment created time in 4 days

issue commentheadcrab-rs/headcrab

Keep list of threads inside Linux Target

Yes

fabiim

comment created time in 4 days

push eventbjorn3/rust

bjorn3

commit sha 333b55dccec221c83e5f4fcb37aa03ae7cc0b028

[WIP]

view details

push time in 5 days

push eventbjorn3/rust

bjorn3

commit sha c2cf297f2c0b8ab58f60132facf890252150f22e

Change

view details

push time in 5 days

push eventbjorn3/rust

bjorn3

commit sha 47e4ad280e6fdd9f25b8cc5d4be450fba94a6a9f

Revert some unnecessary changes

view details

push time in 5 days

issue openedrust-lang/rust

Record passed args in Command even on platforms not supporting process spawning

This would be useful when running a program that normally executes a different program at the end for example wasm32-wasi. If the program debug prints the std::process::Command on errors that would make it easy for the end user to run the command outside of the wasi sandbox themselves. In my particular case I compiled rustc for wasi and want to copy-paste the linker invocations once all object files are written.

created time in 5 days

push eventbjorn3/rust

bjorn3

commit sha 966f0dc1c7fb3274e53de672ebb718c24ba238ce

Bump stacker for wasm fix

view details

push time in 5 days

issue closedrust-lang/stacker

Linking failing when compiling for wasm32-wasi

error: linking with `rust-lld` failed: exit code: 1
  |
  = note: "rust-lld" "-flavor" "wasm" [...] "-l" "stacker" "-l" "psm_s"
  = note: rust-lld: error: unable to find library -lstacker
          rust-lld: error: unable to find library -lpsm_s

closed time in 5 days

bjorn3

issue commentrust-lang/stacker

Linking failing when compiling for wasm32-wasi

With psm 0.1.11 and stacker 0.1.10 it works fine.

bjorn3

comment created time in 5 days

Pull request review commentheadcrab-rs/headcrab

Write memory [WIP]

+use nix::{sys::ptrace, unistd::Pid};+use std::{cmp, marker::PhantomData, mem, slice};++const WORD_SIZE: usize = mem::size_of::<usize>();++/// Allows to write data to different locations in debuggee's memory as a single operation.+/// This implementation can select different strategies for different memory pages.+pub struct WriteMemory<'a> {+    pid: Pid,+    write_ops: Vec<WriteOp>,+    _marker: PhantomData<&'a ()>,+}++impl<'a> WriteMemory<'a> {+    pub(super) fn new(pid: Pid) -> Self {+        WriteMemory {+            pid,+            write_ops: Vec::new(),+            _marker: PhantomData,+        }+    }++    pub fn write<T: ?Sized>(mut self, val: &'a T, remote_base: usize) -> Self {+        self.write_ops.push(WriteOp {+            remote_base,+            source_len: mem::size_of_val(val),+            source_ptr: val as *const T as *const libc::c_void,+        });+        self+    }++    /// Executes the memory write operation.+    pub unsafe fn apply(self) -> Result<(), Box<dyn std::error::Error>> {+        write_process_vm(self.pid, &self.write_ops)+    }+}++/// A single memory write operation.+#[derive(Debug, PartialEq, Eq)]+pub(crate) struct WriteOp {+    // Remote destation location.+    remote_base: usize,+    // Pointer to a source.+    source_ptr: *const libc::c_void,+    // Size of `source_ptr`.
    /// Remote destation location.
    remote_base: usize,
    /// Pointer to a source.
    source_ptr: *const libc::c_void,
    /// Size of `source_ptr`.

These show up when using --document-private-items.

nbaksalyar

comment created time in 5 days

issue commentrust-lang/rust

Make `pub` in a binary be equivalent to `pub(crate)`

Given that binaries can't be used in anything else

A dylib loaded by the binary could lookup the symbol using dlsym if it was #[no_mangle] I think.

jhpratt

comment created time in 5 days

Pull request review commentheadcrab-rs/headcrab

Add attach options

 mod example {                 if let Some(pid) = parts.next() {                     let pid = nix::unistd::Pid::from_raw(pid.parse()?);                     println!("Attaching to process {}", pid);-                    let (remote, status) = LinuxTarget::attach(pid)?;+                    let (remote, status) =+                        LinuxTarget::attach(pid, AttachOptions { kill_on_exit: true })?;

Can this be falss? gdb and lldb detach on exit when they haven't spawned the process themself.

JJendryka

comment created time in 5 days

issue commentphil-opp/blog_os

Slow initial memory allocation

Two questions: Are you compiling in release mode? And are you using hardware assisted virtualization? (eg KVM for qemu)

otisdog8

comment created time in 5 days

issue commentrust-analyzer/rust-analyzer

VSCode Ctrl + F5 (Run without debugging) and F5 (Start debugging)

You should be able to edit the keynapping in vscode.

bugproof

comment created time in 5 days

push eventbjorn3/rust

bjorn3

commit sha 4c7c8ceaf81f6eec7afae051a0466304493a2245

Remove println

view details

bjorn3

commit sha da603415aa79a4c74495d8c964d11b01d556cf5b

[WIP]

view details

push time in 5 days

CommitCommentEvent

Pull request review commentheadcrab-rs/headcrab

Correct behavior for reading memory on linux

 impl<'a> ReadMemory<'a> {         };          if bytes_read == -1 {-            // fixme: return a proper error type-            return Err(Box::new(nix::Error::last()));+            return Err(nix::Error::last());         } -        // fixme: check that it's an expected number of read bytes and account for partial reads+        Ok(bytes_read)+    }++    /// Splits readOps to those that read from read protected memory and those that do not.+    fn split_protected(+        &self,+        read_ops: &'a [ReadOp],+    ) -> Result<(Vec<&'a ReadOp>, Vec<&'a ReadOp>), Box<dyn std::error::Error>> {+        let maps = self.target.memory_maps()?;++        let protected_maps = maps+            .iter()+            .filter(|map| !map.is_readable)+            .collect::<Vec<_>>();++        let (protected, readable): (_, Vec<_>) = read_ops.iter().partition(|read_op| {+            protected_maps.iter().any(|map| {+                map.address.0 as usize <= read_op.remote_base+                    && read_op.remote_base < map.address.1 as usize+            })+        });++        Ok((protected, readable))+    } +    /// Allows to read from protected memory pages.+    /// This operation results in multiple system calls and is inefficient.
    /// This operation results in multiple system calls and as a result is inefficient.
JJendryka

comment created time in 5 days

Pull request review commentheadcrab-rs/headcrab

Correct behavior for reading memory on linux

 impl<'a> ReadMemory<'a> {         };          if bytes_read == -1 {-            // fixme: return a proper error type-            return Err(Box::new(nix::Error::last()));+            return Err(nix::Error::last());         } -        // fixme: check that it's an expected number of read bytes and account for partial reads+        Ok(bytes_read)+    }++    /// Splits readOps to those that read from read protected memory and those that do not.+    fn split_protected(+        &self,+        read_ops: &'a [ReadOp],+    ) -> Result<(Vec<&'a ReadOp>, Vec<&'a ReadOp>), Box<dyn std::error::Error>> {+        let maps = self.target.memory_maps()?;++        let protected_maps = maps+            .iter()+            .filter(|map| !map.is_readable)+            .collect::<Vec<_>>();++        let (protected, readable): (_, Vec<_>) = read_ops.iter().partition(|read_op| {+            protected_maps.iter().any(|map| {+                map.address.0 as usize <= read_op.remote_base+                    && read_op.remote_base < map.address.1 as usize+            })

A binary search would be faster.

JJendryka

comment created time in 5 days

Pull request review commentheadcrab-rs/headcrab

Correct behavior for reading memory on linux

 impl<'a> ReadMemory<'a> {     /// In case of doubt, wrap the type in [`mem::MaybeUninit`].     // todo: further document mem safety - e.g., what happens in the case of partial read     pub unsafe fn read<T>(mut self, val: &'a mut T, remote_base: usize) -> Self {-        self.read_ops.push(ReadOp {-            remote_base,-            len: mem::size_of::<T>(),-            local_ptr: val as *mut T as *mut libc::c_void,-        });+        self.read_ops.append(+            &mut ReadOp {+                remote_base,+                len: mem::size_of::<T>(),+                local_ptr: val as *mut T as *mut libc::c_void,+            }+            .split_on_page_boundary(),+        );          self     }      /// Executes the memory read operation.     pub fn apply(self) -> Result<(), Box<dyn std::error::Error>> {-        // Create a list of `IoVec`s and remote `IoVec`s-        let remote_iov = self+        let read_len = self             .read_ops             .iter()-            .map(ReadOp::as_remote_iovec)+            .fold(0, |sum, read_op| sum + read_op.len);++        if read_len > isize::MAX as usize {+            panic!("Read size too big");+        };++        // FIXME: Probably a better way to do this+        let result = self.read_process_vm(+            &self+                .read_ops+                .iter()+                .map(|read_op| read_op)+                .collect::<Vec<_>>(),+        );++        if result.is_err() && result.unwrap_err() == nix::Error::Sys(nix::errno::Errno::EFAULT)+            || result.is_ok() && result.unwrap() != read_len as isize+        {+            let (protected, readable) = self.split_protected(&self.read_ops)?;++            self.read_process_vm(&readable)?;+            self.read_ptrace(&protected)?;+        }+        Ok(())+    }++    /// Allows to read from several different locations with one system call.+    /// It will ignore pages that are not readable. Returns number of bytes read at granularity of ReadOps.
    /// It will error on pages that are not readable. Returns number of bytes read at granularity of ReadOps.
JJendryka

comment created time in 5 days

Pull request review commentheadcrab-rs/headcrab

Correct behavior for reading memory on linux

 impl ReadOp {             iov_len: self.len,         }     }++    /// Splits ReadOp so that each resulting ReadOp resides in only one memory page.+    fn split_on_page_boundary(&self) -> Vec<ReadOp> {+        let page_size: usize;+        unsafe {+            page_size = libc::sysconf(libc::_SC_PAGESIZE) as usize;+        }++        let mut out = Vec::new();++        // Number of bytes left to be read+        let mut left = self.len;++        let next_page_distance = page_size - ((page_size - 1) & self.remote_base);+        let to_next_read_op = std::cmp::min(left, next_page_distance);+        // Read from remote_base to the end or to the next page+        out.push(ReadOp {+            remote_base: self.remote_base,+            len: to_next_read_op,+            local_ptr: self.local_ptr,+        });+        left -= to_next_read_op;++        while left > 0 {+            if left < page_size {+                // Read from beginning of the page to a part in the middle (last read)+                out.push(ReadOp {+                    remote_base: self.remote_base + (self.len - left),+                    len: left,+                    local_ptr: (self.local_ptr as usize + (self.len - left)) as *mut libc::c_void,+                });+                break;+            } else {+                // Whole page is being read+                out.push(ReadOp {+                    remote_base: self.remote_base + (self.len - left),+                    len: page_size,+                    local_ptr: (self.local_ptr as usize + (self.len - left)) as *mut libc::c_void,+                });+                left -= page_size;+            }+        }+        out+    } }  /// Allows to read memory from different locations in debuggee's memory as a single operation.-/// On Linux, this will correspond to a single system call / context switch.
/// On Linux, this will most of the time correspond to a single context switch.
JJendryka

comment created time in 5 days

push eventbjorn3/rust

bjorn3

commit sha 5ea3680436e2399b94ddb59d7506347903f6ddab

[WIP]

view details

push time in 5 days

create barnchbjorn3/rust

branch : compile_rustc_wasm4

created branch time in 5 days

issue openedrust-lang/stacker

Linking failing when compiling for wasm32-wasi

error: linking with `rust-lld` failed: exit code: 1
  |
  = note: "rust-lld" "-flavor" "wasm" [...] "-l" "stacker" "-l" "psm_s"
  = note: rust-lld: error: unable to find library -lstacker
          rust-lld: error: unable to find library -lpsm_s

created time in 5 days

push eventbjorn3/rustc_codegen_cranelift

bjorn3

commit sha c5899526e4a6244ca200900e3f825c72e8ad5559

Update dependencies

view details

push time in 5 days

more