Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1583846 > unrolled thread

[PATCH v2 3/3] Make vmbus register arguments read-only

Started byEddie Kovsky <ewk@edkovsky.org>
First post2017-02-18 07:10 +0100
Last post2017-02-18 07:40 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v2 3/3] Make vmbus register arguments read-only Eddie Kovsky <ewk@edkovsky.org> - 2017-02-18 07:10 +0100
    Re: [PATCH v2 3/3] Make vmbus register arguments read-only kbuild test robot <lkp@intel.com> - 2017-02-18 07:40 +0100

#1583846 — [PATCH v2 3/3] Make vmbus register arguments read-only

FromEddie Kovsky <ewk@edkovsky.org>
Date2017-02-18 07:10 +0100
Subject[PATCH v2 3/3] Make vmbus register arguments read-only
Message-ID<tc6nv-6t9-1@gated-at.bofh.it>
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(+)

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);

--
2.11.1

[toc] | [next] | [standalone]


#1583853

Fromkbuild test robot <lkp@intel.com>
Date2017-02-18 07:40 +0100
Message-ID<tc6Qy-6G5-5@gated-at.bofh.it>
In reply to#1583846

[Multipart message — attachments visible in raw view] — view raw

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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web