flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > [solved] possible bug in fasm : mov rax,[GS: 0x30]

Author
Thread Post new topic Reply to topic
seppe



Joined: 12 Apr 2015
Posts: 15
Location: Belgian in Tenerife
seppe 08 May 2024, 18:04
fasm 1.73.04

The source code "mov rax,[GS:0x30]" generates 65 48 8B 05 28 F0 BF FF,

but it should generate 65 48 8B 05 30 00 00 00.

A bug or my mistake?

Seppe

_________________
Greetings from Seppe
Post 08 May 2024, 18:04
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20141
Location: In your JS exploiting you and your system
revolution 08 May 2024, 18:27
I don't see what you see.
Code:
~ cat test.asm 
use64
mov rax,[GS:0x30]

~ fasm test.asm
flat assembler  version 1.73.31  (16384 kilobytes memory)
1 passes, 8 bytes.

~ hd test.bin
00000000  65 67 48 a1 30 00 00 00                           |egH.0...|
00000008

~ disasm test.bin
00000000  656748A130000000  mov rax,[gs:0x30]    
Post 08 May 2024, 18:27
View user's profile Send private message Visit poster's website Reply with quote
seppe



Joined: 12 Apr 2015
Posts: 15
Location: Belgian in Tenerife
seppe 10 May 2024, 09:33
fasm source:

format PE64 GUI 4.0
entry start
section '.text' code readable executable
start: mov rax,[GS:0x30]


2 passes 1024 bytes

Disassemble using CFF explorer:

401000 65 48 8B 05 28 F0 BF FF mov rax, gs:[rip-0x400fd8]

Note: looks like all FS and GS operations are wrongly generated in PE64 files.

Seppe
Post 10 May 2024, 09:33
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20141
Location: In your JS exploiting you and your system
revolution 10 May 2024, 09:50
I still don't see what you see.
Code:
~ cat test.asm 
format PE64 GUI 4.0
entry start
section '.text' code readable executable
start: 
        mov     rax,[GS:0x30]
        mov     rax,[GS:dword 0x30]
        mov     rax,[GS:qword 0x30]
        db      0x65,0x48,0x8B,5,0x30,0,0,0

~ fasm test.asm
flat assembler  version 1.73.31  (16384 kilobytes memory)
2 passes, 1024 bytes.

~ disasm test.exe
;...
00000200  656748A130000000  mov rax,[gs:0x30]
00000208  656748A130000000  mov rax,[gs:0x30]
00000210  6548A13000000000  mov rax,[gs:qword 0x30]
         -000000
0000021B  65488B0530000000  mov rax,[rel gs:0x253]
;...

~    
.
Post 10 May 2024, 09:50
View user's profile Send private message Visit poster's website Reply with quote
seppe



Joined: 12 Apr 2015
Posts: 15
Location: Belgian in Tenerife
seppe 10 May 2024, 09:57
The problem is gone in the newer fasm version 1.73.31.
Can you please remove or close this topic?

Seppe

_________________
Greetings from Seppe
Post 10 May 2024, 09:57
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.