Re: i386: Why putting __USER_DS in kernel threads stack (%esp) ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi ...
Hi list,

Reading the kernel threads initialization code I see:

int kernel_thread(...) {

	struct pt_regs regs;
	memset(&regs, 0, sizeof(regs));
	[...]
**	regs.xds = __USER_DS;
**	regs.xes = __USER_DS;
I was checking those codes too and I think that is just for satisfying the requirement of filling struct regs. I guess it is filled with USER_DS just to pretend the way do_fork is usually called via clone/fork syscall, that is to create normal user thread. So, IMHO it is not really related to what the kernel threads will do with user data segment. In reality, kernel threads operate within kernel mode, so its effective ss/ds/cs is kernel mode ones too, for instance KERNEL_CS for cs register.

regards,

Mulyadi


--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux