Introduction: In the realm of computer security, the protection of software applications against various vulnerabilities and attacks is of paramount importance. One such crucial defense mechanism is the stack protection feature, often implemented through the use of a stack canary. This safeguard is especially prevalent in languages like C, where manual memory management can introduce… Continue reading Understanding Stack Canaries and Code Protection
Category: C
Volatile : Source code to assembly, Processor execution flow
In C programming, a volatile variable can change its value unexpectedly due to multiple threads, modification by an external device, or an external process. The tutorial analyzes and compares how the assembly output, compiled from C source code, differs based on the use of a volatile int variable and a non-volatile int variable. Volatile variables can affect compiler optimizations and are frequently used in embedded systems where the most current variable value is crucial. The choice to use volatile or not depends on the program's specific requirements and the expected behavior of the variables.
Pointer resources
Resources Pointers On C - Instructor’s Guidehttps://github.com/DragScorpio/Pointers-On-C-Solutionshttps://pdos.csail.mit.edu/6.828/2014/readings/pointers.pdfhttps://www.cs.yale.edu/homes/aspnes/pinewiki/C(2f)Pointers.htmlhttps://boredzo.org/pointers/
Structure Alignment
CPU accesses memory by a single memory word at a time. Depending processor architecture, a word size varies - 8, 16, 24, 32, or 64 bits. Special purpose processors, such as DSPs may use other sizes, ie. 9, 12, 18, 24, 26, 36, 39, 40, 48, and 60 bits.Memory is byte addressable and arranged sequentially.… Continue reading Structure Alignment
Oops ! Volatile
While translating source code to machine code, compiler applies various optimisations. Compiler cleans excess machine code to reduce executable size and increase speed of execution, saves memory, CPU cycle etc. if a variable needs to be changed from outside compiler should not apply optimisation, since an optimisation might not check the variable at all in… Continue reading Oops ! Volatile