1. A protection unit for preventing unauthorized access to at least part of a Last In-First Out memory, referred to as stack, the stack having memory addresses extending between a top address and a bottom address, the stack being accessible by a central processing unit, of a computer system, such as a central processor, CPU, for storing and removing at least one stack frame, the CPU being controllable by one main software program, the stack protection unit being operably coupleable to the stack and the CPU, the stack protection unit comprising: a first and a second address register each adapted to store an address of the stack; and, a processing unit such as a processor operably coupled to the first and second address registers; wherein, when the execution of the main software program is suspended by the CPU due to the execution of at least one subroutine of the main software program; the processing unit is adapted to set at least one access rule based on at least the first and second address registers, preventing: the ongoing subroutine from accessing at least a first hardware-protected region of the stack, the first hardware-protected region comprising at least one stack frame associated with a return address from which the main software program resumes execution after termination of the execution of the subroutine.