Comments (2)
I don't know if this is actually reproducible in m1n1 proper (and cannot test it since I have no M1 devices), but given that the Rust code might be expanded to do some possibly nontrivial and security-critical stuff in the future, I guess it's best not to take chances.
from m1n1.
Pure Rust reproducer testcase (full repo):
#[global_allocator]
static GLOBAL: dlmalloc::DLMalloc = dlmalloc::DLMalloc;
#[repr(C, align(128))]
#[derive(Clone, Copy)]
struct Big([u8; 128]);
impl Default for Big {
fn default() -> Big {
Big([0; 128])
}
}
fn is_aligned<T>(t: *const T) -> bool {
let align = std::mem::align_of::<T>();
let ptr = t as usize;
ptr & (align - 1) == 0
}
fn main() {
let mut v: Vec<Big> = Vec::new();
println!(">> allocating vector");
// allocate aligned chunk
v.resize(4, Big::default());
println!(">> allocating vector = {:?}", v.as_slice().as_ptr());
if !is_aligned(v.as_slice().as_ptr()) {
panic!("error: vector is not aligned");
}
// allocate unrelated junk chunk
println!(">> allocating junk");
let _j = Box::new(Big::default());
// reallocate aligned chunk
println!(">> reallocating vector");
v.resize(8, Big::default());
println!(">> reallocating vector = {:?}", v.as_slice().as_ptr());
if !is_aligned(v.as_slice().as_ptr()) {
panic!("error: vector is not aligned after realloc");
}
}
from m1n1.
Related Issues (20)
- No display over HDMI-out on M2 Mac Mini (j473ap) HOT 9
- llvm is already installed but getting error in make on M1 mac HOT 1
- How is with gpu support for M2 Pro? HOT 1
- broken m1n1 on j473 HOT 3
- How to resize partition size back? HOT 5
- Bluetooth audio started breaking up after last upgrade. HOT 1
- Is there a way to pass Linux cmdline from m1n1? HOT 2
- [Bug] Wrong size of window content
- KDE Power Managment Issue HOT 1
- sleep mode battery improvement HOT 2
- macOS on M1 is available on GitHub Actions, so can CI builds happen there? HOT 1
- Freezing and crashing after plugging in a Nvme ssd
- (m2 mini) display fails to initialize on 3440x1440 monitor
- Allowed SSH server and mDNS by default
- Uboot env variable usb_ignorelist=0x1050:*, HOT 1
- Asahi linux cannot install
- m1n1 make: src/utils_asm.S:115:5: error: instruction requires: fp-armv8
- Error after installation
- Is it possible to set Macintosh as the primary startup option when booting? HOT 2
- How to make modified Linux distribution installation files compatible with Asahi Linux (Apple Silicon)? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from m1n1.