The interaction between S2 molecule and SiHx (x=1, 2, 3) in porous silicon is investigated using the B3LYP method of density functional theory with the lanl2dz basis set. The model of porous silicon doped with CH3, Si-O-Si and OH species is built. By analyzing the binding energy and electronic transfer, we conclude that the interaction of S2 molecule with SiHx (x=1, 2, 3) is much stronger than the interaction of S2 molecule with CH3 and OH, as S2 molecule is located in different sites of the model. Using the transition state theory, we study the Si2H6+S2→H3SiH2SiS+HS reaction, and the reaction energy barrier is 50.2 kJ/mol, which indicates that the reaction is easy to occur.