x86

Summing 8-bit integers in __m512i with AVX intrinsics

喜夏-厌秋 提交于 2021-02-15 07:40:34
问题 AVX512 provide us with intrinsics to sum all cells in a __mm512 vector. However, some of their counterparts are missing: there is no _mm512_reduce_add_epi8 , yet. _mm512_reduce_add_ps //horizontal sum of 16 floats _mm512_reduce_add_pd //horizontal sum of 8 doubles _mm512_reduce_add_epi32 //horizontal sum of 16 32-bit integers _mm512_reduce_add_epi64 //horizontal sum of 8 64-bit integers Basically, I need to implement MAGIC in the following snippet. __m512i all_ones = _mm512_set1_epi16(1);

NASM Segmentation fault when modifying a variable that should be in the read-write .data section (section .data doesn't work without a space?)

余生长醉 提交于 2021-02-15 07:40:23
问题 I'm having an issue with a program I'm writing in NASM using SASM, I'm using a variable as a counter and once I modified it and try to to save the new value at the used address in memory I get a segmentation fault. Here are the bits of code concerning the variable: section.data p_count DW 0 section.text global CMAIN CMAIN: mov ebp, esp; for correct debugging mov bx, [p_count] inc bx mov [p_count], bx ret The program stops running when it arrives at the last line here. Anyone has an idea what

Summing 8-bit integers in __m512i with AVX intrinsics

浪尽此生 提交于 2021-02-15 07:40:20
问题 AVX512 provide us with intrinsics to sum all cells in a __mm512 vector. However, some of their counterparts are missing: there is no _mm512_reduce_add_epi8 , yet. _mm512_reduce_add_ps //horizontal sum of 16 floats _mm512_reduce_add_pd //horizontal sum of 8 doubles _mm512_reduce_add_epi32 //horizontal sum of 16 32-bit integers _mm512_reduce_add_epi64 //horizontal sum of 8 64-bit integers Basically, I need to implement MAGIC in the following snippet. __m512i all_ones = _mm512_set1_epi16(1);

Confused by [ebp-0xc] instead of [ebp-4] in Art of Exploitation example

回眸只為那壹抹淺笑 提交于 2021-02-15 06:32:53
问题 I am reading the book Hacking: The Art of Exploitation , 2nd Edition and in the simple C program #include <stdio.h> int main() { int i; for (i = 0; i < 10; i++) { puts("Hello, world!\n"); } return 0; } The book lists that the gdb debug will modify the ebp register first: (gdb) x/i $eip 0x8048384 <main+16>: mov DWORD PTR [ebp-4],0x0 As it explains that This assembly instruction will move the value of 0 into memory located at the address stored in the EBP register, minus 4. This is where the C

Confused by [ebp-0xc] instead of [ebp-4] in Art of Exploitation example

隐身守侯 提交于 2021-02-15 06:31:44
问题 I am reading the book Hacking: The Art of Exploitation , 2nd Edition and in the simple C program #include <stdio.h> int main() { int i; for (i = 0; i < 10; i++) { puts("Hello, world!\n"); } return 0; } The book lists that the gdb debug will modify the ebp register first: (gdb) x/i $eip 0x8048384 <main+16>: mov DWORD PTR [ebp-4],0x0 As it explains that This assembly instruction will move the value of 0 into memory located at the address stored in the EBP register, minus 4. This is where the C

Segfault when writing to string allocated by db [assembly]

。_饼干妹妹 提交于 2021-02-15 05:28:51
问题 I'm following a basic shell-spawning exploit example. Below is exactly what my book tells me to write, yet I still get a segfault. When running this in gdb, I get a segfault at "mov byte [esi + 7], al". This line is necessary so that I can put a null byte at the end of my string "/bin/sh". When I flipped it around to "mov byte al, [esi + 7]", this did not cause a segfault. I'm assuming that I do not have write permissions to the place in memory where my string is stored. It seems I only have

Segfault when writing to string allocated by db [assembly]

戏子无情 提交于 2021-02-15 05:28:35
问题 I'm following a basic shell-spawning exploit example. Below is exactly what my book tells me to write, yet I still get a segfault. When running this in gdb, I get a segfault at "mov byte [esi + 7], al". This line is necessary so that I can put a null byte at the end of my string "/bin/sh". When I flipped it around to "mov byte al, [esi + 7]", this did not cause a segfault. I'm assuming that I do not have write permissions to the place in memory where my string is stored. It seems I only have

How to remove all punctuation and spaces in a string?

二次信任 提交于 2021-02-13 16:35:14
问题 I have input like this: This is, ,,, *&% a ::; demo + String. +Need to**@!/// format:::::!!! this.` Output Required: ThisisademoStringNeedtoformatthis I have to do this without using str_trim. Edit: I am writing an encryption program. I have to remove all punctuation from the string and turn all lower case letters to uppercase before I encrypt it. I added the code. I need to remove the spaces, or any punctuation before I turn it to upper case. So far I haven't found anything in my book that

Why is mov turing complete?

回眸只為那壹抹淺笑 提交于 2021-02-13 11:41:48
问题 I found this recently: https://github.com/xoreaxeaxeax/movfuscator It seems to be contingent on the fact that mov is turing-complete. Is that true, and why? 回答1: Yes, x86's mov is Turing complete. I added that tag to your question because it may not be true for other ISAs with an instruction called mov , and the movfuscator compiler only targets x86. It's not "mov" itself doing computation , it's x86 addressing modes which can do addition (and bit-shift). I haven't looked in detail at how it

Why is mov turing complete?

北城余情 提交于 2021-02-13 11:41:27
问题 I found this recently: https://github.com/xoreaxeaxeax/movfuscator It seems to be contingent on the fact that mov is turing-complete. Is that true, and why? 回答1: Yes, x86's mov is Turing complete. I added that tag to your question because it may not be true for other ISAs with an instruction called mov , and the movfuscator compiler only targets x86. It's not "mov" itself doing computation , it's x86 addressing modes which can do addition (and bit-shift). I haven't looked in detail at how it