firebird icon indicating copy to clipboard operation
firebird copied to clipboard

Memory elimination

Open Logash opened this issue 9 years ago • 12 comments

Logash avatar Sep 02 '16 14:09 Logash

Why is the code so inconsistently formated?

It's full of things without spaces "if(" instead of "if (", or extra spaces "MoveFile( ... )" instead of "MoveFile(...)".

It's not even a different formating, it's even inconsistent with itself.

asfernandes avatar Sep 02 '16 14:09 asfernandes

Why do you explicitly turn off wipe for boot build?

AlexPeshkoff avatar Sep 02 '16 14:09 AlexPeshkoff

Does not work

Yes. Because it is never called.

aafemt avatar Sep 19 '16 09:09 aafemt

Why to ignore it?

aafemt avatar Sep 19 '16 09:09 aafemt

Because the value is read from the non-existent config.

Logash avatar Sep 19 '16 09:09 Logash

That's what default values for in config.cpp.

aafemt avatar Sep 19 '16 09:09 aafemt

Wipe of temporary files was done by rewind + write using a file descriptor before closing it. Because temporary files are created in Windows with the flag delete_on_close, and on POSIX unlink() called before closing the handle. Compressed temp files cannot be wiped. Rewind + write can not be used since after rewriting the compressed file its size will be changed and stored to other parts of the hard disk. Wipe of file through direct access to the disk will not work. Direct access to the disk has been limited starting with Windows Vista and Windows Server 2008. As a result, if the wipe of files is enabled the use of compressed temporary files are not allowed.

Logash avatar Nov 08 '16 12:11 Logash

Compressed temp files cannot be wiped. Rewind + write can not be used since after rewriting the compressed file its size will be changed and stored to other parts of the hard disk.

May I ask for a proof from MSDN?..

aafemt avatar Nov 08 '16 12:11 aafemt

At least here you can find description of the original problem. Encrypted and compressed files may consist of parts located in other places afer rewriting. https://technet.microsoft.com/en-gb/sysinternals/bb897443.aspx Starting with Vista+ MS prohibited such access. But we cannot find direct eplanation of it. The link has info about ability to run on Vista+ but the talk is exactly about Windows NT/2000's. We check and it seems that SDelete leave uncompressed files untouched. Probably it rewrites file parts but then override free'd space. I suggest to raise an exception for now in this case and make good comment. It could be improved later.

romansimakov avatar Nov 10 '16 12:11 romansimakov

Does it make sense to care about such ancient operating systems? (I'm sure that our posix builds will not run on OS from previous century.)

AlexPeshkoff avatar Nov 10 '16 12:11 AlexPeshkoff

I'd care about it if someone will really need it.

romansimakov avatar Nov 10 '16 12:11 romansimakov

Why is it looping to wipe byte by byte? This should be done by preallocating three "static" pages: the first filled with 0x00, the second with 0xFF, and the third with random values. Then, write or copy them as a whole.

livius2 avatar Feb 19 '25 20:02 livius2