Question
Question Consider the source code bellow where we have a main function that calles the function foo that takes two parameters. void foo(int x, int
Question
Consider the source code bellow where we have a main function that calles the function foo that takes two parameters. void foo(int x, int *y) { ... } int main() { ... int a; int b; /* Missing code that sets values to variables a and b */ foo(a,&b); ... } Assembly: foo: 0x0000000000400530 <+0>: push %rbp => 0x0000000000400531 <+1>: mov %rsp,%rbp A memory dump is generated when the %rip register is 0x0000000000400531 after the foo function has been called from main. Registers %rdi is 0x00000000000d354 and %rsi is 0x7fffffffffffe15C and the following stack dump is created with the gdb command x/136xb $rsp. 0x7fffffffffffe140: 0x60 0xe1 0xff 0xff 0xff 0x7f 0x00 0x00 0x7fffffffffffe148: 0x83 0x05 0x40 0x00 0x00 0x00 0x00 0x00 0x7fffffffffffe150: 0x40 0xe2 0xff 0xff 0xff 0x7f 0x00 0x00 0x7fffffffffffe158: 0x54 0xd3 0x00 0x00 0xf3 0x08 0x00 0x00 0x7fffffffffffe160: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7fffffffffffe168: 0x15 0xbb 0xa3 0xf7 0xff 0x7f 0x00 0x00 0x7fffffffffffe170: 0x00 0x00 0x00 0x00 0x20 0x00 0x00 0x00 0x7fffffffffffe178: 0x48 0xe2 0xff 0xff 0xff 0x7f 0x00 0x00 0x7fffffffffffe180: 0x00 0x00 0x00 0x00 0x01 0x00 0x00 0x00 0x7fffffffffffe188: 0x5c 0x05 0x40 0x00 0x00 0x00 0x00 0x00 0x7fffffffffffe190: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7fffffffffffe198: 0x26 0x9f 0x22 0x3a 0xac 0x47 0xc9 0x6a 0x7fffffffffffe1a0: 0x40 0x04 0x40 0x00 0x00 0x00 0x00 0x00 0x7fffffffffffe1a8: 0x40 0xe2 0xff 0xff 0xff 0x7f 0x00 0x00 0x7fffffffffffe1b0: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7fffffffffffe1b8: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7fffffffffffe1c0: 0x26 0x9f 0xc2 0xf8 0x53 0xb8 0x36 0x95 Before foo is called, the variables a and b are assigned values in main (hidden in the above code). Write your answer as hexadecimal numbers. Find the values of the saved rbp, the return address, and b by reading the above stack frame. Assume that bytes are in little-endian order.
saved rbp:
return address:
value of b:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started