Skip to content
New issue

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

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

Already on GitHub? # to your account

find a way to fix bug in arm64 #48

Open
NotmebutWind opened this issue Dec 17, 2024 · 1 comment
Open

find a way to fix bug in arm64 #48

NotmebutWind opened this issue Dec 17, 2024 · 1 comment

Comments

@NotmebutWind
Copy link

NotmebutWind commented Dec 17, 2024

here is my change for taintgrind

--- a/tnt_translate.c
+++ b/tnt_translate.c
@@ -5527,7 +5527,8 @@ IRExpr* zwidenToHostWord ( MCEnv* mce, IRAtom* vatom )
          case Ity_I8:
             return assignNew('V', mce, tyH, unop(Iop_8Uto32, vatom));
          case Ity_I1:
-            return assignNew('V', mce, tyH, unop(Iop_1Uto32, vatom));
+            return assignNew('V', mce, Ity_I32, unop(Iop_64to32,
+                   assignNew('V', mce, tyH, unop(Iop_1Uto64, vatom))));
          default:
             goto unhandled;
       }
@@ -5545,8 +5546,7 @@ IRExpr* zwidenToHostWord ( MCEnv* mce, IRAtom* vatom )
             return assignNew('V', mce, tyH, unop(Iop_32Uto64,
                    assignNew('V', mce, Ity_I32, unop(Iop_8Uto32, vatom))));
          case Ity_I1:
-            return assignNew('V', mce, tyH, unop(Iop_32Uto64,
-                   assignNew('V', mce, Ity_I32, unop(Iop_1Uto32, vatom))));
+            return assignNew('V', mce, tyH, unop(Iop_1Uto64, vatom)));
          default:
             goto unhandled;
       }
@@ -5578,7 +5578,8 @@ IRExpr* zwidenToHostWordC ( MCEnv* mce, IRAtom* atom )
          case Ity_I8:
             return assignNew('C', mce, tyH, unop(Iop_8Uto32, atom));
          case Ity_I1:
-            return assignNew('C', mce, tyH, unop(Iop_1Uto32, atom));
+            return assignNew('C', mce, Ity_I32, unop(Iop_64to32, 
+            assignNew('C', mce, tyH, unop(Iop_1Uto64, atom))));
          default:
             goto unhandled;
       }
@@ -5596,8 +5597,7 @@ IRExpr* zwidenToHostWordC ( MCEnv* mce, IRAtom* atom )
             return assignNew('C', mce, tyH, unop(Iop_32Uto64,
                    assignNew('C', mce, Ity_I32, unop(Iop_8Uto32, atom))));
          case Ity_I1:
-            return assignNew('C', mce, tyH, unop(Iop_32Uto64,
-                   assignNew('C', mce, Ity_I32, unop(Iop_1Uto32, atom))));
+            return assignNew('C', mce, tyH, unop(Iop_1Uto64, atom)));
          default:
             goto unhandled;
}

because I found it cannot run correct in arm64 for this:

img_v3_02hi_90beb1e9-2072-4b51-96cd-78b32fea3bcg

I check valgrind's code and found in valgrind , Iop_1Uto32 is not in arm64 only in arm. I changed the code than taintgrind can run correct. so Maybe you decide if this is a correct patch for taintgrind.

@wmkhoo
Copy link
Owner

wmkhoo commented Dec 26, 2024

Thanks for the bug report.
Since tnt_translate.c is based on mc_translate.c, looking at mc_translate.c I see that the case for Ity_I1 got removed altogether.

Could you try to remove it and see if it that solves your problem?

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

No branches or pull requests

2 participants