# US 2019/0377598 A1 · Data migration method and apparatus

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2019/0377598 A1
- Document ID: US20190377598A1
- Status: Published application
- Kind: A1
- Application number: 16/549,861
- Filed: 2019-08-23
- Published: 2019-12-12
- Earliest claimed: 2017-02-23
- Assignees: Huawei Technologies Co., Ltd.
- Applicants: Huawei Technologies Co., Ltd.
- Inventors: Yubin XIA; Yu SHEN; Haibo CHEN; Zhengde ZHAI
- Web page: https://patentgrep.com/patent/US20190377598A1

## CPC

- G06F 9/4856: {resumption being on a different machine, e.g. task migration, virtual machine migration (G06F9/5088 takes precedence)}
- G06F 21/53: by executing in a restricted environment, e.g. sandbox or secure virtual machine
- G06F 21/602: {Providing cryptographic facilities or services}
- G06F 21/64: Protecting data integrity, e.g. using checksums, certificates or signatures
- G06F 9/45558: {Hypervisor-specific management and integration aspects}
- G06F 2009/4557: {Distribution of virtual machine instances; Migration and load balancing}
- G06F 2221/2149: Restricted operating environment
- H04L 9/3247: {involving digital signatures}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)
- H04L: TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION (arrangements common to telegraphic and telephonic communication H04M)

## Abstract

The present invention relates to the field of communications technologies, and in particular, to a data migration method and apparatus, to implement data migration in an EPC, to improve consistency between data of an application program before migration and that after migration. The method includes: obtaining, by a source host, a migration instruction, where the migration instruction is used to instruct to migrate a target application created with an enclave to a destination host; invoking, by the source host, a migration control thread preset in the enclave of the target application, to write running status data of the target application in an EPC into target memory of the source host, where the target memory is an area other than the EPC in memory of the source host; and sending, by the source host, the running status data of the target application in the target memory to the destination host.

## Claims

### Claim 1

A data migration method, comprising:
obtaining, by a source host, a migration instruction, wherein the migration instruction is used to instruct to migrate a target application created with an enclave to a destination host;
invoking, by the source host, a migration control thread preset in the enclave of the target application, to write running status data of the target application in an enclave page cache EPC into target memory of the source host, wherein the target memory is an area other than the EPC in memory of the source host; and
sending, by the source host, the running status data of the target application in the target memory to the destination host.

### Claim 2 (depends on 1)

The method according to claim 1, wherein the invoking, by the source host, a migration control thread preset in the enclave of the target application, to write running status data of the target application in an enclave page cache EPC into target memory of the source host comprises:
invoking, by the source host, the migration control thread, to obtain running status data of the enclave from the EPC; and
invoking, by the source host, the migration control thread, to write the running status data of the enclave in the EPC into the target memory.

### Claim 3 (depends on 2)

The method according to claim 2, wherein the enclave of the target application further comprises N working threads, wherein N≥1; and
invoking, by the source host, the migration control thread, to obtain the running status data of the target application from the EPC comprises:
invoking, by the source host, the migration control thread when the migration control thread receives a preset migration signal, to set a global status of the target enclave to a migration state;
setting, by the source host, a local status of each of the N working threads to a stopped state when the global status is a migration state; and
invoking, by the source host, the migration control thread when the local statuses of all the N working threads are a stopped state, to access the running status data of the target application in the EPC by using a CPU of the source host.

### Claim 4 (depends on 3)

The method according to claim 3, wherein the setting, by the source host, a local status of each of the N working threads to a stopped state when the global status is a migration state comprises:
modifying, by the source host when the N working threads comprise a working thread whose local status is a busy state, the local status of the working thread to a stopped state through an interrupt; and
recording, by the source host, a current state save area CSSA of the working thread; or
setting, by the source host after execution of all working threads whose local statuses are a busy state is finished, a local status of each working thread to a stopped state.

### Claim 5 (depends on 2)

The method according to claim 2, wherein after the invoking, by the source host, the migration control thread, to obtain the running status data of the target application from the EPC, the method further comprises:
invoking, by the source host, the migration control thread, to perform an encryption operation on the running status data, and adding integrity protection to the encrypted running status data, wherein the integrity protection can be a digital signature operation performed by using a digital signature or a message authentication code MAC; and
the invoking, by the source host, the migration control thread, to write the running status data of the target application in the EPC into the target memory comprises:
invoking, by the source host, the migration control thread, to write the encrypted and integrity-protected running status data into the target memory.

### Claim 6

A data migration method, comprising:
obtaining, by a destination host, running status data of a target application from a source host;
restoring, by the destination host, an enclave of the target application in an EPC of memory;
creating, by the destination host, a migration control thread of the target application in an enclave of the target application; and
invoking, by the destination host, the migration control thread, to replicate the running status data to the EPC.

### Claim 7 (depends on 6)

The method according to claim 6, wherein the restoring, by the destination host, the enclave of the target application in an EPC of memory comprises:
obtaining, by the destination host, an enclave create record of the target application from the source host, wherein the enclave create record records a memory address of the enclave of the target application; and
restoring, by the destination host, the enclave of the target application in the EPC of the memory based on the memory address.

### Claim 8 (depends on 6)

The method according to claim 6, wherein the method further comprises:
obtaining, by the destination host, a CSSA of each working thread in the enclave of the target application from the source host; and
modifying, by the destination host through an interrupt if a value of a CSSA of a target working thread is not zero, the value of the CSSA of the target working thread to a value of the CSSA recorded in the source host.

### Claim 9 (depends on 6)

The method according to claim 6, wherein the invoking, by the destination host, the migration control thread, to replicate the running status data to the EPC comprises:
invoking, by the destination host, the migration control thread, to write the running status data into the EPC; and
invoking, by the destination host, the migration control thread, to perform decryption and integrity verification on the running status data written into the EPC.

### Claim 10

A host, wherein the host is a source host, and comprises:
an obtaining unit, configured to obtain a migration instruction, wherein the migration instruction is used to instruct to migrate a target application created with a memory protection area enclave to a destination host;
an execution unit, configured to invoke a migration control thread preset in the enclave of the target application, to write running status data of the target application in an enclave page cache EPC into target memory of the source host, wherein the target memory is an area other than the EPC in memory of the source host; and
a sending unit, configured to send the running status data of the target application in the target memory to the destination host.

### Claim 11 (depends on 10)

The source host according to claim 10, wherein
the execution unit is specifically configured to: invoke the migration control thread, to obtain the running status data of the target application from the EPC; and invoke the migration control thread, to write the running status data of the target application in the EPC into the target memory.

### Claim 12 (depends on 11)

The source host according to claim 11, wherein the enclave of the target application further comprises N working threads, wherein N≥1; and
the execution unit is specifically configured to: invoke the migration control thread, to set a global status of the enclave to a migration state; set a local status of each of the N working threads to a stopped state when the global status is a migration state; and invoke the migration control thread when the local statuses of all the N working threads are a stopped state, to access the running status data of the target application in the EPC by using a CPU of the source host.

### Claim 13 (depends on 12)

The source host according to claim 12, wherein
the execution unit is specifically configured to: modify, when the N working threads comprise a working thread whose local status is a busy state, the local status of the working thread to a stopped state through an interrupt; and record a current state save area CSSA of the working thread; or set, after all working threads whose local statuses are a busy state have been executed, a local status of each working thread to a stopped state.

### Claim 14 (depends on 11)

The source host according to claim 11, wherein the source host further comprises:
an encryption unit, configured to invoke the migration control thread, to perform encryption and integrity protection operations on the running status data, wherein the integrity protection can be implemented by using a message authentication code MAC or a signature algorithm; and
the execution unit is specifically configured to invoke the migration control thread, to write the encrypted and integrity-protected running status data into the target memory.

### Claim 15

A host, wherein the host is a destination host, and comprises:
an obtaining unit, configured to obtain running status data of a target application from a source host;
a restoring unit, configured to restore an enclave of the target application in an EPC of memory of the destination host;
a creating unit, configured to create a migration control thread of the target application in the enclave of the target application; and
a replication unit, configured to invoke the migration control thread, to replicate the running status data to the EPC in an encrypted and integrity-protected manner.

### Claim 16 (depends on 15)

The destination host according to claim 15, wherein
the restoring unit is specifically configured to: obtain an enclave create record of the target application from the source host, wherein the enclave create record records a memory address of the enclave of the target application; and restore the enclave of the target application in the EPC of the memory based on the memory address.

### Claim 17 (depends on 16)

The destination host according to claim 16, wherein
the obtaining unit is further configured to obtain a CSSA of each working thread in the enclave of the target application from the source host; and
the restoring unit is further configured to modify, through an interrupt if a value of a CSSA of a target working thread is not zero, the value of the CSSA of the target working thread to a value of the CSSA recorded in the source host.

### Claim 18 (depends on 15)

The destination host according to claim 15, wherein
the replication unit is specifically configured to: invoke the migration control thread, to write the running status data into the EPC; and invoke the migration control thread, to perform integrity verification and decryption operations on the running status data.
