Masonry is primarily susceptible to two problems, cracking and efflorescence. See Repairing Masonry Cracks for a crack repair solution. To treat bubbling masonry use the process below.
Efflorescence is the white powdery substance that bubbles up on masonry surfaces like basement walls. It happens when moisture penetrates the surface causing the alkali salts in the portland cement to leaches out and deposit on the surface.
If moisture is a constant problem, that issue will have to be addressed before using this process for curing an efflorescence problem. Check downspouts and drains for the source of water damage. If the ground slopes in toward a wall, mound it up so water will run away from the building.
To remove alkali efflorescence from masonry, use a weak solution of muriatic acid and water. Be very careful with the acid, it is very corrosive and will burn everything, including skin. Even a minor splash of the acid solution can do damage so wear long sleeves, gloves and eye protection. Use a nylon bristled brush to scrub very gently to minimize splashing.
Rinse the acid from the surface using lots of clean water. Watch the run–off; soak it up with absorbent rags and wipe all surfaces down well to prevent the acid from damaging things like adjacent floors and vegetation. Most of the time this acid treatment will cure the efflorescence problem but if necessary, you may have to repeat the process a second time.
If you're going to deal with efflorescence on an interior surfaces where you don't want to use a dangerous acid, try using a strong vinegar solution in place of the muriatic acid. Boil a cup of vinegar down to a half cup. This will double the normal acid in the vinegar which may be effective on many minor efflorescence problems.
To paint the surface let the treated area dry well if you're using anything other than a latex based coating. Latex can go over a damp surface and in fact, the masonry should be a little damp to make painting easier and improve bonding. See Painting Masonry for more about applying coatings to masonry surfaces.