Step flashing and counterflashing
Where the roof meets the sides of the chimney, step flashing is woven with the shingles and counterflashing is set into the brick to cover it. If either piece is loose, rusted or sealed only with caulk, water runs right in.

