I’m trying to execute a shell with shellcode. I’ve made this code in a 64-bits machine: After using nasm and linking with ld if i execute the file this works fine. The problem is if i get the shellcode from this and tried to execute it with this program: It gives me a segmentation fault error. I can’t see what’s
Tag: x86-64
Why do write syscalls print `%` at end on linux x86_64 (nasm)?
The following hello-world program displays a % sign at the end of the printed string. Why is this and how can I remove it? Here is my program: And here is the output when I run the executable: hello, world!% Thanks in advance. Edit: It seems to be caused by zsh (not reproducible in bash). The question is why this
Segmentation fault in my Assembly implementation
I am new to assembly language programing, and here I am trying to call C standard library function puts from my assembly code, but I am continuously getting segmentaion fault. Please help; Operating system : LINUX 16.04 Assembler : nasm Machine : intel x86 – 64bit Answer to explain Comments More, start with x86 calling convention and your code. x86
Can I use 1G superpages to back shared mmaps?
So far when I’ve tried using a file in /mnt/hugepages1G/ as the backing I get segfaults. It works fine if I use 2M superpages in /mnt/hugepages/ I think I read somewhere that I now can’t find that Linux only supports 2M pages for Shared memory? But I can’t swear to it. Can’t find it in documentation. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/vm/hugetlbpage.txt?id=HEAD $ hugeadm –pool-list
Reading user input as an integer
I wrote an Assembly program (x86_64 Linux NASM) that prints an integer to console, based in the algorithm suggested my the comments in this post, which is basically this: All works just fine under the following script: After compiling it, the number 567 gets printed on the screen (console). But if I try to do the same but allowing the
GDB – Assembly program returns /bin/sh: 0: Can’t open �
I am presently learning 64-bit assembly language from the related Pentester Academy course. The code I’m working on creates the following error when ran in GDB: /bin/sh: 0: Can’t open � [Inferior 1 (process 4049) exited with code 0177] I have googled the error and exit code and haven’t found anything helpful. I tried analyzing the code in GDB over
Strange pointer position in the stack
I wrote this simple code: and I’ve disassembled it to see what the compiler does. Using objdump I obtain: I can understand everything except for the mov QWORD PTR [rbp-0x10],0x0, this correspond (I think)to p=NULL; but from mov QWORD PTR [rbp-0x8],rax I know that my pointer is on rbp-0x8 and it seems correct (the size of a pointer is 8bytes).
What is the difference between retq and ret?
Let’s consider the following program, which computes an unsigned square of the argument: This is properly compiled by as, but disassembles to Is there any difference between ret and retq? Answer In long (64-bit) mode, you return (ret) by popping a quadword address from the stack to %rip. In 32-bit mode, you return (ret) by popping a dword address from
What would be the disadvantage of creating an array of really big size on 64 bit systems?
Operating systems like Linux work on the principle of Copy-on-write, so even if you are allocating an array of say 100 GB, but only use upto 10GB, you would only be using 10 GB of memory. So, what would be the disadvantage of creating such a big array? I can see an advantage though, which is that you won’t have
push/pop segmentation fault in simple multiplication function
my teacher is doing a crash course in assembly with us, and I have no experience in it whatsoever. I am supposed to write a simple function that takes four variables and calculates (x+y)-(z+a) and then prints out the answer. I know it’s a simple problem, but after hours of research I am getting no where, any push in the