How can I search the ubuntu source code?

If it's that specific, Google should be able to help you -- it has indexed tons of publicly available source code. I'd be very surprised if it didn't find something.

Failing that (or any other sort of web search), strings is a pretty handy little application. It reads all the strings out of a file, even if it's binary. I've been hacking around and you can use this to find a phrase anywhere on your computer. This version is looking for "bad" in /usr/bin

find /usr/bin -exec bash -c 'if [[ $(strings {} | grep -i bad) ]]; then echo "{}"; fi' \;

That's obviously a pretty hardcore way of doing things. But wait, there's more. You can find the package for each result as you go:

find /usr/bin -exec bash -c 'if [[ $(strings {} | grep -i bad) ]]; then dpkg -S "{}"; fi' \;

Now that's what I call awesome. Here's it in action, looking for "No such device"

oli@bert:/var/log$ find /usr/bin -exec bash -c 'if [[ $(strings {} | grep -i "No such device") ]]; then dpkg -S "{}"; fi' \;
handbrake-gtk: /usr/bin/ghb
usbutils: /usr/bin/usbhid-dump

There's an Ubuntu Code Search website that lets you search the source code of all packages in the Ubuntu repositories: http://ubuntu-codesearch.surgut.co.uk/

The above site appears to have been down for a while now. I'll try to get in contact with the maintainer.

Edit: I spoke to the maintainer, and this project isn't much of a priority at the moment. I'd recommend using the Debian Code Search instead, as we share a lot of packages/code with them: https://codesearch.debian.net/