modify_ldt(2) System Calls Manual modify_ldt(2) modify_ldt - LDT LIBRARY Standard C library (libc, -lc) #include /* Definition of struct user_desc */ #include /* Definition of SYS_* constants */ #include int syscall(SYS_modify_ldt, int func, void ptr[.bytecount], unsigned long bytecount); Note: glibc provides no wrapper for modify_ldt(), necessitating the use of syscall(2). modify_ldt() (LDT) . LDT , . Linux ( , ) LDT. LDT, Intel Software Developer's Manual AMD Architecture Programming Manual. func 0, modify_ldt() LDT , ptr. -- bytecount LDT , LDT . modify_ldt() . func 1 0x11, modify_ldt() LDT, ptr->entry_number. ptr user_desc, bytecount . user_desc : struct user_desc { unsigned int entry_number; unsigned int base_addr; unsigned int limit; unsigned int seg_32bit:1; unsigned int contents:2; unsigned int read_exec_only:1; unsigned int limit_in_pages:1; unsigned int seg_not_present:1; unsigned int useable:1; }; Linux 2.4 modify_ldt_ldt_s. contents (, , (expand-down data), (non-conforming code) ). , , modify_ldt() - <<>>, . A user_desc <<>>, read_exec_only seg_not_present 1, 0. LDT , <<>> user_desc , func 1, base limit 0. (conforming code segment, . ., contents==3) , func 1 seg_not_present 0. func 2, modify_ldt() . , , Linux 2.4. modify_ldt() ( ) 0 ( ). modify_ldt() -1, errno . EFAULT ptr . EINVAL ptr 0, func 1, bytecount user_desc, func 1 0x11, LDT . ENOSYS func 0, 1, 2 0x11. Linux. modify_ldt() , . set_thread_area(2) arch_prctl(2), , . , modify_ldt() 16- 32- . , 16- . 64- modify_ldt() (. ., 64-). <> user_desc , , . 64- Linux 3.19, <> user_desc , . , <> 32- , , - 32- . . arch_prctl(2), set_thread_area(2), vm86(2) aereiae , Alexey , Azamat Hackimov , Dmitriy S. Seregin , Dmitry Bolkhovskikh , ITriskTI , Max Is , Yuri Kozlov , ; GNU 3 , . . , , . Linux man-pages 6.06 31 2023 . modify_ldt(2)