I’ve used the following commands for cross-compilation on ubuntu to run simple.s but am getting an error The commands are: I tried to obtain the binary’s architecture by and my machine’s architecture by and found that they were different. I believe getting the right binary for the architecture will solve the problem. Is that true? Here is simple.s How can
Tag: assembly
what is segment 00 in my Linux executable program (64 bits)
Here is a very simple assembly program, just return 12 after executed. It can be built and executed correctly: But the size of a.out is big, it is more than 4k: I try to understand it by reading elf content: it is strange, segment 00 is aligned by 0x1000, I think it means such segment at least will occupy 4096
Clear input buffer Assembly x86 (NASM)
Edit: This is similar to this: Reset a string variable to print multitple user inputs in a loop (NASM Assembly). But it is not the same issue. From the other post, I was able to prevent additional characters from being printed. However, I still cannot prevent those additional characters from being read when the program goes back to the point
Running address of an application, followed by heap and stack expansions
I have an m.c: and an a.c: I compile and build these as: Then, I examine the executable, linux thus: objdump -drwxCS -Mintel linux The output of this on my Ubuntu 16.04.6 starts off with: start address 0x0000000000400540 then, later, is the init section: Finally, is the fini section: The program references the string Hello , world!n which is in
x86 NASM | Input in Loop working only the first and third time
I have a loop that runs succesfully 3 times, but the input I have in this loop works only the first time. I am new to assembly so pls have patience. Code: Output: Well, later I thought that the loop might not running a third time, so I changed the code a bit. New Code: New Output: Explaination: 0 is
assembly, how to use mprotect?
I am trying to make self modifying code in Linux. I thought it would works but didn’t. I used nasm on ubuntu 18.04. INT 0x80 return value is -22 0xffffffea I don’t know what is wrong. Answer Run your program under strace, like strace ./a.out to decode system call args and return values. Probably your base address isn’t page-aligned, or
Clang 11 and GCC 8 O2 Breaks Inline Assembly
I have a short snippet of code, with some inline assembly that prints argv[0] properly in O0, but does not print anything in O2 (when using Clang. GCC, on the other hand, prints the string stored in envp[0] when printing argv[0]). This problem is also restricted to only argv (the other two function parameters can be used as expected with
Why does the Linux Kernel copy implementation use the AC flag?
The implementation of copy_user_enhanced_fast_string in the Linux Kernel copy routine uses stac/clac in the epilog and prolog. perf annotate shows the following code: AC is “Alignment check (or access control) flag”. What is the reason stac/clac are used in the routine? What would be the consequences if we simply remove them? Answer Normally all page access checks are disabled in
What is the size in bits of a file descriptor in an x64 system running Ubuntu 19.10?
What is the size in bits of a file descriptor such as standard input and standard output, is it a 32-bit integer? Answer If you are talking about the actual file descriptors returned by (and used for) Linux syscalls, then take a look at the manpage for open etc. as @JonathanLeffler suggests. For instance: The return value of open() is
Loop Never Ends in Assembly?
Basically, I have below assembly code: I am trying to loop through 0-50 and print the variable pas or probably buf from input box. But this loop keeps printing pas endlessly. I Presume the issue is the re-assignment of ecx, but otherwise without putting my string into ecx how would I print it? or even execute any thing within my