Message ID | 20170218055844.1457-4-ewk@edkovsky.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Eddie, [auto build test WARNING on linus/master] [also build test WARNING on v4.10-rc8 next-20170217] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Eddie-Kovsky/provide-check-for-ro_after_init-memory-sections/20170218-141040 config: i386-randconfig-x007-201707 (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=i386 All warnings (new ones prefixed by >>): drivers/hv/vmbus_drv.c: In function '__vmbus_driver_register': >> drivers/hv/vmbus_drv.c:1056:26: warning: passing argument 1 of 'kernel_ro_address' makes integer from pointer without a cast [-Wint-conversion] ret = kernel_ro_address(&hv_driver); ^ In file included from include/linux/list.h:8:0, from include/linux/module.h:9, from drivers/hv/vmbus_drv.c:26: include/linux/kernel.h:446:12: note: expected 'long unsigned int' but argument is of type 'struct hv_driver **' extern int kernel_ro_address(unsigned long addr); ^~~~~~~~~~~~~~~~~ drivers/hv/vmbus_drv.c: In function 'vmbus_device_register': drivers/hv/vmbus_drv.c:1127:26: warning: passing argument 1 of 'kernel_ro_address' makes integer from pointer without a cast [-Wint-conversion] ret = kernel_ro_address(&child_device_obj); ^ In file included from include/linux/list.h:8:0, from include/linux/module.h:9, from drivers/hv/vmbus_drv.c:26: include/linux/kernel.h:446:12: note: expected 'long unsigned int' but argument is of type 'struct hv_device **' extern int kernel_ro_address(unsigned long addr); ^~~~~~~~~~~~~~~~~ vim +/kernel_ro_address +1056 drivers/hv/vmbus_drv.c 1040 * 1041 * Registers the given driver with Linux through the 'driver_register()' call 1042 * and sets up the hyper-v vmbus handling for this driver. 1043 * It will return the state of the 'driver_register()' call. 1044 * 1045 */ 1046 int __vmbus_driver_register(struct hv_driver *hv_driver, struct module *owner, const char *mod_name) 1047 { 1048 int ret; 1049 1050 pr_info("registering driver %s\n", hv_driver->name); 1051 1052 ret = vmbus_exists(); 1053 if (ret < 0) 1054 return ret; 1055 > 1056 ret = kernel_ro_address(&hv_driver); 1057 if (ret < 1) 1058 pr_err("Module address is not read-only."); 1059 return ret; 1060 1061 hv_driver->driver.name = hv_driver->name; 1062 hv_driver->driver.owner = owner; 1063 hv_driver->driver.mod_name = mod_name; 1064 hv_driver->driver.bus = &hv_bus; --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Hi Eddie,
[auto build test ERROR on linus/master]
[also build test ERROR on v4.10-rc8 next-20170217]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Eddie-Kovsky/provide-check-for-ro_after_init-memory-sections/20170218-141040
config: x86_64-rhel (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All errors (new ones prefixed by >>):
>> ERROR: "kernel_ro_address" [drivers/hv/hv_vmbus.ko] undefined!
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index c1b27026f744..e527454ffa59 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -1026,6 +1026,11 @@ int __vmbus_driver_register(struct hv_driver *hv_driver, struct module *owner, c if (ret < 0) return ret; + ret = kernel_ro_address(&hv_driver); + if (ret < 1) + pr_err("Module address is not read-only."); + return ret; + hv_driver->driver.name = hv_driver->name; hv_driver->driver.owner = owner; hv_driver->driver.mod_name = mod_name; @@ -1092,6 +1097,11 @@ int vmbus_device_register(struct hv_device *child_device_obj) { int ret = 0; + ret = kernel_ro_address(&child_device_obj); + if (ret < 1) + pr_err("Device address is not read-only."); + return ret; + dev_set_name(&child_device_obj->device, "%pUl", child_device_obj->channel->offermsg.offer.if_instance.b);
Use the new RO check functions introduced in this series to make the vmbus register functions verify that the address of their arguments are read-only. Addresses that fail the verification are rejected. Signed-off-by: Eddie Kovsky <ewk@edkovsky.org> --- drivers/hv/vmbus_drv.c | 10 ++++++++++ 1 file changed, 10 insertions(+) -- 2.11.1