Re: get_fs() and set_fs() mm_segment_t

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

 



Hi,
On x86 platforms Linux uses FS register to keep the data segment
register with which  access user segment register. If a sys_call is made
and the kernel needs to copy data from user space then FS will have the
value USER_DS. Many kernel functions copy or return data from/to user
space. In order to use the same functions to copy/return data from/to
kernel space you need to do the followings:
mm_segment_t* old_fs;
old_fs = get_fs();
set_fs(KERNEL_DS);
/* call the kernel functions */
set_fs(old_fs);

-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux