All chimneys need to have a metal flashing installed around them. This helps guide water away from this possible entry point into the house. Over time, the flashing cracks or tears. This is something that should be inspected whenever you're having general repairs done on your roof or if you notice any leaks in the ceilings of your home. If the flashing is cracked, it needs to be replaced.
There is a serious cause for concern if a crack exists between a masonry chimney and the roof of the house. If the mortar of a chimney of this type starts to give way it can start to lean over. Eventually, the crack will grow and the chimney could break free due to the lack of support, especially if subjected to storm conditions. A professional mason should inspect the chimney and decide how best to repair it.
Any water or snow that blows up against a chimney is going to drain directly into any cracks. Consequently, water infiltrates your roof and ceiling. This degrades the quality of your roof's insulation, eventually starts to rot the wood decking and causes further damage to the interior of the house, such as ceiling stains.
In addition to having proper flashing installed, the use of sealing compounds on chimneys helps prevent water infiltration into the masonry. These products are vapor permeable. This means they are meant to seal the brick and mortar so that they become porous in only one direction. Water vapor and gasses from inside the house permeate the brick to exit the chimney, but moisture from the outside can't get in. This prevents the deteriorating effects of moisture that causes cracks to form.