Skip to content
Advertisement

Tag: assembly

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

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

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

Advertisement