Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:arch\x86\kernel\tls.c Create Date:2022-07-28 07:52:12
Last Modify:2022-05-18 16:59:10 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:do_get_thread_area

Proto:int do_get_thread_area(struct task_struct *p, int idx, struct user_desc __user *u_info)

Type:int

Parameter:

TypeParameterName
struct task_struct *p
intidx
struct user_desc __user *u_info
226  If idx == -1 && Get a simple variable from user space(idx, & entry_number) Then Return -EFAULT
229  If idx < The layout of the per-CPU GDT under Linux:* 0 - null <=== cacheline #1* 1 - reserved* 2 - reserved* 3 - reserved* 4 - unused <=== cacheline #2* 5 - unused* ------- start of TLS (Thread-Local Storage) segments:* 6 - TLS segment #1 [ glibc's TLS segment ]* || idx > GDT_ENTRY_TLS_MAX Then Return -EINVAL
232  index = idx - The layout of the per-CPU GDT under Linux:* 0 - null <=== cacheline #1* 1 - reserved* 2 - reserved* 3 - reserved* 4 - unused <=== cacheline #2* 5 - unused* ------- start of TLS (Thread-Local Storage) segments:* 6 - TLS segment #1 [ glibc's TLS segment ]*
233  index = array_index_nospec - sanitize an array index after a bounds check* For a code sequence like:* if (index < size) {* index = array_index_nospec(index, size);* val = array[index];* }* (index, GDT_ENTRY_TLS_MAX - The layout of the per-CPU GDT under Linux:* 0 - null <=== cacheline #1* 1 - reserved* 2 - reserved* 3 - reserved* 4 - unused <=== cacheline #2* 5 - unused* ------- start of TLS (Thread-Local Storage) segments:* 6 - TLS segment #1 [ glibc's TLS segment ]* + 1)
236  Get the current Thread-Local Storage area:
238  If copy_to_user(u_info, & info, size of info ) Then Return -EFAULT
240  Return 0