text stringlengths 0 2.35k |
|---|
[1492.88 --> 1498.56] loaded there. So I'm going to describe two things that you mentioned. Tell me how you think if it's |
[1498.56 --> 1503.36] good, if it's bad, how it is compared to other languages, just as an interesting kind of point. |
[1503.36 --> 1508.40] It can get too deep, so we'll try to keep it at a slightly higher level for everybody who's out of, |
[1508.40 --> 1514.40] of, was kind of hearing about this and not very well familiar. So for example, you mentioned that |
[1514.40 --> 1519.52] keeping to the next instruction lands you in another place in the code of the CPU instruction. |
[1519.52 --> 1524.08] Yeah, exactly. So this is something that was super surprising to me, which is when I reverse |
[1524.08 --> 1528.88] engineer a program. So you can look at it statically in IDA Pro, which means you display the instructions |
[1528.88 --> 1533.92] and you read them like a book. Or there's another approach, which is not like opposite, but maybe more |
[1533.92 --> 1539.04] like a complement to it, which is to look at the program inside the debugger. You know, debugger, |
[1539.04 --> 1542.56] they just work exactly the same as in the software development world. Like you execute the code |
[1542.56 --> 1546.56] instruction by instruction or line by line, and you can see the state of the various variables. |
[1546.56 --> 1550.88] Except for us, you know, we don't have the source code, so it's not lines of code, it's just assembly |
[1550.88 --> 1556.40] instructions. But we can still watch them execute one by one, and we can see the CPU registers getting |
[1556.40 --> 1560.56] updated, etc. And when I was doing this with the Go programs, it turned out that I was very surprised to see that |
[1560.56 --> 1566.48] sometimes I would step from one instruction to the next and I would end up at a totally random place |
[1566.48 --> 1571.52] somewhere else in the program. And eventually, like by doing some Google searches, etc., I figured out |
[1571.52 --> 1576.80] that it is actually the... I don't know if it's the Go scheduler that is involved in there, probably it is, |
[1576.80 --> 1581.76] but there is a garbage collector that is in charge of, you know, freeing the variables that are not |
[1581.76 --> 1587.12] used anymore. And sometimes it takes priority and starts, you know, freeing stuff. And then once it's |
[1587.12 --> 1592.00] done running, it takes you back where you were in the program. And so this is something that is super |
[1592.00 --> 1596.48] jarring for us as reverse engineers, because we are looking at a very specific place in the program. |
[1596.48 --> 1601.76] We are frowning, looking very concentrated and focused, because we are looking super serious. |
[1601.76 --> 1606.80] And then we press F7, F7, we step into the next instruction. Suddenly we end up somewhere totally |
[1606.80 --> 1610.64] different, even though we didn't see any jump instruction. And suddenly it's like, oh, something |
[1610.64 --> 1615.52] is going on. What's happening with my program there? Because it's not supposed to just go somewhere else. |
[1615.52 --> 1620.24] Now, once I was able to figure out what was going on and understand that I just have to get out of |
[1620.24 --> 1624.96] this garbage collector function, and it will take me back exactly where I used to be, and things were |
[1624.96 --> 1631.28] fine. But initially, it was another one of Go's Indiosyncrasies that felt super alien to me, and |
[1631.28 --> 1636.32] that, like, I wasn't happy about at first. So that means it's not something, behavior that you see often |
[1636.32 --> 1642.00] in other languages? Oh, no, it's something I had never seen before. I know that other languages, they do have |
[1642.00 --> 1645.92] their own garbage collectors. But when it comes to Java, we don't really have to look at the |
[1645.92 --> 1652.40] instructions, because Java is compiled to bytecode. So we just read the code disassembled, or decompiled |
[1652.40 --> 1658.08] maybe, and get access to something that looks like the source code. It may be obfuscated, which means that |
[1658.08 --> 1663.52] it will be modified in a way that the variable names are not there anymore, or it has been specifically |
[1663.52 --> 1668.56] engineered to be harder to read. But in that case, or for .NET or for Java, we just never have to worry about |
[1668.56 --> 1673.92] CPU instructions, because they are not that relevant to the language. So Go was, for me, |
[1673.92 --> 1678.08] a big surprise on that level, because this was the first time I had to encounter debugging a program |
[1678.08 --> 1684.24] and being taken far away somewhere without even asking to. And you know, it kind of happens on a |
[1684.24 --> 1689.04] regular basis, too. And then one more question about another behavior that was peculiar that you |
[1689.04 --> 1694.24] pointed out, that at some point, when you had two following instructions, and they were using the same |
[1694.24 --> 1698.32] variable, you didn't see the return, but because it was right, the one after or before. |
[1698.56 --> 1703.92] I'm not sure exactly if I remember exactly the part that you referred to, but what I noticed is, |
[1703.92 --> 1709.04] yeah, this might be one of the other ways that the compiler in Go is being very smart, which is that |
[1709.04 --> 1714.08] if you have chained function calls, it turns out, I think that the way that arguments from one |
[1714.08 --> 1719.20] functions are returned on the stack happened to be the exact place where they would be considered |
[1719.20 --> 1725.12] as arguments for the next function. So you don't really see the data moving back and forth from the |
[1725.12 --> 1729.04] functions. It's just, you know, you have chained calls and the compiler knows that whatever was |
[1729.04 --> 1734.24] returned happens to be at the right place for the next one, etc. So one of these other things that we |
[1734.24 --> 1739.92] are used to seeing, like we see a function call, we look at the input, we look at what goes in and what |
[1739.92 --> 1744.48] goes out, basically. This helps us understand what is going on. And with Go, sometimes you just don't see |
[1744.48 --> 1749.36] that because it's hidden from you. Like the complexity tends to be, well, the complexity is |
[1749.36 --> 1755.28] still there, but you know, all these operations are masked by the way that the stack is constructed by |
[1755.28 --> 1759.84] the Go compiler, which again is a super good thing for Go programmers, because it means that you don't |
[1759.84 --> 1764.64] have those memory movements that are taking place in the program that are actually not that useful. |
[1764.64 --> 1770.24] And every time you have a movement that involves the memory in a program, it takes a lot of time. I |
[1770.24 --> 1777.76] mean, not a lot compared to our human existence. But if you look at how a CPU works, you have the |
[1777.76 --> 1782.48] CPU that has some memory regions inside of it, which are called the registers. And then you have the RAM |
[1782.48 --> 1787.52] as well. You know, when you allocate memory in C program with a malloc or C alloc, it goes into the RAM. |
[1787.52 --> 1793.20] Or when you move something into the stack, it's also a region of memory that is on the inside the RAM, |
[1793.20 --> 1797.44] you know, the RAM stick of the computer. Every time the CPU has to talk to the RAM sticks, |
[1798.00 --> 1802.40] it has to be an electrical signal that goes from the CPU through a bus to the motherboard. And the |
[1802.40 --> 1807.84] motherboard understands that it has to request the specific region of data to the RAM sticks. And |
[1807.84 --> 1812.96] you know, you have to have the response that goes back the same way, converted into electrical signals. |
[1812.96 --> 1818.72] So it's pretty fast, of course, when it comes to, it's probably in the ballpark of microseconds or |
[1818.72 --> 1826.16] milliseconds. But compared to just the CPU talking to itself, or moving stuff inside of the physical |
[1826.16 --> 1829.84] area that is the CPU, or just not moving things at all, because they are already in the right place, |
[1829.84 --> 1834.48] then you get performance increases that I think are pretty significant, especially considering the |
[1834.48 --> 1838.00] amount of function calls that you have in the program. It's very interesting to hear about this |
[1838.00 --> 1841.12] from the perspective of somebody who's kind of poking this out from the outside. |
[1841.12 --> 1846.40] No, this makes me want to dive more into the reverse engineering just to learn more about the internals. |
[1857.68 --> 1863.52] Hey friends, this episode is brought to you by my friends and potentially your friends too at |
[1863.52 --> 1868.88] Firehydrant. And I'm here with Robert Ross, founder and CEO of Firehydrant. And Robert, |
[1868.88 --> 1874.56] there are several options out there for incident management, but what is it that makes Firehydrant |
[1874.56 --> 1879.36] different? The reason that we think that Firehydrant is is on to something is because we're |
[1879.36 --> 1885.36] meeting companies really where they are. We face the same problems that every company in the industry |
[1885.36 --> 1891.28] that is building and releasing software is also facing. So where you want people to be able to sign |
[1891.28 --> 1897.60] up for Firehydrant and immediately be able to kick off an incident using the best practices that we've |
[1897.60 --> 1902.40] built and we've experienced and have gathered through the other amazing customers that use our tool. |
[1902.40 --> 1908.00] It really is a very quick time to value. And we want people to have a long jump from where they are |
[1908.00 --> 1910.88] to where they want to be in incident management. |
[1910.88 --> 1916.96] I love it. Thank you, Robert. Small teams up to 10 people can get started for free with all Firehydrant |
[1916.96 --> 1921.28] features included. There's no credit card required to sign up. They are making it too easy to get |
[1921.28 --> 1927.04] started. So check them out at firehydrant.com. Again, firehydrant.com. |
[1927.04 --> 1956.00] So let's maybe move to a bit of a higher level now. Ghost community is kind of big on consistency. |
[1956.00 --> 1960.40] You know, we have like the linters that keep everything consistent. Go format keeps everything |
[1960.40 --> 1965.68] consistent. Does that actually help with reverse engineering at all? You think just the the only |
[1965.68 --> 1971.12] one way to do thing and or at the level that you're doing reverse engineering if you think it doesn't |
[1971.12 --> 1976.32] matter? It's a good question. I have to say I don't know that much about the linter itself. I have |
[1976.32 --> 1981.76] written a bit of C code myself when I was trying to like look at assembly code and write Go at the same |
[1981.76 --> 1985.68] time that would generate the same thing. So this is my extent of the experience with the language and I |
[1985.68 --> 1991.36] really noticed something which is that the Go language is super strict. I have in the past used |
[1991.36 --> 1996.40] the expression, maybe I think to make you laugh, I was saying you know that in Go if you don't use |
[1996.40 --> 2001.44] the return values that the program is complaining. If you have unused variables then the program |
[2001.44 --> 2006.88] complains again, right? And I was saying that to me Go feels a bit like fascist Python. Like it doesn't |
[2006.88 --> 2011.04] let you do anything that you want except you know if it follows the rules very strictly. |
[2011.04 --> 2018.40] For us it doesn't matter too much in the sense that those checks are enforced at the compiler level, |
[2018.40 --> 2022.80] right? It's something that if the code is not compliant then you will not get a binary at the |
[2022.80 --> 2028.96] end. So it does not add additional stuff inside the binary and also if there were some variable |
[2028.96 --> 2033.76] that is unused inside the program then as you reverse engineers we would not care, right? Because we |
[2033.76 --> 2038.72] would just consider that you know it's not used anymore or probably the programmer doesn't need it for |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.