In relative clauses and in questions, who and whoever are used as subject pronouns, and whom and whomever are used as object pronouns. Whom and whomever might sound formal or even stilted, but that’s not so bad in formal academic writing, especially if the alternative is ungrammatical.
When, however, the object is actually a whole subordinate clause and the pronoun is the subject of that clause, use a subject pronoun, who or whoever: