flat assembler
Message board for the users of flat assembler.
![]() Goto page Previous 1, 2 |
Author |
|
Furs 02 Mar 2024, 18:48
I think .bss (and unreserved sections in general) is guaranteed to be zeros by the specs. It is in C at least.
|
|||
![]() |
|
revolution 02 Mar 2024, 18:59
Furs wrote: I think .bss (and unreserved sections in general) is guaranteed to be zeros by the specs. It is in C at least. If it relies upon the C startup code then it has no effect for fasm sources unless you link to the C library. The BSS section itself is not special (like I mentioned above). Only other code, like C et.al., try to make it special. The OS loader doesn't know about it, or care about it. It just loads what the exe tells it to. And if the OS isn't "modern and secure" then you are playing a game of chance to know if uninitialised sections are zeroed. Why play such a game? It is literally just a handful of instructions that run once at startup, to guarantee things are what you expect. |
|||
![]() |
|
Furs 03 Mar 2024, 15:54
revolution wrote:
I mean of course you can use this flag on any other section to turn it "special", but the point is, it does have a mechanism to ensure this. Zeroing it yourself sounds like extreme paranoia to me. Reminds me of people who save callee-saved registers "just to be sure" before every API call. There was another meme with someone checking same result again later "just in case it changed" (even though it was a stack variable, and likely even optimized out by the compiler). |
|||
![]() |
|
revolution 03 Mar 2024, 16:43
BSS is a name you can give to a section. It doesn't mean it automatically has various flags and whatnot associated with it.
But regardless, not all OSes honour all the flags. That is why I say you can't trust it. If the user runs the code in Win95 or DOS then it sucks to be them I guess. They should have been running the latest and greatest spying OS Win11, right? If ensuring it is zeroed is "extreme paranoia" then so what? It takes probably a few microseconds to make sure the code simply works without having to place arbitrary restrictions upon which OS the user is permitted to run. |
|||
![]() |
|
Goto page Previous 1, 2 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.