TWI783034B - System and method for implementing drive - Google Patents

System and method for implementing drive Download PDF

Info

Publication number
TWI783034B
TWI783034B TW107131126A TW107131126A TWI783034B TW I783034 B TWI783034 B TW I783034B TW 107131126 A TW107131126 A TW 107131126A TW 107131126 A TW107131126 A TW 107131126A TW I783034 B TWI783034 B TW I783034B
Authority
TW
Taiwan
Prior art keywords
driver
interrupt
user space
space
interrupt processing
Prior art date
Application number
TW107131126A
Other languages
Chinese (zh)
Other versions
TW201923568A (en
Inventor
吳彩娣
呂達夫
Original Assignee
香港商阿里巴巴集團服務有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 香港商阿里巴巴集團服務有限公司 filed Critical 香港商阿里巴巴集團服務有限公司
Publication of TW201923568A publication Critical patent/TW201923568A/en
Application granted granted Critical
Publication of TWI783034B publication Critical patent/TWI783034B/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/51Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems at application loading time, e.g. accepting, rejecting, starting or inhibiting executable software based on integrity or source reliability
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Stored Programmes (AREA)
  • Storage Device Security (AREA)
  • Diaphragms For Electromechanical Transducers (AREA)
  • Vehicle Body Suspensions (AREA)
  • Control Of Multiple Motors (AREA)

Abstract

本發明公開了一種實現驅動的系統及方法,包括:在用戶空間配置驅動TA的屬性;內核空間載入驅動程式時,解析驅動TA的屬性,以完成分配資源、註冊驅動、將設備實體位址映射到對應的虛擬位址空間上中的至少一個功能。通過本發明提供的方案,驅動程式的代碼均在用戶空間,不需要再與OS進行整合處理,完全實現了以TA的形式對用戶的驅動程式進行開發整合和管理。而且,不需要使用sysfs記錄用戶空間驅動的記憶體映射等資訊,所有的用戶空間的驅動資訊都只在驅動的TA中和TEE動態運行的記憶體中,因此不會造成資訊洩露,保證了驅動程式的安全性。The invention discloses a system and method for realizing driving, including: configuring the attributes of the driving TA in the user space; when loading the driver program in the kernel space, analyzing the attributes of the driving TA to complete the allocation of resources, registering the driver, and setting the physical address of the device Mapped to at least one function in the corresponding virtual address space. Through the solution provided by the present invention, the codes of the driver program are all in the user space, and no further integration with the OS is required, and the development, integration and management of the user's driver program in the form of TA are fully realized. Moreover, there is no need to use sysfs to record information such as the memory mapping of the user space driver. All the driver information of the user space is only stored in the TA of the driver and the memory in which the TEE dynamically runs, so no information leakage will be caused and the driver will be guaranteed. program security.

Description

實現驅動的系統及方法System and method for implementing drive

本發明涉及但不限於電腦技術,尤指一種實現驅動的系統及方法。The present invention relates to but not limited to computer technology, especially a system and method for realizing driving.

目前,在驅動的實現中,以Linux內核(Linux kernel)中實現用戶空間的輸入/輸出介面(UIO)驅動為例,UIO的用戶空間(Userspace)實現了mmap(),用於處理設備記憶體的映射。如果UIO的驅動程式在用戶空間要等待一個中斷,需要簡單的阻塞在/dev/uioX的讀read() 操作上,UIO驅動的內核空間(Kernelspace)仍需要設置中斷處理函數,這樣,當設備產生中斷時,內核空間應答中斷,中斷計算器加1,read()操作立即返回。另外,UIO的驅動程式實現了poll()系統調用,可以使用select()函數來等待中斷的發生。註冊的UIO設備將會出現在/sys/class/uioX下,對設備的控制可以通過對/sys/class/uioX下的各檔讀寫來完成。   從相關技術中在Linux內核中實現用戶空間的UIO驅動的方案來看,一方面,一部分驅動程式仍然運行在內核空間,因此,是無法以安全應用(TA, Trusted Application)的方式對用戶空間的驅動進行開發整合的,也就無法使用可信應用管理(TAM)程式進行動態安裝、升級。另一方面,需要驅動程式的開發者顯示的調用mmap()、驅動註冊等函數,增加了設計的複雜度,不適合在小型的作業系統(OS, Operation System)中使用,而且sysfs中的資訊存在安全洩漏問題,不適合在可信執行環境(TEE)中使用;再者,用戶空間等待一個中斷需要等待(wait)在設備的讀操作上,與原有非UIO驅動程式的開發行為不統一,對於初始開發者,無疑增加了理解複雜度。At present, in the implementation of the driver, take the input/output interface (UIO) driver of the user space in the Linux kernel (Linux kernel) as an example. The user space of the UIO (Userspace) implements mmap() to process the device memory. mapping. If the UIO driver needs to wait for an interrupt in the user space, it needs to simply block the read() operation of /dev/uioX, and the kernel space (Kernelspace) of the UIO driver still needs to set the interrupt processing function, so that when the device generates When an interrupt occurs, the kernel space responds to the interrupt, the interrupt counter is incremented by 1, and the read() operation returns immediately. In addition, the UIO driver implements the poll() system call, and the select() function can be used to wait for an interrupt to occur. The registered UIO device will appear under /sys/class/uioX, and the control of the device can be completed by reading and writing each file under /sys/class/uioX. Judging from the solution of implementing the UIO driver in the user space in the Linux kernel in the related technology, on the one hand, some drivers still run in the kernel space, so it is impossible to use the secure application (TA, Trusted Application) method to the user space. If the driver is developed and integrated, it is impossible to use the trusted application management (TAM) program for dynamic installation and upgrade. On the other hand, the developer who needs the driver program calls mmap(), driver registration and other functions explicitly, which increases the complexity of the design and is not suitable for use in small operating systems (OS, Operation System), and the information in sysfs exists Due to the security leak problem, it is not suitable for use in the Trusted Execution Environment (TEE); moreover, the user space needs to wait for an interrupt to wait (wait) on the read operation of the device, which is not consistent with the development behavior of the original non-UIO driver program. The initial developer undoubtedly increases the complexity of understanding.

為了解決上述技術問題,本發明提供一種實現驅動的系統及方法,能夠實現以TA的方式對使用者的驅動程式進行管理,而且能夠很大程度上減輕程式開發的複雜度。   為了達到本發明目的,本發明提供了一種實現驅動的系統,包括:用戶空間和內核空間,其中,用戶空間中設置有:第一可信執行環境內部應用程式設計發展介面、安全應用,以及驅動程式;內核空間中設置有:第二可信執行環境內部應用程式設計發展介面、可信執行環境框架,以及安全作業系統;其中,   所述驅動程式中配置有驅動所述安全應用的屬性;   所述第一可信執行環境內部應用程式設計發展介面與所述第二可信執行環境內部應用程式設計發展介面,用於實現用戶空間內部、內核空間內部,以及用戶空間與內核空間之間的相互調用;   所述可信執行環境框架,基於所述安全作業系統,在載入所述驅動程式時,解析驅動所述安全應用的屬性,以完成分配資源、註冊驅動、將設備實體位址映射到對應的虛擬位址空間中的至少一個功能。   可選地,所述內核空間中還設置有:用戶空間驅動框架;   所述可信執行環境框架還用於:在需要註冊用戶空間驅動的中斷時,為該中斷需要回應的驅動程式建立一個單獨的中斷處理執行緒;   用戶空間驅動框架,用於保存所述可信執行環境框架建立的中斷處理執行緒、用戶空間中中斷處理函數和該中斷的中斷號的對應關係,被所述第二可信執行環境內部應用程式設計發展介面調用註冊用戶空間驅動設備通用的中斷處理函數;當有中斷產生時,用戶空間驅動框架調用通用的中斷處理函數,根據對應關係中與產生的中斷對應的中斷號喚醒對應的中斷處理執行緒,將用戶空間中斷處理函數的入口位址傳給喚醒的中斷處理執行緒。   本發明還提供了一種實現驅動的方法,包括:   內核空間載入驅動程式時,解析驅動安全應用的屬性,以完成分配資源、註冊驅動、將設備實體位址映射到對應的虛擬位址空間上中的至少一個功能,其中,所述驅動安全應用的屬性在用戶空間配置。   可選地,所述方法還包括:   在需要註冊用戶空間驅動的中斷時,所述內核空間為該中斷需要回應的驅動程式建立一個單獨的中斷處理執行緒;   所述內核空間保存建立的中斷處理執行緒、所述用戶空間中中斷處理函數和該所述註冊的中斷的中斷號的對應關係,註冊所述用戶空間驅動設備通用的中斷處理函數;   當有中斷產生時,所述內核空間調用通用的中斷處理函數,根據對應關係中與產生的中斷對應的中斷號喚醒對應的中斷處理執行緒,將驅動用戶空間中斷處理函數的入口位址傳給喚醒的中斷處理執行緒。   本發明又提供了一種電腦可讀儲存介質,儲存有電腦可執行指令,所述電腦可執行指令用於執行上述任一項所述的實現驅動的方法。   本發明再提供了一種用於實現驅動的裝置,包括記憶體和處理器,其中,記憶體中儲存有以下可被處理器執行的指令:內核空間載入驅動程式時,解析驅動安全應用的屬性,以完成分配資源、註冊驅動、將設備實體位址映射到對應的虛擬位址空間上中的至少一個功能,其中,所述驅動安全應用的屬性在用戶空間配置。   可選地,所述記憶體中還儲存有以下可被處理器執行的指令:   在需要註冊用戶空間驅動的中斷時,所述內核空間為該中斷需要回應的驅動程式建立一個單獨的中斷處理執行緒;所述內核空間保存建立的中斷處理執行緒、所述用戶空間中中斷處理函數和所述註冊的中斷的中斷號的對應關係,註冊所述用戶空間驅動設備通用的中斷處理函數;當有中斷產生時,所述內核空間調用通用的中斷處理函數,根據對應關係中與產生的中斷對應的中斷號喚醒對應的中斷處理執行緒,將驅動用戶空間中斷處理函數的入口位址傳給喚醒的中斷處理執行緒。   本發明技術方案至少包括:在用戶空間配置驅動TA的屬性;內核空間載入驅動程式時,解析驅動TA的屬性,以完成分配資源、註冊驅動、將設備實體位址映射到對應的虛擬位址空間上中的至少一個功能。通過本發明提供的方案,驅動程式的代碼均在用戶空間,不需要再與OS進行整合處理,完全實現了以TA的形式對用戶的驅動程式進行開發整合和管理。而且,不需要使用sysfs記錄用戶空間驅動的記憶體映射等資訊,所有的用戶空間的驅動資訊都只在驅動的TA中和TEE動態運行的記憶體中,因此不會造成資訊洩露,保證了驅動程式的安全性。   可選地,本發明還包括:在註冊用戶空間驅動的中斷時,內核空間為該中斷需要回應的驅動的TA建立一個單獨的中斷處理執行緒;內核空間保存建立的中斷處理執行緒、用戶空間中中斷處理函數和該註冊的中斷的中斷號的對應關係註冊用戶空間驅動設備通用的中斷處理函數;當有中斷產生時,內核空間調用通用的中斷處理函數,根據對應關係中與產生的中斷對應的中斷號喚醒對應的中斷處理執行緒,將驅動用戶空間中斷處理函數的入口位址傳給喚醒的中斷處理執行緒。本發明提供的實現驅動的方案中,一方面,中斷驅動程式的代碼均在用戶空間,不需要再與OS進行整合處理,完全實現了以TA的形式對用戶的驅動程式進行開發整合和管理。另一方面,中斷註冊仍可以採用調用中斷註冊API的方案,因此,用戶無需感知內部處理流程;只需利用單獨高優先順序執行緒中斷, 這樣,最大程度上保證了中斷回應的即時性。   本發明的其它特徵和優點將在隨後的說明書中闡述,並且,部分地從說明書中變得顯而易見,或者通過實施本發明而瞭解。本發明的目的和其他優點可通過在說明書、申請專利範圍以及圖式中所特別指出的結構來實現和獲得。In order to solve the above-mentioned technical problems, the present invention provides a driving system and method, which can manage the user's driving programs in a TA manner, and can greatly reduce the complexity of program development. In order to achieve the purpose of the present invention, the present invention provides a system for realizing the driver, including: user space and kernel space, wherein, the user space is provided with: the first trusted execution environment internal application programming development interface, security application, and driver program; the kernel space is provided with: a second trusted execution environment internal application programming development interface, a trusted execution environment framework, and a secure operating system; wherein, the driver is configured with attributes that drive the secure application; The internal application programming development interface of the first trusted execution environment and the internal application programming development interface of the second trusted execution environment are used to realize the interaction between the user space, the kernel space, and the user space and the kernel space calling; the trusted execution environment framework, based on the secure operating system, when loading the driver, parses the attributes of the secure application to allocate resources, register the driver, and map the physical address of the device to at least one function in the corresponding virtual address space. Optionally, the kernel space is also provided with: a user space driver framework; the trusted execution environment framework is also used for: when the interrupt driven by the user space needs to be registered, a separate driver program that needs to respond to the interrupt is established. the interrupt processing thread; the user space driver framework is used to save the corresponding relationship between the interrupt processing thread established by the trusted execution environment framework, the interrupt processing function in the user space, and the interrupt number of the interrupt, which is determined by the second executable The internal application programming development interface of the information execution environment calls the general interrupt processing function of the registered user space drive device; when an interrupt occurs, the user space drive framework calls the general interrupt processing function, according to the interrupt number corresponding to the generated interrupt in the corresponding relationship Wake up the corresponding interrupt processing thread, and pass the entry address of the user space interrupt processing function to the awakened interrupt processing thread. The present invention also provides a method for realizing the driver, including: When the kernel space loads the driver program, analyze the attributes of the driver security application to complete the allocation of resources, register the driver, and map the physical address of the device to the corresponding virtual address space At least one of the functions, wherein the attribute driving the security application is configured in user space. Optionally, the method further includes: When an interrupt driven by user space needs to be registered, the kernel space creates a separate interrupt processing execution thread for the driver program that needs to respond to the interrupt; the kernel space saves the created interrupt processing Executing the corresponding relationship between the thread, the interrupt processing function in the user space, and the interrupt number of the registered interrupt, and registering the general interrupt processing function of the user space drive device; When an interrupt occurs, the kernel space calls the general The interrupt processing function wakes up the corresponding interrupt processing thread according to the interrupt number corresponding to the generated interrupt in the corresponding relationship, and transmits the entry address of the driving user space interrupt processing function to the awakened interrupt processing thread. The present invention further provides a computer-readable storage medium, which stores computer-executable instructions, and the computer-executable instructions are used to execute any of the above-mentioned methods for realizing driving. The present invention further provides a device for driving, including a memory and a processor, wherein the memory stores the following instructions that can be executed by the processor: when the driver program is loaded into the kernel space, analyze the attributes of the driving safety application , to complete at least one function of allocating resources, registering drivers, and mapping device physical addresses to corresponding virtual address spaces, wherein the attributes of the driver security application are configured in user space. Optionally, the memory also stores the following instructions that can be executed by the processor: When an interrupt driven by the user space needs to be registered, the kernel space creates a separate interrupt processing execution for the driver program that needs to respond to the interrupt thread; the corresponding relationship between the interrupt processing execution thread established in the kernel space, the interrupt processing function in the user space, and the interrupt number of the registered interrupt is registered, and the general interrupt processing function of the user space drive device is registered; when there is When an interrupt occurs, the kernel space calls a general interrupt processing function, wakes up the corresponding interrupt processing execution thread according to the interrupt number corresponding to the generated interrupt in the corresponding relationship, and passes the entry address of the interrupt processing function of the driving user space to the awakened Interrupt processing thread. The technical solution of the present invention at least includes: configuring the attributes of the driver TA in the user space; when loading the driver program in the kernel space, parsing the attributes of the driver TA to complete the allocation of resources, register the driver, and map the physical address of the device to the corresponding virtual address At least one function in space. Through the solution provided by the present invention, the codes of the driver program are all in the user space, and no further integration with the OS is required, and the development, integration and management of the user's driver program in the form of TA are fully realized. Moreover, there is no need to use sysfs to record information such as the memory mapping of the user space driver. All the driver information of the user space is only stored in the TA of the driver and the memory in which the TEE dynamically runs, so no information leakage will be caused and the driver will be guaranteed. program security. Optionally, the present invention also includes: when registering the interrupt driven by the user space, the kernel space sets up a separate interrupt processing execution thread for the TA driven by the interrupt that needs to respond; the kernel space saves the established interrupt processing execution thread, user space The corresponding relationship between the interrupt processing function and the interrupt number of the registered interrupt registers the general interrupt processing function of the user space drive device; when an interrupt occurs, the kernel space calls the general interrupt processing function, according to the corresponding relationship with the generated interrupt The corresponding interrupt processing thread is awakened by the corresponding interrupt number, and the entry address of the driving user space interrupt processing function is passed to the awakened interrupt processing thread. In the scheme for realizing the driver provided by the present invention, on the one hand, the codes of the interrupt driver program are all in the user space, and there is no need to integrate with the OS, which fully realizes the development, integration and management of the user's driver program in the form of TA. On the other hand, interrupt registration can still use the scheme of calling the interrupt registration API, so the user does not need to perceive the internal processing flow; only need to use a separate high-priority thread interrupt, so that the immediacy of interrupt response is guaranteed to the greatest extent. Other features and advantages of the invention will be set forth in the description which follows, and, in part, will be apparent from the description, or can be learned by practice of the invention. The objectives and other advantages of the invention can be realized and obtained by the structures particularly pointed out in the specification, claims and drawings.

為使本發明的目的、技術方案和優點更加清楚明白,下文中將結合圖式對本發明的實施例進行詳細說明。需要說明的是,在不衝突的情況下,本發明中的實施例及實施例中的特徵可以相互任意組合。   在本發明一個典型的配置中,計算設備包括一個或多個處理器(CPU)、輸入/輸出介面、網路介面和記憶體。   記憶體可能包括電腦可讀介質中的非永久性記憶體,隨機存取記憶體(RAM)和/或非揮發性記憶體等形式,如唯讀記憶體(ROM)或快閃記憶體(flash RAM)。記憶體是電腦可讀介質的示例。   電腦可讀介質包括永久性和非永久性、 可移動和非可移動媒體可以由任何方法或技術來實現資訊儲存。資訊可以是電腦可讀指令、資料結構、程式的模組或其他資料。電腦的儲存介質的例子包括,但不限於相變記憶體(PRAM)、靜態隨機存取記憶體(SRAM)、動態隨機存取記憶體(DRAM)、其他類型的隨機存取記憶體(RAM)、唯讀記憶體(ROM)、電可擦除可程式設計唯讀記憶體(EEPROM)、快閃記憶體或其他記憶體技術、唯讀光碟唯讀記憶體(CD-ROM)、數位多功能光碟(DVD)或其他光學儲存、磁盒式磁帶,磁帶磁磁片儲存或其他磁性存放裝置或任何其他非傳輸介質,可用於儲存可以被計算設備訪問的資訊。按照本文中的界定,電腦可讀介質不包括非暫存電腦可讀媒體(transitory media),如調變的資料信號和載波。   在圖式的流程圖示出的步驟可以在諸如一組電腦可執行指令的電腦系統中執行。並且,雖然在流程圖中示出了邏輯順序,但是在某些情況下,可以以不同於此處的循序執行所示出或描述的步驟。   可信執行環境(TEE)通過硬體的隔離,可確保在一個孤立、可信的環境中儲存、處理和保護敏感性資料。TEE廣泛用於各種安全應用,如支付、指紋和數位版權保護(DRM)等。TEE在用戶空間實現驅動程式,能夠滿足更高安全級別的要求,同時,用戶的驅動程式可以以運行在TEE內部的安全應用(TA, Trusted Application)的方式進行開發整合和管理。   圖1為本發明實現驅動的系統的組成示意圖,如圖1所示,包括用戶空間和內核空間,其中,用戶空間中至少設置有:第一TEE內部(Internal)應用程式設計發展介面(API, Application Programming Interface)、安全應用(TA, Trusted Application),以及驅動程式如驅動TA(Driver TA);內核空間中至少設置有:第二TEE Internal API、TEE框架(Framework),以及安全作業系統(Secure OS);其中,   第一TEE Internal API與第二TEE Internal API,用於實現用戶空間內部、內核空間內部,以及用戶空間與內核空間之間的相互調用。比如:TA 調用第一TEE Internal AP、用戶空間的第一TEE Internal API通過sysycall調用內核空間的第二TEE Internal API,這樣,第二TEE Internal API才能調用內核空間的其他模組的介面,具體實現術語本領域技術人員的公知技術,並不用於限定本發明的保護範圍。   驅動TA中配置有驅動TA的屬性,比如:驅動的名稱、需要映射的實體位址和對應的虛擬位址等。   配置方式與普通TA的屬性配置方式類似。這些屬性在編譯的時候,會被放在一個特殊的段裡。   驅動TA包括一個或一個以上,一個第三方的TA可以對應一個驅動TA。   TEE框架,基於安全OS,在載入驅動程式時,解析驅動TA的屬性,以完成分配資源、註冊驅動、將設備實體位址映射到對應的虛擬位址空間上中的至少一個功能。   本發明提供的實現驅動的架構中,驅動程式的代碼均在用戶空間的驅動TA,不需要再與OS進行整合處理,完全實現了以TA的形式對用戶的驅動程式進行開發整合和管理。而且,不需要使用sysfs記錄用戶空間驅動的記憶體映射等資訊,所有的用戶空間的驅動資訊都只在驅動的TA中和TEE動態運行的記憶體中,因此不會造成資訊洩露,保證了驅動程式的安全性。   通過本發明提供的實現驅動的架構,不需要驅動的開發者顯示的調用mmap()、驅動的註冊等相關函數,只需要簡單地配置驅動TA的屬性,而與普通TA的開發方式儘量保持了一致,這樣,減少了第三方驅動開發者的工作量;而且,也不需要sysfs的參與,實現了無驅動資訊洩漏的隱患,保證了驅動程式的安全性。第三方的驅動已TA的方式整合到TEE中,因此,實現了採用TAM的方式動態的更新,減少了驅動程式整合成本。   可選地,內核空間中還設置有:用戶空間驅動程式框架(Userspace Driver Framework);相應地,   TEE框架還用於:在外部如驅動的開發者需要註冊用戶空間驅動的中斷時,為該中斷需要回應的驅動的TA建立一個單獨的中斷處理執行緒;   用戶空間驅動程式框架,用於保存TEE框架建立的中斷處理執行緒、用戶空間中中斷處理函數和該註冊的中斷的中斷號的對應關係,被TEE內核空間的第二TEE Internal API調用註冊用戶空間驅動設備通用的中斷處理函數;當有中斷產生時,先調用通用的中斷處理函數,再根據對應關係中與產生的中斷對應的中斷號喚醒對應的中斷處理執行緒,將驅動用戶空間中斷處理函數的入口位址傳給喚醒的中斷處理執行緒。   這樣,中斷處理執行緒會切換到驅動用戶空間的中斷處理函數並處理中斷。   本發明提供的實現驅動的系統中,中斷驅動程式的代碼均在用戶空間的驅動TA,不需要再與OS進行整合處理,完全實現了以TA的形式對用戶的驅動程式進行開發整合和管理。   通過本發明提供的實現驅動的系統,中斷註冊仍可以採用調用中斷註冊API的方案,因此,用戶無需感知內部處理流程;當有中斷產生時,只需利用單獨高優先順序執行緒該中斷, 這樣,最大程度上保證了中斷回應的即時性。   也就是說,通過本發明提供的實現驅動的系統,不需要驅動程式的開發者感知記憶體映射、註冊驅動、用戶空間回應中斷需要等待在設備讀操作上等操作, 在本發明提供的實現驅動的系統中,記憶體的映射、驅動註冊只需簡單的配置驅動的屬性,而中斷仍採用調用中斷註冊函數的方式,與相關技術中在內核空間開發驅動的方案保持一致,這樣極大地減小了驅動開發的複雜性。   圖2為本發明實現驅動的方法的流程圖,如圖2所示,包括:   步驟200:在用戶空間配置驅動TA的屬性。   可選地,屬性包括但不限於:驅動的名稱、需要映射的實體位址和對應的虛擬位址等。   配置方式與普通TA的屬性配置方式類似。這些屬性在編譯的時候,會被放在一個特殊的段裡。   驅動TA包括一個或一個以上,一個第三方的TA可以對應一個驅動TA。   步驟201:基於安全OS,內核空間載入驅動程式時,解析驅動TA的屬性,以完成分配資源、註冊驅動、將設備實體位址映射到對應的虛擬位址空間上中的至少一個功能。   本發明提供的實現驅動的方法中,驅動程式的代碼均在用戶空間的驅動TA,不需要再與OS進行整合處理,完全實現了以TA的形式對用戶的驅動程式進行開發整合和管理。而且,不需要使用sysfs記錄用戶空間驅動的記憶體映射等資訊,所有的用戶空間的驅動資訊都只在驅動的TA中和TEE動態運行的記憶體中,因此不會造成資訊洩露,保證了驅動程式的安全性。   通過本發明提供的實現驅動的方法,不需要驅動的開發者顯示的調用mmap()、驅動的註冊等相關函數,只需要簡單地配置驅動TA的屬性,而與普通TA的開發方式儘量保持了一致,這樣,減少了第三方驅動開發者的工作量;而且,也不需要sysfs的參與,實現了無驅動資訊洩漏的隱患,保證了驅動程式的安全性。第三方的驅動已TA的方式整合到TEE中,因此,實現了採用TAM的方式動態的更新,減少了驅動程式整合成本。   本發明實現驅動的方法還包括:   在需要註冊用戶空間驅動的中斷時,內核空間為該中斷需要回應的驅動的TA建立一個單獨的中斷處理執行緒;   內核空間保存建立的中斷處理執行緒、用戶空間中中斷處理函數和該註冊的中斷的中斷號的對應關係,註冊用戶空間驅動設備通用的中斷處理函數;   當有中斷產生時,內核空間調用通用的中斷處理函數,根據對應關係中與產生的中斷對應的中斷號喚醒對應的中斷處理執行緒,將驅動用戶空間中斷處理函數的入口位址傳給喚醒的中斷處理執行緒。   這樣,中斷處理執行緒會切換到驅動用戶空間的中斷處理函數並處理中斷。   本發明提供的實現驅動的方法中,中斷驅動程式的代碼均在用戶空間的驅動TA,不需要再與OS進行整合處理,完全實現了以TA的形式對用戶的驅動程式進行開發整合和管理。   通過本發明提供的實現驅動的方法,中斷註冊仍可以採用調用中斷註冊API的方案,因此,用戶無需感知內部處理流程;當有中斷產生時,只需利用單獨高優先順序執行緒該中斷, 這樣,最大程度上保證了中斷回應的即時性。   也就是說,通過本申請提供的實現驅動的方法,不需要驅動程式的開發者感知記憶體映射、註冊驅動、使用者空間回應中斷需要等待在設備讀操作上等操作, 在本申請提供的實現驅動的架構中,記憶體的映射、驅動註冊只需簡單的配置驅動的屬性,而中斷仍採用調用中斷註冊函數的方式,與相關技術中在內核空間開發驅動的方案保持一致,這樣極大地減小了驅動開發的複雜性。   在實際的應用中,為了保證安全性,有很多的驅動程式是需要配置成只有TEE才可以訪問的,比如加密引擎,這種情況下,需要在TEE中整合這些驅動程式。利用本發明提供的實現驅動的架構及方法,在高安全級別的需求下,這些第三方的驅動程式會整合在用戶空間,這樣,第三方的驅動程式的錯誤(bug)不會導致TEE有bug而受人攻擊;驅動程式崩潰(crash)時也不會導致整個TEE崩潰,方便了驅動程式的開發者開發和調試。同時,利用本發明提供的實現驅動的架構及方法,以TA的方式整合驅動程式,既方便了驅動程式的開發整合,又方便了使用TAM進行驅動的動態安裝、刪除、更新等操作。   本發明還提供一種電腦可讀儲存介質,儲存有電腦可執行指令,所述電腦可執行指令用於執行上述任一項所述的實現驅動的方法。   本發明還提供一種用於實現驅動的裝置,包括記憶體和處理器,其中,記憶體中儲存有以下可被處理器執行的指令:內核空間載入TA時,解析驅動TA的屬性,以完成分配資源、註冊驅動、將設備實體位址映射到對應的虛擬位址空間上中的至少一個功能,其中,所述驅動安全應用的屬性在用戶空間配置。   可選地,所述記憶體中還儲存有以下可被處理器執行的指令:   在註冊用戶空間驅動的中斷時,所述內核空間為該中斷需要回應的驅動的TA建立一個單獨的中斷處理執行緒;所述內核空間保存建立的中斷處理執行緒,驅動所述用戶空間中中斷處理函數和該中斷的中斷號的對應關係,註冊所述用戶空間驅動設備通用的中斷處理函數;當有中斷產生時,所述內核空間根據中斷號喚醒對應的中斷處理執行緒,將驅動用戶空間中斷處理函數的入口位址傳給喚醒的中斷處理執行緒。   雖然本發明所揭露的實施方式如上,但所述的內容僅為便於理解本發明而採用的實施方式,並非用以限定本發明。任何本發明所屬領域內的技術人員,在不脫離本發明所揭露的精神和範圍的前提下,可以在實施的形式及細節上進行任何的修改與變化,但本發明的專利保護範圍,仍須以所附的申請專利範圍所界定的範圍為準。In order to make the purpose, technical solution and advantages of the present invention more clear, the embodiments of the present invention will be described in detail below with reference to the drawings. It should be noted that, in the case of no conflict, the embodiments of the present invention and the features in the embodiments can be combined arbitrarily with each other. In a typical configuration of the invention, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory. Memory may include non-permanent memory in computer-readable media, random access memory (RAM) and/or non-volatile memory in the form of read-only memory (ROM) or flash memory (flash RAM). The memory is an example of a computer readable medium. Computer-readable media includes permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology for information storage. Information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for computers include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM) , read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital multifunction A compact disc (DVD) or other optical storage, magnetic cassette, tape magnetic disk storage or other magnetic storage device or any other non-transmission medium used to store information that can be accessed by a computing device. As defined herein, computer readable media excludes non-transitory computer readable media, such as modulated data signals and carrier waves. The steps shown in the flowcharts of the drawings may be performed on a computer system, such as a set of computer-executable instructions. Also, although a logical order is shown in the flowcharts, in some cases the steps shown or described may be performed in an order different from that presented herein. The Trusted Execution Environment (TEE) can ensure the storage, processing and protection of sensitive data in an isolated and trusted environment through hardware isolation. TEE is widely used in various security applications, such as payment, fingerprint and digital rights protection (DRM). TEE implements the driver program in the user space, which can meet the requirements of a higher security level. At the same time, the user driver program can be developed, integrated and managed in the form of a secure application (TA, Trusted Application) running inside the TEE. Fig. 1 is the schematic composition diagram of the system that realizes driving of the present invention, as shown in Fig. 1, comprise user space and kernel space, wherein, be provided with at least in user space: first TEE internal (Internal) application programming development interface (API, Application Programming Interface), security applications (TA, Trusted Application), and drivers such as driver TA (Driver TA); at least in the kernel space: the second TEE Internal API, TEE framework (Framework), and secure operating system (Secure OS); Wherein, the first TEE Internal API and the second TEE Internal API are used to implement mutual calls within the user space, inside the kernel space, and between the user space and the kernel space. For example: TA calls the first TEE Internal AP, and the first TEE Internal API in user space calls the second TEE Internal API in kernel space through sysycall. In this way, the second TEE Internal API can call the interface of other modules in kernel space, and the specific implementation The terms are well-known techniques of those skilled in the art, and are not used to limit the protection scope of the present invention. The attributes of the driver TA are configured in the driver TA, such as: the name of the driver, the physical address to be mapped and the corresponding virtual address, etc. The configuration method is similar to that of common TA attributes. These attributes are placed in a special section at compile time. The driver TA includes one or more than one, and a third-party TA can correspond to a driver TA. The TEE framework, based on a secure OS, analyzes the attributes of the driver TA when loading the driver to complete at least one of the functions of allocating resources, registering the driver, and mapping the physical address of the device to the corresponding virtual address space. In the framework for realizing the driver provided by the present invention, the code of the driver program is all in the driver TA in the user space, and there is no need to integrate with the OS, and the development, integration and management of the user's driver program in the form of TA are fully realized. Moreover, there is no need to use sysfs to record information such as the memory mapping of the user space driver. All the driver information of the user space is only stored in the TA of the driver and the memory in which the TEE dynamically runs, so no information leakage will be caused and the driver will be guaranteed. program security. Through the framework for realizing the driver provided by the present invention, there is no need for the developer of the driver to explicitly call mmap(), driver registration and other related functions, and only need to simply configure the attributes of the driver TA, while keeping as far as possible with the common TA development method In this way, the workload of third-party driver developers is reduced; moreover, the participation of sysfs is not required, so the hidden danger of no driver information leakage is realized, and the security of the driver is guaranteed. The third-party driver has been integrated into the TEE in the TA way. Therefore, the dynamic update in the TAM way is realized and the driver integration cost is reduced. Optionally, a user space driver framework (Userspace Driver Framework) is also set in the kernel space; correspondingly, the TEE framework is also used for: when an external driver needs to register an interrupt driven by the user space, for the interrupt The TA of the driver that needs to respond creates a separate interrupt processing thread; the user space driver framework is used to save the corresponding relationship between the interrupt processing thread created by the TEE framework, the interrupt processing function in the user space, and the interrupt number of the registered interrupt , is called by the second TEE Internal API of the TEE kernel space to register the general interrupt processing function of the user space drive device; when an interrupt occurs, the general interrupt processing function is called first, and then according to the interrupt number corresponding to the generated interrupt in the corresponding relationship Wake up the corresponding interrupt processing thread, and pass the entry address of the interrupt processing function driving the user space to the awakened interrupt processing thread. In this way, the interrupt handling thread will switch to the interrupt handling function driving the user space and handle the interrupt. In the driver implementation system provided by the present invention, the codes of the interrupt driver program are all in the driver TA in the user space, and there is no need to integrate with the OS, and the development, integration and management of the user's driver program in the form of TA are fully realized. Through the implementation-driven system provided by the present invention, the interrupt registration can still adopt the scheme of calling the interrupt registration API, therefore, the user does not need to perceive the internal processing flow; when an interrupt occurs, only need to use a separate high-priority order to execute the interrupt, like this , which ensures the immediacy of interrupt response to the greatest extent. That is to say, through the system for implementing the driver provided by the present invention, it is not necessary for the developer of the driver to perceive memory mapping, register the driver, and user space to respond to interrupts and wait for operations such as device read operations. In the implementation of the driver provided by the present invention In the system, the memory mapping and driver registration only need to simply configure the attributes of the driver, while the interrupt still adopts the method of calling the interrupt registration function, which is consistent with the scheme of developing the driver in the kernel space in the related technology, which greatly reduces the the complexity of driver development. Fig. 2 is a flow chart of the method for implementing the driver in the present invention, as shown in Fig. 2 , including: Step 200: Configure attributes of the driver TA in the user space. Optionally, attributes include but are not limited to: the name of the driver, the physical address to be mapped and the corresponding virtual address, etc. The configuration method is similar to that of common TA attributes. These attributes are placed in a special section at compile time. The driver TA includes one or more than one, and a third-party TA can correspond to a driver TA. Step 201: Based on the secure OS, when the kernel space loads the driver program, analyze the attributes of the driver TA to complete at least one of the functions of allocating resources, registering the driver, and mapping the physical address of the device to the corresponding virtual address space. In the driving method provided by the present invention, the codes of the driver program are all in the driver TA in the user space, and there is no need to integrate with the OS, and the development, integration and management of the user's driver program in the form of TA are fully realized. Moreover, there is no need to use sysfs to record information such as the memory mapping of the user space driver. All the driver information of the user space is only stored in the TA of the driver and the memory in which the TEE dynamically runs, so no information leakage will be caused and the driver will be guaranteed. program security. Through the method for realizing the driver provided by the present invention, the developer of the driver does not need to display related functions such as calling mmap(), driver registration, etc., and only needs to simply configure the attributes of the driver TA, while keeping as much as possible with the development method of the common TA. In this way, the workload of third-party driver developers is reduced; moreover, the participation of sysfs is not required, so the hidden danger of no driver information leakage is realized, and the security of the driver is guaranteed. The third-party driver has been integrated into the TEE in the TA way. Therefore, the dynamic update in the TAM way is realized and the driver integration cost is reduced. The method for realizing the driver of the present invention also includes: When the interrupt driven by the user space needs to be registered, the kernel space establishes a separate interrupt processing execution thread for the TA of the driver that needs to respond to the interrupt; the kernel space saves the established interrupt processing execution thread, user The corresponding relationship between the interrupt processing function in the space and the interrupt number of the registered interrupt, register the general interrupt processing function of the user space drive device; when an interrupt occurs, the kernel space calls the general interrupt processing function, according to the corresponding relationship and the generated The interrupt number corresponding to the interrupt wakes up the corresponding interrupt processing thread, and transmits the entry address of the interrupt processing function driving the user space to the awakened interrupt processing thread. In this way, the interrupt handling thread will switch to the interrupt handling function driving the user space and handle the interrupt. In the driving method provided by the present invention, the code of the interrupt driver program is all in the driver TA in the user space, and there is no need to integrate with the OS, and the development, integration and management of the user's driver program in the form of TA are fully realized. Through the method for implementing the drive provided by the present invention, the interrupt registration can still adopt the scheme of calling the interrupt registration API, therefore, the user does not need to perceive the internal processing flow; when an interrupt occurs, it only needs to use a separate high-priority thread to execute the interrupt, so , which ensures the immediacy of interrupt response to the greatest extent. That is to say, through the method of implementing the driver provided by this application, the developer of the driver program does not need to perceive the memory mapping, register the driver, and the user space responds to interrupts and waits for the device read operation. The implementation provided by this application In the driver architecture, memory mapping and driver registration only need to simply configure the attributes of the driver, while interrupts still use the method of calling interrupt registration functions, which is consistent with the scheme of developing drivers in the kernel space in related technologies, which greatly reduces Reduce the complexity of driver development. In practical applications, in order to ensure security, many drivers need to be configured so that only the TEE can access them, such as the encryption engine. In this case, these drivers need to be integrated in the TEE. Utilizing the framework and method for realizing the driver provided by the present invention, these third-party drivers will be integrated in the user space under the requirement of high security level, so that the error (bug) of the third-party driver will not cause the TEE to have bugs And it is attacked by people; when the driver program crashes (crash), it will not cause the entire TEE to crash, which is convenient for the developer of the driver program to develop and debug. At the same time, using the framework and method for realizing the driver provided by the present invention, the driver program is integrated in the form of TA, which not only facilitates the development and integration of the driver program, but also facilitates operations such as dynamic installation, deletion, and update of the driver using TAM. The present invention also provides a computer-readable storage medium, which stores computer-executable instructions, and the computer-executable instructions are used to execute the driving method described in any one of the above. The present invention also provides a device for implementing a driver, including a memory and a processor, wherein the memory stores the following instructions that can be executed by the processor: when the kernel space loads the TA, analyze the attributes of the driver TA to complete At least one function of allocating resources, registering drivers, and mapping device physical addresses to corresponding virtual address spaces, wherein the attributes of the driver security application are configured in user space. Optionally, the memory also stores the following instructions that can be executed by the processor: When registering an interrupt driven by the user space, the kernel space establishes a separate interrupt processing execution for the TA of the driver that needs to respond to the interrupt thread; the kernel space saves the established interrupt processing execution thread, drives the corresponding relationship between the interrupt processing function in the user space and the interrupt number of the interrupt, and registers the general interrupt processing function of the user space driver device; when an interrupt occurs At this time, the kernel space wakes up the corresponding interrupt processing thread according to the interrupt number, and transmits the entry address of the interrupt processing function driving the user space to the awakened interrupt processing thread. Although the embodiments disclosed in the present invention are as above, the described content is only an embodiment adopted for understanding the present invention, and is not intended to limit the present invention. Anyone skilled in the field of the present invention can make any modifications and changes in the form and details of the implementation without departing from the spirit and scope disclosed by the present invention, but the scope of patent protection of the present invention must still be The scope defined in the appended scope of patent application shall prevail.

200、201‧‧‧步驟200, 201‧‧‧step

圖式用來提供對本發明技術方案的進一步理解,並且構成說明書的一部分,與本發明的實施例一起用於解釋本發明的技術方案,並不構成對本發明技術方案的限制。   圖1為本發明實現驅動的系統的組成示意圖;   圖2為本發明實現驅動的方法的流程圖。The drawings are used to provide a further understanding of the technical solution of the present invention, and constitute a part of the description, and are used together with the embodiments of the present invention to explain the technical solution of the present invention, and do not constitute a limitation to the technical solution of the present invention. Figure 1 is a schematic diagram of the composition of the system for realizing the drive of the present invention; Figure 2 is a flow chart of the method for realizing the drive of the present invention.

Claims (5)

一種實現驅動的系統,其特徵在於,包括:用戶空間和內核空間,其中,用戶空間中設置有:第一可信執行環境內部應用程式設計發展介面、安全應用,以及驅動程式;內核空間中設置有:第二可信執行環境內部應用程式設計發展介面、可信執行環境框架,以及安全作業系統;其中,該驅動程式中配置有驅動該安全應用的屬性;該第一可信執行環境內部應用程式設計發展介面與該第二可信執行環境內部應用程式設計發展介面,用於實現用戶空間內部、內核空間內部,以及用戶空間與內核空間之間的相互調用;該可信執行環境框架,基於該安全作業系統,在載入該驅動程式時,解析驅動該安全應用的屬性,以完成分配資源、註冊驅動、將設備實體位址映射到對應的虛擬位址空間中的至少一個功能。 A system for realizing driving, characterized in that it includes: user space and kernel space, wherein, the user space is provided with: the first trusted execution environment internal application programming development interface, security application, and driver program; the kernel space is provided with There are: the second trusted execution environment internal application programming development interface, trusted execution environment framework, and secure operating system; wherein, the driver is configured with attributes driving the secure application; the first trusted execution environment internal application The programming development interface and the internal application programming development interface of the second trusted execution environment are used to implement mutual calls between the user space, the kernel space, and the user space and the kernel space; the trusted execution environment framework is based on The secure operating system, when loading the driver program, analyzes the attribute of the driver of the secure application to complete at least one function of allocating resources, registering the driver, and mapping the physical address of the device to the corresponding virtual address space. 根據請求項1所述的系統,其中,該內核空間中還設置有:用戶空間驅動框架;該可信執行環境框架還用於:在需要註冊用戶空間驅動的中斷時,為該中斷需要回應的驅動程式建立一個單獨的中斷處理執行緒;用戶空間驅動框架,用於保存該可信執行環境框架建 立的中斷處理執行緒、用戶空間中中斷處理函數和該中斷的中斷號的對應關係,被該第二可信執行環境內部應用程式設計發展介面調用註冊用戶空間驅動設備通用的中斷處理函數;當有中斷產生時,用戶空間驅動框架調用通用的中斷處理函數,根據對應關係中與產生的中斷對應的中斷號喚醒對應的中斷處理執行緒,將用戶空間中斷處理函數的入口位址傳給喚醒的中斷處理執行緒。 According to the system described in claim 1, wherein, the kernel space is also provided with: a user space driver framework; the trusted execution environment framework is also used for: when an interrupt driven by the user space needs to be registered, for the interrupt that needs to be responded The driver creates a separate interrupt processing execution thread; the user space driver framework is used to save the trusted execution environment framework The corresponding relationship between the independent interrupt processing thread, the interrupt processing function in the user space, and the interrupt number of the interrupt is called by the internal application programming development interface of the second trusted execution environment to call the general interrupt processing function of the registered user space drive device; when When an interrupt occurs, the user space driver framework calls the general interrupt processing function, wakes up the corresponding interrupt processing execution thread according to the interrupt number corresponding to the generated interrupt in the corresponding relationship, and passes the entry address of the user space interrupt processing function to the awakened Interrupt processing thread. 一種實現驅動的方法,其特徵在於,包括:內核空間載入驅動程式時,解析驅動安全應用的屬性,以完成分配資源、註冊驅動、將設備實體位址映射到對應的虛擬位址空間上中的至少一個功能,其中,該驅動安全應用的屬性在用戶空間配置,其中,該方法還包括:在需要註冊用戶空間驅動的中斷時,該內核空間為該中斷需要回應的驅動程式建立一個單獨的中斷處理執行緒;該內核空間保存建立的中斷處理執行緒、該用戶空間中中斷處理函數和該該註冊的中斷的中斷號的對應關係,註冊該用戶空間驅動設備通用的中斷處理函數;當有中斷產生時,該內核空間調用通用的中斷處理函數,根據對應關係中與產生的中斷對應的中斷號喚醒對應的中斷處理執行緒,將驅動用戶空間中斷處理函數的入口位址傳給喚醒的中斷處理執行緒。 A method for implementing a driver, characterized in that it includes: when the kernel space loads the driver program, parsing the attributes of the driver security application, so as to allocate resources, register the driver, and map the physical address of the device to the corresponding virtual address space. At least one of the functions, wherein, the attributes of the driver security application are configured in user space, wherein the method further includes: when it is necessary to register an interrupt driven by the user space, the kernel space creates a separate driver for the interrupt that needs to respond Interrupt processing thread; the kernel space saves the established interrupt processing thread, the corresponding relationship between the interrupt processing function in the user space and the interrupt number of the registered interrupt, and registers the general interrupt processing function of the user space drive device; when there is When an interrupt occurs, the kernel space calls the general interrupt processing function, wakes up the corresponding interrupt processing execution thread according to the interrupt number corresponding to the generated interrupt in the corresponding relationship, and passes the entry address of the driving user space interrupt processing function to the awakened interrupt Handle threads. 一種電腦可讀儲存介質,儲存有電腦可執行指令,該電腦可執行指令用於執行上述請求項3所述的實現驅動的方法。 A computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to execute the driving method described in Claim 3 above. 一種用於實現驅動的裝置,包括記憶體和處理器,其中,記憶體中儲存有以下可被處理器執行的指令:內核空間載入驅動程式時,解析驅動安全應用的屬性,以完成分配資源、註冊驅動、將設備實體位址映射到對應的虛擬位址空間上中的至少一個功能,其中,該驅動安全應用的屬性在用戶空間配置,其中,該記憶體中還儲存有以下可被處理器執行的指令:在需要註冊用戶空間驅動的中斷時,該內核空間為該中斷需要回應的驅動程式建立一個單獨的中斷處理執行緒;該內核空間保存建立的中斷處理執行緒、該用戶空間中中斷處理函數和該註冊的中斷的中斷號的對應關係,註冊該用戶空間驅動設備通用的中斷處理函數;當有中斷產生時,該內核空間調用通用的中斷處理函數,根據對應關係中與產生的中斷對應的中斷號喚醒對應的中斷處理執行緒,將驅動用戶空間中斷處理函數的入口位址傳給喚醒的中斷處理執行緒。 A device for implementing a driver, including a memory and a processor, wherein the memory stores the following instructions that can be executed by the processor: when the driver is loaded in the kernel space, analyze the attributes of the driver safety application to complete the allocation of resources 1. At least one function of registering the driver and mapping the physical address of the device to the corresponding virtual address space, wherein the attributes of the driver security application are configured in the user space, wherein the memory also stores the following data that can be processed Instructions executed by the device: when it is necessary to register an interrupt driven by the user space, the kernel space creates a separate interrupt processing thread for the driver that needs to respond to the interrupt; the kernel space saves the created interrupt processing thread, and the user space The corresponding relationship between the interrupt processing function and the interrupt number of the registered interrupt, register the general interrupt processing function of the user space drive device; when an interrupt occurs, the kernel space calls the general interrupt processing function, according to the corresponding relationship and the generated The interrupt number corresponding to the interrupt wakes up the corresponding interrupt processing thread, and transmits the entry address of the interrupt processing function driving the user space to the awakened interrupt processing thread.
TW107131126A 2017-11-06 2018-09-05 System and method for implementing drive TWI783034B (en)

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
??201711078956.3 2017-11-06
CN201711078956.3 2017-11-06
CN201711078956.3A CN109753347B (en) 2017-11-06 2017-11-06 System and method for realizing driving

Publications (2)

Publication Number Publication Date
TW201923568A TW201923568A (en) 2019-06-16
TWI783034B true TWI783034B (en) 2022-11-11

Family

ID=66332819

Family Applications (1)

Application Number Title Priority Date Filing Date
TW107131126A TWI783034B (en) 2017-11-06 2018-09-05 System and method for implementing drive

Country Status (3)

Country Link
CN (1) CN109753347B (en)
TW (1) TWI783034B (en)
WO (1) WO2019085811A1 (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110442462B (en) * 2019-07-16 2020-07-28 阿里巴巴集团控股有限公司 Multithreading data transmission method and device in TEE system
CN110399235B (en) 2019-07-16 2020-07-28 阿里巴巴集团控股有限公司 Multithreading data transmission method and device in TEE system
US10699015B1 (en) 2020-01-10 2020-06-30 Alibaba Group Holding Limited Method and apparatus for data transmission in a tee system
CN116484438B (en) * 2022-01-17 2024-07-02 荣耀终端有限公司 Information processing method and device
CN116049809B (en) * 2022-06-14 2023-11-07 荣耀终端有限公司 Drive calling method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW200722992A (en) * 2005-12-14 2007-06-16 Inventec Corp Physical memory testing method under Linux system
CN102193862A (en) * 2010-03-10 2011-09-21 微软公司 Testing user interfaces in multiple execution environments
CN103679006A (en) * 2013-10-25 2014-03-26 华为技术有限公司 Method and device for operating drive program
CN106775833A (en) * 2016-11-28 2017-05-31 青岛海信移动通信技术股份有限公司 device driver loading method, terminal and system
CN107247578A (en) * 2017-06-12 2017-10-13 北京奇虎科技有限公司 Configuration parameter storage method and device

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB0102518D0 (en) * 2001-01-31 2001-03-21 Hewlett Packard Co Trusted operating system
WO2006115533A2 (en) * 2005-04-22 2006-11-02 Microsoft Corporation Protected computing environment
CN1988534B (en) * 2005-12-23 2011-05-25 联想(北京)有限公司 Credible computing system and method for access TPM service under kernel state
CN101453572A (en) * 2007-11-30 2009-06-10 上海复旦上科多媒体有限公司 Control method for multimedia show system equipment
CN103593189A (en) * 2013-11-14 2014-02-19 昆明理工大学 Method for implementing user mode drive program in embedded Linux
CN106936774B (en) * 2015-12-29 2020-02-18 中国电信股份有限公司 Authentication method and system in trusted execution environment

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW200722992A (en) * 2005-12-14 2007-06-16 Inventec Corp Physical memory testing method under Linux system
CN102193862A (en) * 2010-03-10 2011-09-21 微软公司 Testing user interfaces in multiple execution environments
CN103679006A (en) * 2013-10-25 2014-03-26 华为技术有限公司 Method and device for operating drive program
CN106775833A (en) * 2016-11-28 2017-05-31 青岛海信移动通信技术股份有限公司 device driver loading method, terminal and system
CN107247578A (en) * 2017-06-12 2017-10-13 北京奇虎科技有限公司 Configuration parameter storage method and device

Also Published As

Publication number Publication date
WO2019085811A1 (en) 2019-05-09
TW201923568A (en) 2019-06-16
CN109753347B (en) 2023-03-21
CN109753347A (en) 2019-05-14

Similar Documents

Publication Publication Date Title
TWI783034B (en) System and method for implementing drive
KR102255767B1 (en) Systems and methods for virtual machine auditing
RU2398267C2 (en) Hierarchical virtualisation through multi-level virtualisation mechanism
US8181176B2 (en) Uniform storage device access using partial virtual machine executing within a secure enclave session
JP5042848B2 (en) System and method for depriving components of virtual machine monitor
US20190141145A1 (en) Cloud-scale heterogeneous datacenter management infrastructure
US9864626B2 (en) Coordinating joint operation of multiple hypervisors in a computer system
KR102104695B1 (en) Software interface for a hardware device
Vahidi et al. VETE: Virtualizing the Trusted Execution Environment
EP2941694B1 (en) Capability based device driver framework
US20160321116A1 (en) Translating operating system processes
US10430223B2 (en) Selective monitoring of writes to protected memory pages through page table switching
WO2023071786A1 (en) Inter-process function calling method and related device
US10127064B2 (en) Read-only VM function chaining for secure hypervisor access
US11074200B2 (en) Use-after-free exploit prevention architecture
US20140195834A1 (en) High throughput low latency user mode drivers implemented in managed code
US11385927B2 (en) Interrupt servicing in userspace
TWI733745B (en) Method and device for processing I/O request under core mode virtual machine (KVM) virtualization
Dibble et al. Programming embedded systems: interacting with the embedded platform
Kcholi The Foundation of Device Driver Development for Windows Embedded Compact