Q:

chmod 4755 (rwsr-xr-x) gives (rwxrwxrwx)

I want to get the permissions of a program, call_shellcode (which calls shellcode), to be set to -rwsr-xr-x. When I run: 
sudo chmod 4755 call_shellcode

the permissions for some reason is still set at -rwxrwxrwx

I am trying to get the root shell, but when I execute the program I get a normal shell. I am using Ubuntu 16.04 (32-bit) in VirtualBox

A:

You are running gcc as root for some strange reason, but then you run the chmod as your regular user. You don't have [permission to change the rights of call_shellcode since you compiled it as root, and therefore the permissions remain unchanged. 
Don't compile as root! Don't do anything as root unless you have to. 

