Stall margin is the difference in the critical angle of attack and the angle of attack in which you are operating.
Example:
Suppose, critical angle of attack= 15°
AOA operating in a flight= 5°
then, Lift by the wing balances the weight of the airplane with a STALL MARGIN= 10°
Stall Margin is being controlled by an angle of attack and the position of flap control..
CHEERS!