Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't find x86_popgm #3

Open
ehsmeng opened this issue May 14, 2018 · 2 comments
Open

Can't find x86_popgm #3

ehsmeng opened this issue May 14, 2018 · 2 comments

Comments

@ehsmeng
Copy link

ehsmeng commented May 14, 2018

Please consider...

chmod 755 x64_popgm x86_popgm x64_populate_gm x86_populate_gm

...and...

ehsmeng@dell7520:/mnt/torture/3pp/multiverse$ git diff x86_runtime.py
diff --git a/x86_runtime.py b/x86_runtime.py
index 28500d1..0d446b8 100644
--- a/x86_runtime.py
+++ b/x86_runtime.py
@@ -1,4 +1,6 @@
 from x86_assembler import _asm,asm
+import os
+import sys
 
 class X86Runtime(object):
   def __init__(self,context):
@@ -262,7 +264,7 @@ class X86Runtime(object):
     ret
     '''
     popgmbytes = asm(call_popgm%(self.context.global_sysinfo+4))
-    with open('x86_%s' % self.context.popgm) as f:
+    with open(os.path.dirname(os.path.realpath(sys.argv[0])) + os.sep + 'x86_%s' % self.context.popgm) as f:
       popgmbytes+=f.read()
     return popgmbytes

...due to...

...
self.context.global_sysinfo = self.context.global_lookup + self.context.popgm_offset + len(self.runtime.get_popgm_code())
File "/mnt/torture/3pp/multiverse/x86_runtime.py", line 266, in get_popgm_code
with open(os.getcwd() + os.sep + 'x86_%s' % self.context.popgm) as f:
IOError: [Errno 2] No such file or directory: '/home/ehsmeng/t/asm1/x86_popgm'

@ehsmeng
Copy link
Author

ehsmeng commented May 14, 2018

also

ehsmeng@dell7520:/mnt/torture/3pp/multiverse$ git diff multiverse.py
diff --git a/multiverse.py b/multiverse.py
index d3c1e7f..a0839a7 100755
--- a/multiverse.py
+++ b/multiverse.py
@@ -269,7 +269,7 @@ class Rewriter(object):
           if not self.context.write_so:
             self.context.stat['auxvecsize'] = len(mapper.runtime.get_auxvec_code(mapping[entry]))
             popgm = 'x86_popgm' if arch == 'x86' else 'x64_popgm' # TODO: if other architectures are added, this will need to be changed
-            with open(popgm) as f:
+            with open(os.path.dirname(os.path.realpath(sys.argv[0])) + os.sep + popgm) as f:
               tmp=f.read()
               self.context.stat['popgmsize'] = len(tmp)
             self.context.stat['globmapsectionsize'] = len(mapper.runtime.get_global_mapping_bytes())

@utds3lab
Copy link
Owner

You are correct that it should be possible to run Multiverse from any location. As it is currently written, Multiverse should be run from inside its directory because it is assumed that's what the current directory is. We should definitely fix this, although more changes need to be made than the ones listed (e.g., there is also a line to open popgm in x64_runtime.py).

It is not clear why we should change the permissions of the popgm files. They are generated when running the makefile, and they never need to be directly executed at all. The bytes from the text section of each populate_gm file are copied into the rewritten binaries, so there should not need to be any change in permissions as long as the same user who compiled Multiverse runs it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants