On the show, they have NOT made it clear. Moffat has said it, but it has not been established on the show it can be done (without Karn-Aid™ or any other outside influence). When Moffat leaves, the next show-runner may or may not confirm ON-AIR.
As far as the show goes, the Corsair changed gender and the Master has changed gender - period. The fact that the Doctor was not shocked when Missy revealed herself as the Master could mean it's always a possibility or it could mean he knows that the Corsair switched with Karn-Aid™ and the Master may have done so too.