flat assembler
Message board for the users of flat assembler.
Index
> Compiler Internals > Suggestion: Save Virtual Block as File Goto page Previous 1, 2, 3 Next |
Author |
|
evk1 19 Jun 2014, 17:36
Quote:
Code: ../../../../../../../../etc/passwd _________________ Sorry for my English |
|||
19 Jun 2014, 17:36 |
|
Tomasz Grysztar 19 Jun 2014, 17:37
I think that in case of fasmw/fasmd this could be handled in a better way - in the window containing the compilation summary (including the DISPLAY data) they could present the list of generated "virtual files" and allow to save some or all of them into file system under the same names. For console version there would be only option to automatically convert all virtual files into a real ones upon finishing, or otherwise discard them.
shutdownall wrote: For security issues there can be allowed relative subdirectories from FASM path or source path only - no absolute path values like /etc/passwd. shutdownall wrote: And for the performance during multiple passes - I had the same issue when adding some features to FASM Z80 version with allowing forward references. I just waited till the last pass and then force one addition "final pass". Maybe that would be a good idea to wait till code is resolvable and than add one additional pass for things you only want to do one time per compilation. Lets call it final pass to distinct it from last pass. Anyway, the "virtual files" design I mentioned above would intrinsically avoid the problem of redundant file system accesses. shutdownall wrote: So I find it great and please Tomasz, go on for realisation. |
|||
19 Jun 2014, 17:37 |
|
l_inc 19 Jun 2014, 18:07
m3ntal
Quote: What's wrong with specifying a folder like \BINARY\ or ..\? "file" doesn't have this limitation. For security? Yes. Quote: How do you ensure the same security at runtime? I can't. For that reason I disallow myself to start non-trustworthy code. But at least a can try to compile it without any fears. So why adding an additional attack vector, and make even the compilation dangerous? The whole information security world tries to reduce the number of possible attack vectors, and you are suggesting the opposite. Quote:
You took the citation out of context. "Some scripting languages like shell or autohotkey", i.e. those intended to automate OS-wide and OS-level tasks. The fasm macro-language is meant to script the compilation process only. Tomasz Grysztar Quote: The behavior of this directive would not affect the output of assembly, hence the SSSO principle is irrelevant here It would. At least on the level of multiple successive compilations. A prescription for compiling a program could be: "Compile it two times in order to ..." . The output of the second compilation may depend on whether the command line allows the new store directive. Is there any advantage at all in allowing arbitrary destinations? I mean, why would you want to add this additional burden of risks estimation required to venture upon enabling the new store directive with a command line switch? Quote: unless the assembler wrote the contents of file early enough that it could affect some LOAD - but I think such behavior should be undefined and this kind of usage discouraged I don't see any reasons for that. Why? Quote: Probably the best option would to buffer all the data and write it at the same time when the DISPLAY buffer is flushed That is exactly what I suggested before. This way you avoid multiple overwriting of the same file not only across consecutive passes but also within a single pass. What is more important here is to discard the output on compilation failure as opposed to how the display directive works. _________________ Faith is a superposition of knowledge and fallacy |
|||
19 Jun 2014, 18:07 |
|
m3ntal 19 Jun 2014, 18:09
shutdownall:
Quote: No need for complicate checks. If write file fails - it's the users fault. Quote: Directories can be used in the same way as in the load file directive... no absolute path values (PS: This entire discussion reminds me of gun control arguments. You can't have a gun for protection because some insane kid might go kill random people. It's more like saying police officers can't even have guns. We are experienced programmers who know what to do. Just because some beginners might misuse it is no reason why we can't use it). |
|||
19 Jun 2014, 18:09 |
|
Tomasz Grysztar 19 Jun 2014, 18:19
l_inc wrote: It would. At least on the level of multiple successive compilations. A prescription for compiling a program could be: "Compile it two times in order to ..." . The output of the second compilation may depend on whether the command line allows the new store directive. Is there any advantage at all in allowing arbitrary destinations? I mean, why would you want to add this additional burden of risks estimation required to venture upon enabling the new store directive with a command line switch? l_inc wrote:
|
|||
19 Jun 2014, 18:19 |
|
Tomasz Grysztar 19 Jun 2014, 18:22
m3ntal wrote: shutdownall: |
|||
19 Jun 2014, 18:22 |
|
m3ntal 19 Jun 2014, 18:46
Mr. Inc:
Quote: The whole information security world tries to reduce the number of possible attack vectors, and you are suggesting the opposite. Source can contain hidden malicious code. Example: Is this a font or a virus? Code: font: db 11001100b, 1111000b, 10101010b, ... |
|||
19 Jun 2014, 18:46 |
|
l_inc 19 Jun 2014, 19:03
Tomasz Grysztar
Quote: When you use STORE to modify one of your sources, the "Same Source" part is no longer true. No, it is. You are missing that double compilation is viewed as a single combined operation. The original source is the same. But the output of the double compilation is different depending on whether the new store is allowed. Quote: The same reasoning could be applied to the case of fasm-script altering its own source file (like "format binary as 'asm'") It cannot. Because there is no command line switch to disallow compiling into its own source. Btw. I used that behaviour once in order to achieve register randomization. It was a miserable attempt though. Quote: Because this would limit possible implementations Why do you need multiple possible implementation possibilities if there's only one which is good? Quote: and it does not give any advantages that would be worth it It does actually. As soon as you do a store of an addressing space to a file, you can alter the addressing space, but still have a possibility to access its older saved state by accessing the file. Even if it only exists in memory (see my "redirection" suggestion above). _________________ Faith is a superposition of knowledge and fallacy |
|||
19 Jun 2014, 19:03 |
|
l_inc 19 Jun 2014, 19:06
m3ntal
Quote: Mr. Inc How do you think, what's the first letter of my nickname? Quote: How many *active* FASM users are there in the world? Do I understand it correctly that you purpose is to endanger the fasm users only? _________________ Faith is a superposition of knowledge and fallacy |
|||
19 Jun 2014, 19:06 |
|
m3ntal 19 Jun 2014, 19:21
l_inc: I can't remember whether it's 1, l or I. They use the same characters on my phone browser. No internet at home. Must go outside with phone.
Quote: Do I understand it correctly that you purpose is to endanger the fasm users only? |
|||
19 Jun 2014, 19:21 |
|
Tomasz Grysztar 19 Jun 2014, 19:26
l_inc wrote: Tomasz Grysztar l_inc wrote:
l_inc wrote:
l_inc wrote: It does actually. As soon as you do a store of an addressing space to a file, you can alter the addressing space, but still have a possibility to access its older saved state by accessing the file. Even if it only exists in memory (see my "redirection" suggestion above). |
|||
19 Jun 2014, 19:26 |
|
l_inc 19 Jun 2014, 20:56
Tomasz Grysztar
Quote: Is viewed by whom? By me in my argumentation. And I assume you use its context when answering. But actually you are right about the batch-like operation and the possibility to override the default output file name using the command line. Thus I think you can disregard this one. Quote: Well, the one that is good is actually the one that has no file writes during assembly at all. So if this behavior is to be defined exactly, it will be the other way round. It's not the other way around. It's the same way I was talking about from the beginning: store files in-memory until the compilation is successfully completed and redirect any file and include accesses to the memory during the compilation. I mean it's just an interface question, not an implementation one. Or is there any technical problem about creating a hash table of file names, that is checked before trying to access the file system? Btw. it seems, you agreed on the "file names only" limitation for the new directive, did you? Quote: Doing the same thing but through disk instead of memory seems ugly I think the ugliness here is determined solely by an inefficient implementation. From the interface point of view I store a file, because I want to store the file, and I access the file because I want the state of the file, when it was last stored, not the current state of the addressing space. A necessity to create an additional addressing space for that does not seem to be justified in any way. m3ntal Quote: Yes, by making dangerous suggestions like this You got the point. _________________ Faith is a superposition of knowledge and fallacy |
|||
19 Jun 2014, 20:56 |
|
Tomasz Grysztar 19 Jun 2014, 21:43
l_inc wrote: It's not the other way around. It's the same way I was talking about from the beginning: store files in-memory until the compilation is successfully completed and redirect any file and include accesses to the memory during the compilation. l_inc wrote: Or is there any technical problem about creating a hash table of file names, that is checked before trying to access the file system? l_inc wrote: Btw. it seems, you agreed on the "file names only" limitation for the new directive, did you? l_inc wrote:
|
|||
19 Jun 2014, 21:43 |
|
l_inc 19 Jun 2014, 22:23
Tomasz Grysztar
Quote: the files in file system (as used by LOAD/INCLUDE) would never be modified during the assembly Any advantages of this definition with respect the opposite one? An obvious disadvantage is in the last paragraph of this post. Quote: The "virtual files" created by STORE AS would proceed to be written into file system after the compilation is finished, and potentially under a different names than the ones specified in source Don't you think, that load or include should be able to access the virtual files at least between compilations? If you do, how do you plan to provide this possibility to these directives? Quote: fasm might not be able to determine whether the path given to LOAD directive leads to the same file that it has buffered in memory Hence the question above. Quote: Creating a file for a temporary storage when the same thing could be done safely within memory appears ugly to me I think you are incorrectly sticking to the files as persistent storage only, even though you defined the "virtual files" as something that is even not necessarily stored (when using the IDE). The file abstraction is very often used for many things such as memory mappings, pipes, devices etc. If you consider this and extend your "virtual files" abstraction just a tiny step forward, it might not appear ugly to you anymore. But I actually meant something different. Once again, "I store a file, because I want to store the file", not because I want some temporary storage. And after that (by a magic coincidence) I want to access the state of the addressing space when the file was stored. So why would you want to force me to create an additional copy of that addressing space, if I already have it in the form of the "virtual file"? _________________ Faith is a superposition of knowledge and fallacy |
|||
19 Jun 2014, 22:23 |
|
Tomasz Grysztar 19 Jun 2014, 22:51
l_inc wrote: Don't you think, that load or include should be able to access the virtual files at least between compilations? If you do, how do you plan to provide this possibility to these directives? l_inc wrote: I think you are incorrectly sticking to the files as persistent storage only l_inc wrote: But I actually meant something different. Once again, "I store a file, because I want to store the file", not because I want some temporary storage. And after that (by a magic coincidence) I want to access the state of the addressing space when the file was stored. So why would you want to force me to create an additional copy of that addressing space, if I already have it in the form of the "virtual file" PS In my post above I wrote about LOAD/INCLUDE, when I did actually mean FILE. LOAD is no longer able to access files (this feature was removed in fasm 1.52), and INCLUDE is handled by preprocessor, long before the assembler module is started. |
|||
19 Jun 2014, 22:51 |
|
l_inc 19 Jun 2014, 23:16
Tomasz Grysztar
Quote: What do you mean by "between compilations"? I mean running the console fasm version with identical command line arguments twice without involving any additional tools. I mentioned two use cases for the new store directive before: build number incrementation and code randomization. For these use cases it's important that the file or the include directive accesses the same file stored by the new store directive during the previous compilation. If you invalidate these and similar use cases, then what's the whole topic about? Quote: Treating files this way is one of the assumptions of fasm's OS abstraction layer Not after you defined "virtual files" as something that may or may not become the persistent storage file, right? Quote: I do not want to deal with things that apply only to select OS designs My comments are about the design of new abstractions you define and involve while designing the new feature of fasm. The mentioned OS abstractions are just for the purpose of comparison. Quote: It is like wanting to access the contents of DISPLAY buffer because it contains some data you need and maintaining another copy seems wasteful The probability of needing access to the display buffer is too low. There are no real use cases I can think of. However the "virtual file" output is very likely to become a source file for subsequent compilations. That is why the suggestion to be able to access the file within the same compilation seems to me very natural. _________________ Faith is a superposition of knowledge and fallacy |
|||
19 Jun 2014, 23:16 |
|
revolution 19 Jun 2014, 23:40
I wonder how this would affect fasm as DLL?
|
|||
19 Jun 2014, 23:40 |
|
Tomasz Grysztar 20 Jun 2014, 00:06
l_inc wrote: Tomasz Grysztar l_inc wrote: Not after you defined "virtual files" as something that may or may not become the persistent storage file, right? |
|||
20 Jun 2014, 00:06 |
|
Tomasz Grysztar 20 Jun 2014, 00:10
revolution wrote: I wonder how this would affect fasm as DLL? |
|||
20 Jun 2014, 00:10 |
|
Goto page Previous 1, 2, 3 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.