Here's something that people in Rocinha, and many of the other favelas of Brazil, have to get used to: kids with guns. These kids (photos provided by an anonymous favela resident) have handguns, but I saw many with assault weapons in my time in the favela.
So far as I know, there are only a handful of favelas in Rio de Janeiro that are not strongholds of the drug trade. Some escape because they are small and out of the way in the jungle. And one large favela, Rio das Pedras, has its own vigilante posse that is as well armed as the dealers and metes out justice with as much brutality. The word is, if you get caught dealing drugs (or doing other anti-social activities) in Rio das Pedras, the posse will kill you. Quite a deterrent.
To be fair, the drug gangs lodged themselves in the favelas because the government refused to provide services. With no cops to interfere with their activities, the dealers became entrenched. They are also communitarian and invest in good things for the residents, including recreational space for kids, child care facilities, and parties. They also help resolve community disputes. One dealer, the former chief of trafficking in favela Dona Marta, above the legal neighborhood of Botafogo, claimed that he was only seeking to raise enough money to create an alternate government in the favela to run things more democratically and securely for the residents. Of course, he continued dealing, was later arrested, and died in jail, I believe.
Also to be fair: the residents of the favelas find the dealers infinitely preferable to the cops. The cops are corrupt. They harass the residents. They believe they have the right to burst into people's houses and trample their freedoms in ways they never would in the legal world. The second day I was in Rocinha, my friend Paul and I were accosted by the cops as we left the favela. We spent 15 or 20 minutes with guns pressed into our stomachs until Paul convinced the cops we were not traffickers or buyers. Rocinha residents go through this kind of harassment with much more regularity.
It also appears that as much as the cops fight the dealers, the drug gangs have connections to the highest echelons of society. A police officer I know, who I will call Jorge, told me that when raided the favelas, he often found caches of brand new weapons that seem to have come straight from the military. He suggested that the real chieftains of drug trafficking in Brazil were well-regarded military and political leaders of the country.
Finally, remember this: that as compelling as these images and stories are, the vast majority of favela residents are good people who are trying to provide for their families. It has been estimated that just one percent of the people who live in the favelas are involved in the drug trade.