Search Results: "apollock"

25 June 2011

Andrew Pollock: [tech] On trying to find the resource limits of a running process on an old kernel

I had cause to try and get a core dump from a segfaulting process at work the other day, and I wanted to figure out if fiddling with /etc/security/limits.conf was going to do the trick (I didn't) or if I had to modify the initscript to include a ulimit -c unlimited call. Of course, on a modern system (>= 2.6.24), one would just take a look at /proc/PID/limits and get on with life, but unfortunately the system in question was running 2.6.18, so more fiddling around was required. I'd found something once before that told me how to do it with GDB, but all I could find this time around was a rather over-complicated Knol article, which made a bunch of assumptions (well mainly that the binary in question wasn't stripped). So with some help from the Knol article, I muddled through it. Disclaimer: I don't profess to be an expert on system internals like this, so if this eats your first-born, don't come crying to me. Firstly, you need to know that it's the getrlimit(2) system call that you want to be using, and then you need to figure out the number for the resource limit you want to retrieve. The man page for getrlimit(), tells you it's defined in /usr/include/sys/resource.h, but I've found that the actual useful bits end up being in /usr/include/bits/resource.h I wanted the resource limit for the maximum core dump size, which is RLIMIT_CORE and has a value of 4. Next, you need to know that the getrlimit() system call takes an integer and a pointer to an rlimit structure as arguments. We've just figured out the value for the integer, but we're also going to need to pass a pointer as the second parameter. A pointer to enough memory to hold an rlimit structure. Fortunately, the rlimit structure is pretty simple:
struct rlimit  
    rlim_t rlim_cur;  /* Soft limit */
    rlim_t rlim_max;  /* Hard limit (ceiling for rlim_cur) */
 ;
After a bit of grepping around in /usr/include, I determined that an rlim_t is essentially an unsigned long int, so we need to allocate a pointer big enough to hold two of them. Note that if we had an unstripped binary, we could have saved a lot of faffing around by just going
print sizeof(struct rlimit)
in GDB (assuming that the binary has the getrlimit symbol in it) The sure-fire way of figuring out how much memory we need for this pointer is to go
print sizeof(unsigned long int)
in GDB, and then double that (since we want two of them). On my system an unsigned long int is four bytes, so I'm going to want to allocate enough memory for 8 bytes. Now it's time to attach GDB to the offending process and see what the resource limit currently is. (gdb -p PID)
(gdb) print malloc(8)
$1 = 152186904
(gdb) print getrlimit(4, $1)
$2 = 0
(gdb) x/2xw $1
0x9123018:	0x00000000	0x7fffffff
(gdb) quit
So in this particular case, we've retrieved the soft and hard limits of the RLIMIT_CORE resource limit, and you can see that the soft limit is zero, and the hard limit is unlimited. Note that the getrlimit() function returns an integer as its return code, which is what the $2 = 0 is above. Now it's just a case of altering the the resource limits via the preferred mechanism, restarting the process and then repeating this GDB examination of the process to check they were changed successfully. Circumstances where this can all fall down would appear to be ones where the getrlimit symbol isn't present in the binary, or the binary is compiled as a position-independent executable. I'd think that in the latter case, the system is probably modern enough to be running a kernel that supports directly examining the resource limits via the /proc filesystem.

16 June 2011

Andrew Pollock: [life] The Afghan leopard gecko page on Wikipedia now has a photo

It was very much a team effort. My friend Brandon, who is an excellent photographer, came over and took some photos. Then my friend Sara, who is a bit of a Wikipedia contributor/edit/expert, showed me how to upload the photo to the Wikimedia Commons, and then it was just a case of gluing it all together by making the edit on the Wikipedia page. Then it was almost immediately deleted. It turns out that apparently the Creative Commons Attribution-NonCommercial-ShareAlike 2.0 Generic license (better known as CC BY-NC-SA 2.0) is somehow incompatible with Wikipedia & friends (I haven't figured out the exact ins and outs of why yet). I had to get Brandon to re-license the photo I used as just CC BY-SA 2.0 (basically ditching the non-commercial restriction). Then it magically reappeared (after some help from Sara with the response). Crikey, this Wikipedia contributing is tricky stuff. At least when Speck's owners get back to pick her up, I can tell them their gecko is famous.

9 June 2011

Andrew Pollock: [life] Gecko-sitting for the next 5 weeks

A random co-worker was looking for someone to look after her son's pet gecko for 5 weeks while they went to Hawaii, and I thought it'd be something fun and non-permanent to do, so we now have a female 1 year old Afghan leopard gecko named Speck, and a large supply of crickets in our possession. I note that the Wikipedia page is lacking a photograph. We might have to try and fix that...

8 June 2011

Andrew Pollock: [tech/security] I'd pay for an ISP service that excluded China

I say this after probably 48 hours of what I estimate is a sustained 60 kB/s of brute force SIP traffic from 61.146.178.173 has been sent my way. I'd very cheerfully sign up for a service that had all Chinese IP addresses null routed, and provided a proxy server for any HTTP access. I have no business needing direct IP connectivity to China, and I certainly do it not want it from China to me. I was pleasantly surprised to be able to call up Comcast's Business Class technical support tonight and ask them if they could null route the above IP address, and they seemed to imply they could (they opened up a ticket for a level 2 person to do something at least). Now if only I didn't have to pick up the phone to interact with Comcast's Business Class technical support, it'd be just lovely. I'm just glad I'm not in Australia where this would be blowing my monthly quota and/or causing me to receive excess usage charges. Bloody UDP. You can firewall it off, but it keeps coming. My initial stopgap Netfilter rule counted 1.5G of traffic before I replaced it with an adaptation of my SSH brute force mitigation rules, and the new rule has seen nearly 5G of traffic now. It's one thing to try to brute force something, but to keep trying after you stop getting responses is just plain stupid.

12 May 2011

Andrew Pollock: [life] Bike to Work Day 2011

Today was Bike to Work Day, and I biked to work, just like I do most other days. I missed out on it last year because I was still out on paternity leave at the time. That means I've almost been back at work a year. Since we only have one car, and when Zoe was little and sleeping a lot, it made most sense for me to start biking to work again. I'm really glad I did, because not only is it faster compared to the round trip time that Sarah would need to take to drop me off and pick me up, it's a lot easier on her and Zoe. It used to be a challenge for Sarah to get from home to work and back in the mornings without Zoe falling asleep in the car. The only times I've needed a lift have been in wet weather during winter, and when I've been sick. Now that we're out of winter, we should have endless sunshine for months, and it's starting to warm up, which makes biking so much more pleasant. It takes about 10-12 minutes door to door, which is short and sweet, and most of that is on the lovely Stevens Creek Trail. I'm glad I've been able to stick at it for the whole year. I see no reason to stop any time soon.

5 May 2011

Andrew Pollock: [life] Zoe at 12 months

I got in early this time and started working on this post a day early. Well, we've made it. We've all managed to survive parenting to the 1 year mark. Zoe continues to do fabulously. Today she had her 12 month paediatrician appointment, and weighed in at 19 pounds and 8 ounces (8.8 kg), which has brought her up from the 25th percentile for weight to around the 50th percentile. She's also up from the 25th to the 50th percentile for height. She got four shots today, which she was singularly unimpressed about even before she was jabbed. Somewhat surprisingly (to us) Zoe still isn't walking. She'll stand on her own if you distract her with something, but otherwise she'll fall down and prefers to crawl everywhere. She'll cruise around with the help of furniture, and she'll happily walk while pushing something. Go figure. I really thought she'd be walking into her 12 month appointment at the paediatrician. Developmentally, she's waving and pointing now. I'll usually get a wave goodbye out of her when I head out the door to work in the mornings. She seems to be picking up things pretty quickly now. One of her traits has been she'd always toss her sippy cup on the floor when she was done taking a drink from it. She's been doing this for months. In one sitting, I taught her to hold it out to me and say "ta!" instead, which is great, because now at mealtimes, I'm not picking up the sippy cup off the floor a dozen times. We had another trip back to Australia last month, and this one was purely vacation, so we had a nice couple of weeks of pottering around with family. Zoe again handled the flights very well, although the jet lag upon returning to the US seemed a lot worse than I remembered after our first trip. The pilot was pretty punchy with the seat belt sign on the way to Australia, so we had to keep taking Zoe out of the bassinet while she was asleep. Incredibly we were able to do this about four times before she woke up. She had a bit of a cold before we left for Australia, and that turned into a nasty cough, which was diagnosed as bronchitis the first week we were there. We got some antibiotics for her, and that cleared the cough up. She also had a couple of spontaneous vomiting incidents, which were out of character for her (but Sarah contracted some kind of tummy bug herself, so it wasn't entirely surprising). Despite these health issues, she was still in excellent spirits the whole time, and I think she thoroughly enjoyed herself. We went to Surfers Paradise for a couple of nights in the first week, and rented an apartment on the 23rd floor of the Chevron Renaissance, and pottered around the Gold Coast a little bit. We went down to Palm Beach, where we used to holiday every year when I was a kid, and caught up with my cousin who lives there, and Zoe had fun on the beach. That weekend, we held an early first birthday party for family and friends in a park and had a barbecue lunch. The following week we spent a few days on the Sunshine Coast, with some of Sarah's extended family, and pottered around on the beaches up there. Our flight back ended up being delayed 9 hours, but fortunately we found out before we got to the airport, so we had a nice, unexpected extra day in Brisbane. It also meant that we flew back for Zoe's night time sleeping time, which made for a pretty good flight (but made the jet lag worse for her once we got back). I wonder what the next year will bring us? At a guess, more teeth, talking and walking. Zoe at (almost) 12 months

13 February 2011

Andrew Pollock: [life] Zoe at nine months

(The requisite "I have no time any more, it's 10 days late") It certainly feels like 3 months has passed since I last reflected on her development. It feels like forever. As usual, we've managed to do a fair bit in 3 months. She's doing very well. Growing nicely. Still around the 25th percentile for weight, but now up to the 50th percentile for height. We just had to upgrade her from an infant car seat to a "big kid" car seat, because she was maxing it out on height, not weight. She seems to have handled the transition okay, but we haven't done any long car trips since making the change. She's now sitting really well, and pulling herself up into a standing position. She's cruising around on furniture a bit (and sporting various bruises to show for it). She started crawling at six and a half months, and now there's no stopping her. She's into everything. No more teeth have appeared yet. Her top teeth have been looking like they want to do something for ages. I think, given a recent uptick in fussiness, their appearance may be imminent. On the food front, she's eating all sorts of things. We've got a few infant/toddler cookbooks, so we still are predominantly feeding her either a combination of pureed fruits and vegetables, or a few pureed dishes that I've prepared (mainly vegetable stews or risotto). She also enjoys bread, toast and has taken to Vegemite on toast, like a good little Aussie. The other night we ate out at our local Italian restaurant, and she had some garlic bread and some penne pasta with marinara sauce. She's definitely enjoying finger food. We went back to Australia for a couple of weeks recently, and she handled the flights extremely well, and had an absolute ball back in Australia. She'd just started sleeping through the night a few times before we left for the trip, and didn't sleep as well while we were in Australia, but got back into the swing of things in under a week of getting back to the US. She's so much fun at this age. She laughs, she plays. She gets so excited when I get home from work in the evenings. I love her and being a Dad so much. Zoe at 9 months

1 February 2011

Andrew Pollock: [tech] Getting my IPv6 on

Somewhat motivated by Geoff Huston's keynote at linux.conf.au 2011, I've decided to pull my finger out and make a foray into IPv6. My colo provider, where daedalus.andrew.net.au lives is IPv6-enabled, so a quick email to their support department, and boom, thanks to the black magic of SLAAC, and daedalus has an IPv6 /64. I still don't quite understand how it works. Comcast Business, on the other hand, doesn't seem to be quite so on the ball, so I've organised for a Hurricane Electric IPv6 tunnel to play around with at home. Next, I need to throw around a few AAAA DNS records, and then probably watch everything grind to a halt.

30 December 2010

Andrew Pollock: [debian] "A fine example of shit code in any language"

I just discovered that I'd been hit by #409864 since upgrading to Lenny. A very unfortunate bug that one. I'm surprised it hasn't been fixed in a point release.

22 December 2010

Andrew Pollock: [tech] Find of the day: pianobar

Cube-mate and friend, Kynan, put me on to pianobar today. This thing is 100% sheer awesome. A console Pandora client! No longer do I have to find the browser tab that Pandora is running in to pause it, or to see what the hell it is I'm listening to. Nor do I need to worry about Flash crashing. It's also extensible in that it can call out to an external program for various events, such as starting a new song. This makes desktop notifications of what the hell you're listening to trivial. It'll also read commands from a named pipe, so at work, where I have this crazy Microsoft Natural Keyboard with all sorts of multimedia keys, I've set up evrouter (which isn't in Debian for some strange reason) so that I can pause, skip and like/dislike using my keyboard (regardless of what application I'm in). So I can just kick off pianobar in a terminal somewhere and forget about it. This is so cool. Interestingly, it also doesn't play any advertising, so I've finally pulled my finger out and paid for a Pandora One account. Overall, this makes for a fantastic desktop Pandora client. Now I just need to figure out why I get weird HTTP errors from it at home...

19 December 2010

Andrew Pollock: [life] Why Sarah's 30th birthday is a Big Deal

We had a small celebration with friends at our local Italian restaurant, Mario's Italiano today, to mark Sarah's 30th birthday. The reason this milestone is a big deal is because, to put it simply, two of her direct ancestors didn't make it to it. The undetermined genetic connective tissue disorder that Sarah has, claimed the lives of her father and paternal aunt when they were both in their twenties, suddenly and two weeks apart from each other. The case made the journal of the American College of Chest Physicians at the time. We're just very fortunate that with advances in medical diagnostic and surgical technology, Sarah was able to be diagnosed and have her aortic aneurysm repaired before it dissected. So there's the heart thing. That's a big deal. Then there's all the other crap that she's had to go through in only thirty years of life. She's had to endure more tragedies and medical challenges than some people have to go through in a lifetime. The fact that she's still such a happy, positive person is a testament to just what an amazing person she is, and it is an honour to be able to call her my wife. So happy birthday Sarah, here's to the next thirty years being a whole lot less eventful than the first thirty, and the last three in particular. Sarah and Zoe

17 December 2010

Andrew Pollock: [tech] Probable solution for Pandora 417 errors on Google TV

This has been bugging me ever since we got our Sony Internet TV, and I think I've finally figured out what's going on. Pandora hasn't been working on the Google TV ever since we got it, it just spits out Unexpected HTTP error occurred code: 417 while StartupAsyncTask and that's the end of that. I have vague recollections seeing this on my phone in the past also, but this doesn't appear to be the case any longer. My phone has version 1.5.2 on it, and the TV has 1.0, so I think I see the problem here. I took a full packet capture while starting up Pandora, and it was a lot more revealing. I could see that it was my Squid proxy (I transparently run all HTTP traffic through Squid) was barfing. That'd explain the errors I was seeing in Squid's cache.log
parseHttpRequest: Unsupported method ''
clientTryParseRequest: FD 153 (172.16.1.5:55001) Invalid Request
Looking at the headers of the HTTP request that the Pandora client is sending out, I see Expect: 100-Continue, and the text that accompanies a HTTP 417 error is "Expectation Failed", so I think this is the culprit. Searching for Expect: 100-Continue squid turns up information for an ignore_expect_100 directive, but this appears to only be available if Squid is compiled with --enable-http-violations, which the Debian Squid package doesn't appear to be compiled with. I may have to adjust my transparent proxying rules to not transparently proxy the TV, but this makes me a bit sad. Update I tried adding ignore_expect_100 on anyway, and Squid took it, and now Pandora isn't barfing. Yay!

5 December 2010

Andrew Pollock: [tech] If you're trying to use a USB serial adapter as your Linux kernel console...

The kernel needs to be compiled with CONFIG_USB_SERIAL_CONSOLE=y Debian kernels do not appear to be. Somewhat strangely, the config option doesn't even wind up in the config file in the typical commented-out manner, so you don't even know the option exists until you discover it from random Web searching, and then looking at drivers/usb/serial/Kconfig in the kernel source.

Andrew Pollock: [tech] A cleaner puppet manifest

Jon Downland is tinkering with Puppet, and wrote a class with a package resource to install a bunch of packages, but didn't quite like the way it was written. The way that I'd achieve the same thing, and be slightly cleaner would be something like this:
class jon-desktop  
	$packages_to_install_by_default = [
		'icedove',
		'git-core',
		'vim-gnome',
		'vinagre',
		'build-essential',
		'devscripts',
		'subversion',
		'git-buildpackage',
		'mutt',
		'offlineimap',
		'ascii',
		'gitk',
		'chromium-browser',
	]
	package   $packages_to_install_by_default:
		ensure => installed,
	 
 
This way your actual package resource definition never needs to change. The variable you choose to use to define the list of packages to install can be abstracted away as much as desired.

Andrew Pollock: [tech] And if only I'd read Planet Debian first...

Argh. So of course there's a difference between CONFIG_USB_SERIAL=y and CONFIG_USB_SERIAL=m, and that would explain the behavior I'm seeing. Thanks Ben Hutchings. I guess I'm recompiling my kernel again. Kill me now.

Andrew Pollock: [tech] If you're trying to use a USB serial adapter as your Linux kernel console, part 2

Seriously, the amount of yak shaving I'm doing these days... So I discover this CONFIG_USB_SERIAL_CONSOLE config option. I proceed to edit my .config, throw it in there and rebuild my kernel. (For the record, I hate building kernels). I'm about to reboot into said new kernel, and I thought I'd just double check the resulting config-2.3.36 file to check that CONFIG_USB_SERIAL_SERIAL did indeed get enabled. It's not there. I spend a few minutes WTFing, and assume I've been an idiot and should have run a make oldconfig or some such thing after hand-editing my .config file. So I try that. The additional line vanishes again afterwards. More WTFing ensues. I fire up make menuconfig, and go looking for the menu entry for the option. It's not there. The plot thickens. I hand-edit drivers/usb/serial/Kconfig and change depends on USB_SERIAL=y to just depends on USB_SERIAL, and rerun make menuconfig, and lo and behold, the option appears! So now I'm off rebuilding the kernel again. Sigh.

19 November 2010

Andrew Pollock: [tech] Finally decided to order something

Okay, I've finally settled on something. I decided to pass on the ASRock box. The price was just too high for my liking, and I've ordered a Zotac ZBOX HD-ID11. Yes, it's going to have a dirty proprietary NVIDIA graphics chipset. The interwebs tell me that it's the only one that will do H.264 decoding in hardware. I'm not sure I particularly care, for my application. It comes with DVI and HDMI, and a DVI-to-VGA dongle, so I should still be able to plug it into whatever floats my boat. What I did did just realise, about 15 minutes after I placed the order and was changing Zoe's diaper, was that I don't have a remote control solution now. The ASRock box included a remote control. I figure I can use one of the 6 USB ports and get some sort of USB infra-red adapter, and probably keep using the Hauppauge remote that came with my PVR-350 card. With the money I've saved buying the ZBOX, I've ordered a 40Gb Intel SSD, so that should make for a nice, no-moving-parts front end (assuming everything works). Everything should arrive before Thanksgiving, so I'll have a few days off work to tinker. Here's hoping I haven't bought a lemon.

18 November 2010

Andrew Pollock: [tech] Avoiding Pouslbo like the plague

I got a fair bit of feedback from my latest post about the Boxee Box, none of it particularly favourable about the GMA500/Poulsbo chipset, so regretfully, I won't be buying a Boxee Box. Too bad, it looked cute, and was cheap. A David H rdeman dropped me an email, and brought to my attention the ASRock Core 100HT-BD I was nearly going to buy the wrong thing off Amazon (there's also an NVIDIA ION-based variant), but I found a non-BluRay variant on NewEgg for about $100 less than the BluRay version. It's certainly more expensive than something like a Boxee Box, but hey, if it's going to work... I think if I had the choice, I'd get an SSD for it, but I can see how this goes with a rotating disk. The current MythTV box has a rotating disk in it (just not for storage of recorded content) and it seems sufficiently quiet. The other nice thing about this box is it has VGA and HDMI, so I can totally try this thing out on the current TV before replacing it. Now the question is, do I place an order today...?

17 November 2010

Andrew Pollock: [tech] More research into the Boxee Box

I received a few emails from my blog post about my MythTV dilemma. Suggestions ranged from using VGA to DVI to HDMI adapters, to getting different TVs that still have VGA connectors, to getting an older NVIDIA card off eBay that has lower power requirements. Firstly, VGA is dead. It's time to make the move. I don't think VGA for a TV the size I'm looking at is ideal for HD anyway. I'm pretty much fixated on the Sony TV as well, because I want to get Google TV. So I need HDMI. Similarly, I suspect that the picture quality of something run through a VGA to HDMI conversion will be similarly shite, so I'm not too keen on that option, although it would tide me over initially, so I'll look into that further. Another suggestion was the fit-PC2, which was something I was already aware of, but I'd heard terrible things about the general Linux support for the graphics adapter. I did some more research into the Boxee Box, (it really is new, it's only been out for 6 days) and it appears to have the same video chipset as the fit-PC2, which seems rather unfortunate. But then, if the Boxee Box is running Linux, then they've obviously got a driver, so the question is how easy is it to transplant this driver from the Boxee distro to, say, Debian? I'm curious enough to place an order soon. Anyone got any interesting Poulsbo-on-Linux war stories they want to share? I know it makes Matthew Garrett sad.

16 November 2010

Andrew Pollock: [tech] The knock-on effects of buying a new TV

I'm considering replacing our 5 year old 32" TV with a 40" Sony Internet TV, largely "just because" it has Google TV. That and I have spousal approval to get a new, bigger TV (it just has to be wall mounted). The dilemma is MythTV. It's currently still running on the Dell Dimension 3100 that I bought years ago, and connected via VGA to the TV. The Sony Internet TV is HDMI or nothing, so at the very least, I need to get a DVI-capable video card in my MythTV box. The more or less natural choice would be an NVIDIA card, despite them having a closed-source driver. At least it's well supported under Linux. The problem is, as far as I can determine, NVIDIA cards require at least a 300 watt power supply, and the Dimension 3100 has only a 230 watt power supply. So now I'm looking at having to replace the MythTV box. I'm currently running the front end and the back end on the same box, so it'd be a fairly simple case of splitting the back end from the front end, and just getting something new to be the front end. So now I'm in the market for something small, low-power, has a HDMI (or DisplayPort) interface, and enough grunt for HD playback. I'm wondering if the Boxee Box is the solution. Interface-wise, it has HDMI, so I'm good there, and I believe the marketing claims it can do HD playback. I just don't know how hackable it is. I think it's running Linux, so in theory this should be doable, so long as there isn't some weird hardware in it with a binary-only driver. For the price, it's probably worth just getting one to see. The annoying thing is, I have nothing in the house that is DVI or HDMI capable, so I have no way of testing this out prior to buying the TV.

Next.

Previous.