## A debugger walk through an out of module call on AIX

We were seeing the following powerpc instruction sequence mess up, ending up
with the CTR (counter) register containing zero. The CTR register, which can
be used for computed gotos and other stuff, is one of the only registers that I believe can be
both loaded and branched to easily on powerpc, and is one of the volatile
regisers in the ABI (one that doesn’t have to be spilled to and from the stack
before another call).

0x090000000A9E8B78 : E8040000 ld r0,0(r4)
0x090000000A9E8B7C : 7C0903A6 mtctr r0
0x090000000A9E8B80 : E8440008 ld r2,8(r4)
0x090000000A9E8B84 : 4E800421 bctrl # 20,bit0


I had a recollection that this sequence was a call through a function pointer,
but thought it may also be what we get for a plain old out of module call
(calling something in a shared library from the main text segment or a call to some other shared
library function from a shared library function). Let’s see what an out of module looks like, for a simple call like

#include <stdio.h>

int main(int argc, char ** argv)
{
printf( "out of module call\n" ) ;

return 0;
}


I set an instruction breakpoint at the bl (branch and link) instruction for
printf, and then step into that

(dbx) stopi at 0x100000788
[1] stopi at 0x100000788 (main+0x28)
(dbx) c
[1] stopped in main at 0x100000788
0x100000788 (main+0x28) 48000059 bl 0x1000007e0 (printf)
(dbx) stepi
0x1000007e0 (printf) e98200d8 ld r12,0xd8(r2)
(dbx)


Observe that the debugger is letting us know that we aren’t actually in printf
yet, but are in the glue code for printf. Looking at the instruction sequence
for this glue code we see that it matches the type of code we saw in out NULL
CTR trap sequence above

stopped in glink64.printf at 0x1000007e4
0x1000007e4 (printf+0x4) f8410028 std r2,0x28(r1)
(dbx)

0x1000007e8 (printf+0x8) e80c0000 ld r0,0x0(r12)
(dbx)

0x1000007ec (printf+0xc) e84c0008 ld r2,0x8(r12)
(dbx)

0x1000007f0 (printf+0x10) 7c0903a6 mtctr r0


load a new value into GR0 to copy to the CTR register, and load the TOC
register (GR2) for the module that we are calling.

Now if we look at what just got put in the TOC register, we see that it’s the
address that we find the actual code for printf at

(dbx) p $r0 0x0900000000004f80 (dbx) listi 0x0900000000004f80 0x900000000004f80 (printf) fbe1fff8 std r31,-8(r1) 0x900000000004f84 (printf+0x4) fbc1fff0 std r30,-16(r1) 0x900000000004f88 (printf+0x8) 7c0802a6 mflr r0 0x900000000004f8c (printf+0xc) fba1ffe8 std r29,-24(r1) 0x900000000004f90 (printf+0x10) ebe20dd0 ld r31,0xdd0(r2) 0x900000000004f94 (printf+0x14) f8010010 std r0,0x10(r1) 0x900000000004f98 (printf+0x18) 8002000c lwz r0,0xc(r2) 0x900000000004f9c (printf+0x1c) f821ff71 stdu r1,-144(r1) 0x900000000004fa0 (printf+0x20) 60000000 ori r0,r0,0x0 0x900000000004fa4 (printf+0x24) 2c000000 cmpi cr0,0x0,r0,0x0  The glue code, a branch table for out of module calls, gets us to there, but we have to pay a number of instruction penalty for this call, in addition to the normal function call overhead. What does this mean for the trap scenerio? One implication is that this isn’t neccessarily as simple as a NULL function pointer. That instruction sequence is probably different (but I don’t recall exactly how at the moment). Perhaps this means that the jump table for the currently exectuting shared library got corrupted? It is probably writable since the run time loader must be able to modify it. I’d guess that it remains writable throughout execution to support lazy runtime loader address fixups. This is likely not going to be an easy problem to solve. ## Apple Bonjour service shutting down my computer? August 7, 2014 Incoherent ramblings No comments , , , I’ve been running the armory bitcoin client, which has a very cpu and network intensive initial setup. Two days in a row I attempted to let it run overnight, only to find my computer shutdown in the morning (with errors about improper shutdown on boot). In both cases, the very last thing that I see in my system event log are timeouts for the Bonjour service. Last night, the last stuff in the log before shutdown was: and the night before: I’m wondering if anybody else has seen similar unexpected shutdown occur. I’m wondering if Bonjour is raising some sort of abort that manages to shutdown my system? ## I can’t stomach the facebook feeds of my Israeli friends As a child I was indoctrinated as a Scientologist (which I essentially gave up for Science), and don’t have any traditional religious affiliations to color my view on the world. In particular, I do not have a Christian bias, I do not have a Jewish bias, and do not have a Muslim bias. I have friends in all these groups. I do have biases though. I admit to, largely due to my father’s influence, having an anarchist and anti-government bias. I think that he arrived at this position as a reaction to having been ejected from his homeland after the Russian and German governments alternately burning, pillaging, and raped their way through Estonia. I do not consider the Israeli-Palestinian conflict to be a religious conflict, but one imposed by decisions that have been made by governments. Governments imposed a social structure on a geography that should never have been there in the first place. The Israeli situation is one that is supported by governments. For example, it seems clear to me that the US government does not want to stop this conflict. If they did, then they could stop arming one side, providing three billion dollars a year of “military aid” to the Israeli government. You cannot give people that many weapons, and expect them to act peacefully. Even calling this “aid” is disgusting to me. This is corporate welfare for US arms dealers, funding them at the expense of the US taxpayer … but that is a different rant. I have a number of friends from IBM that have migrated to Israel for reasons (presumably religious, but perhaps social) that I don’t think I will ever understand. Now that they are there, I don’t expect any of them to be able to look at the situation objectively. Now that the Israeli government is so thoroughly attacking the Palestinian people, I no longer see baby pictures on their social media feeds, but all the typical propaganda of a country that is attacking another, so desperately attempting to provide themselves with justification of the actions that are being taken by their government. It is painful to see this kind of bias, especially from people that I know to be incredibly intelligent. While I haven’t “unfriended” any of these people, I admit to having systematically unfollowed them on facebook, one after another as they push views that are so one sided they were painful to observe. I found this deliberate unfollowing emotionally painful to do, but less painful than seeing them blindly towing their government’s party line and less painful then observing their refusal to see any of the historical context that generated this situation in the first place. I don’t know how I would behave if I were living in Israel. How would I behave when the bomb sirens start screaming? How would I behave when I was fearing for the lives of my kids? I don’t know that I would be able to look at things objectively. I’d like to believe that I could, but could I fight the social pressures that support what seems like an irrational worldview from the outside? Perhaps I am deluding myself. As an outsider, I find it easy to accept the description of the militarized wall around the Palestinian people in Gaza as the boundary of an open air prison. Periodic attack of these people with population pressure and bulldozers, sophisticated bombs, tanks and heavily armed soldiers is not consistent with what can easily be described as self defense. I think it is counterproductive to label your enemies terrorists. All warfare should be labelled terrorism. What is known as terrorism is a created phenomena, and does not happen without it being a reaction to other events. Hamas may be shooting their homemade rockets into Israel now, but this is an action that is in response to decades of oppression, enforced isolation, and a reaction to have been forced out of their homes and other violence. As an outsider the Israeli government appears to be supporting systematic ethnic cleaning. It is hard to see it any other way. I’d like to understand the reasons that my now-Israeli friends had for going there in the first place. How does it make any sense to impose even more population pressure on a situation that was already dire? How can you, in the name of a religion, support a such a militaristic government? If you were locked in Gaza with no hope, very little access to food and water and basic requirements for survival, if you had seen your friends pushed out of their homes with bulldozers and armed soldiers time and time again, if you saw your hospitals and universities and your power plants bombed, if you saw your kids with portions brains blown out by the fire of overzealous young soldiers armed to the teeth, how would you respond? Would you try to oppose the incursion? Would you also react with violence? I think that only Israel can stop this conflict. They are the ones in the position of power with all the options at their disposal. If the Israeli people could be brave enough to put down their arms, to stop accepting military aid, to tear down the wall, stop the embargoes, stop the active propaganda warfare that fuels the conflict, and most importantly, to look objectively at the actions they have made that created this situation, then there could be peace. Reacting with aggressive military force can only make the situation worse. ## Just Energy settlement with Ontario Energy Board If you happen to have been unfortunate enough to have natural gas billing with ‘Just Energy’ then you may know about what I would describe as their extortion like cancellation policies. I’ve written of this in my old blog http://peeterjoot.wordpress.com/2010/12/23/just-energy-canada-nasty-business-practices/ http://peeterjoot.wordpress.com/2011/01/04/just-energy-contract-complaints-going-nowhere/ http://peeterjoot.wordpress.com/2010/12/30/1693/ http://peeterjoot.wordpress.com/2011/04/29/just-energy-cancellation-finally/ The short story is that they wanted to charge me about$450 because I had moved without renewing a policy with them that I did not know I had in my name.  I had been fairly certain that I was paying more with them than I would have with the gas company distribution service, and had thought I had let the service expire.  They renewed it without my knowledge and sent no papers to confirm the renewal.

Their first method of contact for the fees they expected was through a legal like notice from a collections agency, which I felt to be a scare tactic.

I’ve detailed lots more about that unfortunate transaction, including how I got them to back off by both registering a complaint with the the provincial regulatory agency (Ontario Energy Board) and by contacting Toronto press providing details about this.  They actually contacted the Ontario Energy Board, and blatantly lied to them with a statement that they had settled with me, so that my complaint would be dropped.

Shortly after my cancellation interaction with them, new Ontario Energy Board regulations went into place to help protect new customers.  Existing customers weren’t protected, and had to go through the complaint and appeals process as I did.  It appears that the story did not end with the 2011 regulations, and I got the following “settlement” letter from Just Energy not that long ago.  Check out this rather pathetic attempt at spin:

This PR person tries to make it appear that their massive discharge fees weren’t policy, but were just an unfortunate mistake.  Unbelievable!

It seems like the Ontario Energy Board subsequently proceeded with a class action suit against them, since I recently got an unexpected check in the mail, via the gas company, with an account number that must have been the account from my previous house.

The purpose of this blog post is to inform anybody else that had gas distribution via Just Energy prior to 2011 that such a settlement has been reached.  If you have moved and perhaps no longer have a mailing address that allows you to receive correspondence from them (or the gas company they charged through), then you may have not only a rebate waiting for you, but can perhaps also get your cancellation fees refunded entirely (if you paid it, as I expect many people that were threatened by the legal letter would have).

## A CAD bitcoin purchase from an exchange.

I’d wanted to have some bitcoin for a while to experiment with, and recently made my first bitcoin purchase at the decentral bitcoin ATM.  However, at 5% exchange rate difference compared to an exchange (they use cavirtex as the exchange rate reference), the effective transaction fees are rather steep.  While it was an easy way to do things, especially for somebody with no concrete experience with bitcoin, it definitely looked like it was worth setting up an exchange account.

I recall looking into cavirtex, and didn’t like the look of the fees they had, so kept looking.  I found another Canadian exchange, www.quadrigacx.com (note: this is a referral link, which would give me a credit if you try out their service and make any purchases), and tried it out.  Like cavirtex, you have to provide anti-money-laundering information to fund the account (drivers license, utility bill with address, photo of you with your drivers license, and phone number).  They were very fast with the verification (within a couple of hours).  However, once my account was verified for funding, I had trouble actually funding it.  It turns out that their system currently doesn’t support the chrome browser (or didn’t for me).  I tried with firefox and was able to fund it using an online interac transaction.

I wanted to see what sort of fees I’d be hit with for a fund, purchase, transfer out cycle.  This was:

• Initial funding with $51 CAD. Neither Scotiabank, nor quadriga appeared to charge me any fees for this. • A bitcoin purchase of 0.07500000 XBT for$48.80.  Quadriga did have a transaction fee for this (in bitcoin, 0.000375 XBT).
• A transfer out of my remaining bitcoin (0.07462500 XBT) to a blockchain.info wallet.  That transaction had a bitcoin transaction fee of 0.0001.  I’m not sure if quadriga or blockchain added that fee.

So, the total fees for this end to end transaction (fund, buy, bitcoin transfer) were 0.000475 XBT (BTC), a total of about 31 cents CAD at 598 CAD/XBT.  Not too bad, and definitely better than the ATM fees.

Quadriga’s website can use some UI improvements.  The transaction logs hides under account details and you can see that when you click your name, but I didn’t find that at all intuitive (after suggesting it to them as a future improvement they told me where to find it in the UI).  Their buy widget also doesn’t have an intuitive way to specify the funds amount in fiat currency.  Instead you have to specify the amount in XBT, and once you do that it shows you what that converts to in the fiat currency.  Slightly clumsy, but functional.