News for hackers. Stuff that matters.
Re:System memory allocator free operation zeroes out dealloc... by kergonath on Thursday September 22, 2022 @12:50PM (#32941492)
It’s easier when it is a specified value. Easier to see in a debugger and to diagnose. Sure, it can occasionally be interpreted as meaning something, but so can random gibberish. As long as everything is overwritten, there is no privacy issue.
Re:System memory allocator free operation zeroes out dealloc... by cesarb on Thursday September 22, 2022 @01:16PM (#32941854)
> Sure, it can occasionally be interpreted as meaning something, but so can random gibberish.

Some gibberish is better than others. For instance, on x86 (64-bit, 32-bit, or even 16-bit), filling with the 0xcc byte means that, if executed as code, it will trap (0xcc is the single-byte INT3 "single-step breakpoint" instruction). And for most Unix-style operating systems, which put the kernel in the high half of the address space, the filler bytes should have the high bit set, so that treating them as pointers will trap (the pointer will have its high bit set, pointing to kernel memory, which user space is forbidden from accessing).

Re:System memory allocator free operation zeroes out dealloc... by arcticbull on Thursday September 22, 2022 @02:36PM (#32942870)
Having a different pre-defined value for allocation vs deallocation scribble is nice because you can then tell if the error happened pre-initialization or post-free. $AA and $55 also weren't chosen by accident one assumes, $AA is 1010_1010 and $55 is 0101_0101. Consistent values help with reproduction.

The Linux setup where you can choose your own scribbles seems to meet your needs no?

Re:System memory allocator free operation zeroes out dealloc... by saagarjha on Thursday September 22, 2022 @02:45PM (#32942997)
> For instance, on x86 (64-bit, 32-bit, or even 16-bit), filling with the 0xcc byte means that, if executed as code, it will trap (0xcc is the single-byte INT3 "single-step breakpoint" instruction).

Trying to execute off the heap is going to trap anyways.

Re:System memory allocator free operation zeroes out dealloc... by wokkel on Thursday September 22, 2022 @01:58PM (#32942417)
Or just use valgrind.
Re:System memory allocator free operation zeroes out dealloc... by speedgoose on Thursday September 22, 2022 @02:17PM (#32942647)
Or just use a memory safer programming langage.
Re:System memory allocator free operation zeroes out dealloc... by bayindirh on Thursday September 22, 2022 @04:03PM (#32943927)
If your use case fits into capabilities of such language, and you have the necessary libraries, and bindings, etc., then why not?