Do you mean a rock object, a mountain, a stones surface, something else? I'm not quite sure how to think about a solution without a bit more of a starting point of your problem.
I think you mean how would you make a cavern complex inside a rock structure, is this correct? I do have a decent solution to creating one that I had to work out for a project recently, it can be as complicated as you want and without too much work, I have lots of renders and animations travelling through a completely closed cavern complex but I can't share any of them here so, here's a quickie that I'm throwing together just now for a contest for fun, is this anything like what you're trying to do? It's quite dark but I hope it's light enough so that you can see that you can make never ending underground tunnels quite easily.
I'll get onto making a more complexed one shortly, I'm kind of limited in what I can do with this particular file due to contest rules but you can see the main tunnel close up and another smaller one branching off to the right, these can be followed forever or, until you hit a dead end, and can be entirely procedural.
[attachimg=#]
* EDIT: Replaced image with larger render. *