gnab / rtl8812au

Realtek 802.11n WLAN Adapter Linux driver
1.68k stars 547 forks source link

set_fs() fixes for 5.10 #213

Closed groverb closed 3 years ago

groverb commented 3 years ago

set_fs() is being deprecated in 5.10 on account of some security problems (https://lwn.net/Articles/832121) and thus causes build problems. This replaces set_fs() with kernel_read() and kernel_write() to r&w to kernel's address space.

(build & runtime tested on 5.10.0-rc4)

groverb commented 3 years ago

for reference, these are the bulid errors that occur on 5.10.x

/root/rtl8812au/os_dep/osdep_service.c: In function ‘isFileReadable’:
/root/rtl8812au/os_dep/osdep_service.c:1559:11: error: incompatible types when assigning to type ‘mm_segment_t’ {aka ‘struct <anonymous>’
 1559 |   oldfs = get_fs(); set_fs(KERNEL_DS);
      |           ^~~~~~
/root/rtl8812au/os_dep/osdep_service.c:1559:28: error: ‘KERNEL_DS’ undeclared (first use in this function); did you mean ‘KERNFS_NS’?
 1559 |   oldfs = get_fs(); set_fs(KERNEL_DS);
      |                            ^~~~~~~~~
      |                            KERNFS_NS
/root/rtl8812au/os_dep/osdep_service.c:1559:28: note: each undeclared identifier is reported only once for each function it appears in
/root/rtl8812au/os_dep/osdep_service.c: In function ‘retriveFromFile’:
/root/rtl8812au/os_dep/osdep_service.c:1587:12: error: incompatible types when assigning to type ‘mm_segment_t’ {aka ‘struct <anonymous>’
 1587 |    oldfs = get_fs(); set_fs(KERNEL_DS);
      |            ^~~~~~
/root/rtl8812au/os_dep/osdep_service.c:1587:29: error: ‘KERNEL_DS’ undeclared (first use in this function); did you mean ‘KERNFS_NS’?
 1587 |    oldfs = get_fs(); set_fs(KERNEL_DS);
      |                             ^~~~~~~~~
      |                             KERNFS_NS
/root/rtl8812au/os_dep/osdep_service.c: In function ‘storeToFile’:
/root/rtl8812au/os_dep/osdep_service.c:1621:12: error: incompatible types when assigning to type ‘mm_segment_t’ {aka ‘struct <anonymous>’
 1621 |    oldfs = get_fs(); set_fs(KERNEL_DS);
      |            ^~~~~~
/root/rtl8812au/os_dep/osdep_service.c:1621:29: error: ‘KERNEL_DS’ undeclared (first use in this function); did you mean ‘KERNFS_NS’?
 1621 |    oldfs = get_fs(); set_fs(KERNEL_DS);
      |                             ^~~~~~~~~
      |                             KERNFS_NS