jbreitbart / criterion-perf-events Goto Github PK
View Code? Open in Web Editor NEWA plugin for Criterion.rs to measure Linux perf events.
License: Apache License 2.0
A plugin for Criterion.rs to measure Linux perf events.
License: Apache License 2.0
I think it should be possible because rustc is multithreaded and measures instruction counts for its benchmarks https://perf.rust-lang.org/?start=&end=&kind=raw&stat=instructions%3Au
Race Condition Enabling Link Following and Time-of-check Time-of-use (TOCTOU)
Details | |
---|---|
Package | remove_dir_all |
Version | 0.5.3 |
URL | XAMPPRocky/remove_dir_all@7247a8b |
Date | 2023-02-24 |
Patched versions | >=0.8.0 |
The remove_dir_all crate is a Rust library that offers additional features over the Rust
standard library fs::remove_dir_all function.
It was possible to trick a privileged process doing a recursive delete in an
attacker controlled directory into deleting privileged files, on all operating systems.
For instance, consider deleting a tree called 'etc' in a parent directory
called 'p'. Between calling remove_dir_all("a")
and remove_dir_all("a")
actually starting its work, the attacker can move 'p' to 'p-prime', and
replace 'p' with a symlink to '/'. Then the privileged process deletes 'p/etc'
which is actually /etc, and now your system is broken. There are some
mitigations for this exact scenario, such as CWD relative file lookup, but
they are not guaranteed - any code using absolute paths will not have that
protection in place.
The same attack could be performed at any point in the directory tree being
deleted: if 'a' contains a child directory called 'etc', attacking the
deletion by replacing 'a' with a link is possible.
The new code in this release mitigates the attack within the directory tree
being deleted by using file-handle relative operations: to open 'a/etc', the
path 'etc' relative to 'a' is opened, where 'a' is represented by a file
descriptor (Unix) or handle (Windows). With the exception of the entry points
into the directory deletion logic, this is robust against manipulation of the
directory hierarchy, and remove_dir_all will only delete files and directories
contained in the tree it is deleting.
The entry path however is a challenge - as described above, there are some
potential mitigations, but since using them must be done by the calling code,
it is hard to be confident about the security properties of the path based
interface.
The new extension trait RemoveDir
provides an interface where it is much
harder to get it wrong.
somedir.remove_dir_contents("name-of-child")
.
Callers can then make their own security evaluation about how to securely get
a directory handle. That is still not particularly obvious, and we're going to
follow up with a helper of some sort (probably in the fs_at
crate). Once
that is available, the path based entry points will get deprecated.
In the interim, processes that might run with elevated privileges should
figure out how to securely identify the directory they are going to delete, to
avoid the initial race. Pragmatically, other processes should be fine with the
path based entry points : this is the same interface std::fs::remove_dir_all
offers, and an unprivileged process running in an attacker controlled
directory can't do anything that the attacker can't already do.
See advisory page for additional details.
Criterion supports profiling as well. Can this crate be used for profiling with criterion?
This is an awesome crate. I love being able to see instruction counts/cpu cycles etc for benches.
It looks like some changes are needed for Criterion 0.4.x
error[E0277]: the trait bound `Perf: Measurement` is not satisfied
--> benches/my_bench.rs:31:18
|
31 | fn bench(c: &mut Criterion<Perf>) {
| ^^^^^^^^^^^^^^^ the trait `Measurement` is not implemented for `Perf`
|
= help: the trait `Measurement` is implemented for `WallTime`
note: required by a bound in `Criterion`
--> /home/c/.cargo/registry/src/github.com-1ecc6299db9ec823/criterion-0.4.0/src/lib.rs:340:25
|
340 | pub struct Criterion<M: Measurement = WallTime> {
| ^^^^^^^^^^^ required by this bound in `Criterion`
For more information about this error, try `rustc --explain E0277`.
error: could not compile `crit-perf` due to previous error
warning: build failed, waiting for other jobs to finish...
Error: 'cargo bench' returned an error (exit status: 101); unable to continue.
serde_cbor is unmaintained
Details | |
---|---|
Status | unmaintained |
Package | serde_cbor |
Version | 0.11.2 |
URL | https://github.com/pyfisch/cbor |
Date | 2021-08-15 |
The serde_cbor
crate is unmaintained. The author has archived the github repository.
Alternatives proposed by the author:
See advisory page for additional details.
Soundness issues in
raw-cpuid
Details | |
---|---|
Package | raw-cpuid |
Version | 8.1.2 |
URL | rustsec/advisory-db#614 |
Date | 2021-01-20 |
Patched versions | >=9.0.0 |
as_string()
methodsVendorInfo::as_string()
, SoCVendorBrand::as_string()
,
and ExtendedFunctionInfo::processor_brand_string()
construct byte slices
using std::slice::from_raw_parts()
, with data coming from
#[repr(Rust)]
structs. This is always undefined behavior.
See gz/rust-cpuid#40.
This flaw has been fixed in v9.0.0, by making the relevant structs
#[repr(C)]
.
native_cpuid::cpuid_count()
is unsoundnative_cpuid::cpuid_count()
exposes the unsafe __cpuid_count()
intrinsic
from core::arch::x86
or core::arch::x86_64
as a safe function, and uses
it internally, without checking the
safety requirement:
> The CPU the program is currently running on supports the function being
> called.
CPUID is available in most, but not all, x86/x86_64 environments. The crate
compiles only on these architectures, so others are unaffected.
This issue is mitigated by the fact that affected programs are expected
to crash deterministically every time.
See gz/rust-cpuid#41.
The flaw has been fixed in v9.0.0, by intentionally breaking compilation
when targetting SGX or 32-bit x86 without SSE. This covers all affected CPUs.
See advisory page for additional details.
tempdir
crate has been deprecated; usetempfile
instead
Details | |
---|---|
Status | unmaintained |
Package | tempdir |
Version | 0.3.7 |
URL | rust-lang-deprecated/tempdir#46 |
Date | 2018-02-13 |
The tempdir
crate has been deprecated
and the functionality is merged into tempfile
.
See advisory page for additional details.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.