A terminal device, comprising a first domain and a second domain, wherein the first domain and the second domain are logical organization units in the terminal device having each a respective security policy and having a security boundary between the first and the second domain, wherein a program is deployed in the first domain, and a control flow management module and an audit module are deployed in the second domain, wherein the control flow management module is configured to: when the program in the first domain is executed, obtain to-be-audited information by using a tracer, wherein the to-be-audited information comprises control flow information of the program and other to-be-audited information; and the audit module is configured to: audit the to-be-audited information according to an audit rule; wherein the terminal device further comprises a first random number generator and an auto-collection module that are deployed in the first domain, and the second domain comprises a text segment of the program, wherein the text segment includes code of the program and static data of the program; the auto-collection module is configured to: before the program is executed, call the first random number generator to generate a random number RX; store the random number RX in a second register of the tracer; and obtain a hash value H1 through calculation based on the random number RX and the text segment of a process that executes the program, the process including all instructions of the program; the control flow management module is specifically configured to: obtain the to-be-audited information by using the tracer, wherein the to-be-audited information further comprises the random number RX, and RX is obtained by the tracer by accessing the second register; and the audit module is specifically configured to: obtain the hash value H1; obtain a hash value H2 through calculation based on the random number RX and the text segment comprised in the second domain; compare H1 with H2; and the audit succeeds based on H1 being the same as H2 and the other to-be-audited information matching the audit rule. the control flow management module is configured to: when the program in the first domain is executed, obtain to-be-audited information by using a tracer, wherein the to-be-audited information comprises control flow information of the program and other to-be-audited information; and the audit module is configured to: audit the to-be-audited information according to an audit rule; wherein the terminal device further comprises a first random number generator and an auto-collection module that are deployed in the first domain, and the second domain comprises a text segment of the program, wherein the text segment includes code of the program and static data of the program; the auto-collection module is configured to: before the program is executed, call the first random number generator to generate a random number RX; store the random number RX in a second register of the tracer; and obtain a hash value H1 through calculation based on the random number RX and the text segment of a process that executes the program, the process including all instructions of the program; the control flow management module is specifically configured to: obtain the to-be-audited information by using the tracer, wherein the to-be-audited information further comprises the random number RX, and RX is obtained by the tracer by accessing the second register; and the audit module is specifically configured to: obtain the hash value H1; obtain a hash value H2 through calculation based on the random number RX and the text segment comprised in the second domain; compare H1 with H2; and the audit succeeds based on H1 being the same as H2 and the other to-be-audited information matching the audit rule. <EOS>