lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202211042055.fNjP8xvT-lkp@intel.com>
Date:   Fri, 4 Nov 2022 20:14:10 +0800
From:   kernel test robot <lkp@...el.com>
To:     Lv Yunlong <lyl2019@...l.ustc.edu.cn>
Cc:     llvm@...ts.linux.dev, oe-kbuild-all@...ts.linux.dev,
        linux-kernel@...r.kernel.org, Jens Axboe <axboe@...nel.dk>,
        Christoph Böhmwalder 
        <christoph.boehmwalder@...bit.com>
Subject: drivers/block/drbd/drbd_state.c:1629:3: warning: cast from 'int
 (*)(struct sk_buff *, unsigned int, struct drbd_resource_state_change *,
 enum drbd_notification_type)' to 'typeof (last_func)' (aka 'int (*)(struct
 sk_buff *, unsigned int, void *, enum drbd_...

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   ee6050c8af96bba2f81e8b0793a1fc2f998fcd20
commit: aadb22ba2f656581b2f733deb3a467c48cc618f6 drbd: Fix five use after free bugs in get_initial_state
date:   7 months ago
config: arm-buildonly-randconfig-r004-20221104
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 2bbafe04fe785a9469bea5a3737f8d7d3ce4aca2)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm cross compiling tool for clang build
        # apt-get install binutils-arm-linux-gnueabi
        # https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=aadb22ba2f656581b2f733deb3a467c48cc618f6
        git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
        git fetch --no-tags linus master
        git checkout aadb22ba2f656581b2f733deb3a467c48cc618f6
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/block/drbd/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>

All warnings (new ones prefixed by >>):

>> drivers/block/drbd/drbd_state.c:1629:3: warning: cast from 'int (*)(struct sk_buff *, unsigned int, struct drbd_resource_state_change *, enum drbd_notification_type)' to 'typeof (last_func)' (aka 'int (*)(struct sk_buff *, unsigned int, void *, enum drbd_notification_type)') converts to incompatible function type [-Wcast-function-type-strict]
                   REMEMBER_STATE_CHANGE(notify_resource_state_change,
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/block/drbd/drbd_state.c:1616:17: note: expanded from macro 'REMEMBER_STATE_CHANGE'
              last_func = (typeof(last_func))func; \
                          ^~~~~~~~~~~~~~~~~~~~~~~
>> drivers/block/drbd/drbd_state.c:1638:4: warning: cast from 'int (*)(struct sk_buff *, unsigned int, struct drbd_connection_state_change *, enum drbd_notification_type)' to 'typeof (last_func)' (aka 'int (*)(struct sk_buff *, unsigned int, void *, enum drbd_notification_type)') converts to incompatible function type [-Wcast-function-type-strict]
                           REMEMBER_STATE_CHANGE(notify_connection_state_change,
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/block/drbd/drbd_state.c:1616:17: note: expanded from macro 'REMEMBER_STATE_CHANGE'
              last_func = (typeof(last_func))func; \
                          ^~~~~~~~~~~~~~~~~~~~~~~
>> drivers/block/drbd/drbd_state.c:1647:4: warning: cast from 'int (*)(struct sk_buff *, unsigned int, struct drbd_device_state_change *, enum drbd_notification_type)' to 'typeof (last_func)' (aka 'int (*)(struct sk_buff *, unsigned int, void *, enum drbd_notification_type)') converts to incompatible function type [-Wcast-function-type-strict]
                           REMEMBER_STATE_CHANGE(notify_device_state_change,
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/block/drbd/drbd_state.c:1616:17: note: expanded from macro 'REMEMBER_STATE_CHANGE'
              last_func = (typeof(last_func))func; \
                          ^~~~~~~~~~~~~~~~~~~~~~~
>> drivers/block/drbd/drbd_state.c:1661:4: warning: cast from 'int (*)(struct sk_buff *, unsigned int, struct drbd_peer_device_state_change *, enum drbd_notification_type)' to 'typeof (last_func)' (aka 'int (*)(struct sk_buff *, unsigned int, void *, enum drbd_notification_type)') converts to incompatible function type [-Wcast-function-type-strict]
                           REMEMBER_STATE_CHANGE(notify_peer_device_state_change,
                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/block/drbd/drbd_state.c:1616:17: note: expanded from macro 'REMEMBER_STATE_CHANGE'
              last_func = (typeof(last_func))func; \
                          ^~~~~~~~~~~~~~~~~~~~~~~
   4 warnings generated.


vim +1629 drivers/block/drbd/drbd_state.c

a29728463b254c Andreas Gruenbacher 2014-07-31  1599  
a29728463b254c Andreas Gruenbacher 2014-07-31  1600  static void broadcast_state_change(struct drbd_state_change *state_change)
a29728463b254c Andreas Gruenbacher 2014-07-31  1601  {
a29728463b254c Andreas Gruenbacher 2014-07-31  1602  	struct drbd_resource_state_change *resource_state_change = &state_change->resource[0];
a29728463b254c Andreas Gruenbacher 2014-07-31  1603  	bool resource_state_has_changed;
a29728463b254c Andreas Gruenbacher 2014-07-31  1604  	unsigned int n_device, n_connection, n_peer_device, n_peer_devices;
aadb22ba2f6565 Lv Yunlong          2022-04-06  1605  	int (*last_func)(struct sk_buff *, unsigned int, void *,
a29728463b254c Andreas Gruenbacher 2014-07-31  1606  			  enum drbd_notification_type) = NULL;
805cdb8bc6da87 Kees Cook           2020-06-03  1607  	void *last_arg = NULL;
a29728463b254c Andreas Gruenbacher 2014-07-31  1608  
a29728463b254c Andreas Gruenbacher 2014-07-31  1609  #define HAS_CHANGED(state) ((state)[OLD] != (state)[NEW])
a29728463b254c Andreas Gruenbacher 2014-07-31  1610  #define FINAL_STATE_CHANGE(type) \
a29728463b254c Andreas Gruenbacher 2014-07-31  1611  	({ if (last_func) \
a29728463b254c Andreas Gruenbacher 2014-07-31  1612  		last_func(NULL, 0, last_arg, type); \
a29728463b254c Andreas Gruenbacher 2014-07-31  1613  	})
a29728463b254c Andreas Gruenbacher 2014-07-31  1614  #define REMEMBER_STATE_CHANGE(func, arg, type) \
a29728463b254c Andreas Gruenbacher 2014-07-31  1615  	({ FINAL_STATE_CHANGE(type | NOTIFY_CONTINUES); \
a29728463b254c Andreas Gruenbacher 2014-07-31 @1616  	   last_func = (typeof(last_func))func; \
a29728463b254c Andreas Gruenbacher 2014-07-31  1617  	   last_arg = arg; \
a29728463b254c Andreas Gruenbacher 2014-07-31  1618  	 })
a29728463b254c Andreas Gruenbacher 2014-07-31  1619  
a29728463b254c Andreas Gruenbacher 2014-07-31  1620  	mutex_lock(&notification_mutex);
a29728463b254c Andreas Gruenbacher 2014-07-31  1621  
a29728463b254c Andreas Gruenbacher 2014-07-31  1622  	resource_state_has_changed =
a29728463b254c Andreas Gruenbacher 2014-07-31  1623  	    HAS_CHANGED(resource_state_change->role) ||
a29728463b254c Andreas Gruenbacher 2014-07-31  1624  	    HAS_CHANGED(resource_state_change->susp) ||
a29728463b254c Andreas Gruenbacher 2014-07-31  1625  	    HAS_CHANGED(resource_state_change->susp_nod) ||
a29728463b254c Andreas Gruenbacher 2014-07-31  1626  	    HAS_CHANGED(resource_state_change->susp_fen);
a29728463b254c Andreas Gruenbacher 2014-07-31  1627  
a29728463b254c Andreas Gruenbacher 2014-07-31  1628  	if (resource_state_has_changed)
a29728463b254c Andreas Gruenbacher 2014-07-31 @1629  		REMEMBER_STATE_CHANGE(notify_resource_state_change,
a29728463b254c Andreas Gruenbacher 2014-07-31  1630  				      resource_state_change, NOTIFY_CHANGE);
a29728463b254c Andreas Gruenbacher 2014-07-31  1631  
a29728463b254c Andreas Gruenbacher 2014-07-31  1632  	for (n_connection = 0; n_connection < state_change->n_connections; n_connection++) {
a29728463b254c Andreas Gruenbacher 2014-07-31  1633  		struct drbd_connection_state_change *connection_state_change =
a29728463b254c Andreas Gruenbacher 2014-07-31  1634  				&state_change->connections[n_connection];
a29728463b254c Andreas Gruenbacher 2014-07-31  1635  
a29728463b254c Andreas Gruenbacher 2014-07-31  1636  		if (HAS_CHANGED(connection_state_change->peer_role) ||
a29728463b254c Andreas Gruenbacher 2014-07-31  1637  		    HAS_CHANGED(connection_state_change->cstate))
a29728463b254c Andreas Gruenbacher 2014-07-31 @1638  			REMEMBER_STATE_CHANGE(notify_connection_state_change,
a29728463b254c Andreas Gruenbacher 2014-07-31  1639  					      connection_state_change, NOTIFY_CHANGE);
a29728463b254c Andreas Gruenbacher 2014-07-31  1640  	}
a29728463b254c Andreas Gruenbacher 2014-07-31  1641  
a29728463b254c Andreas Gruenbacher 2014-07-31  1642  	for (n_device = 0; n_device < state_change->n_devices; n_device++) {
a29728463b254c Andreas Gruenbacher 2014-07-31  1643  		struct drbd_device_state_change *device_state_change =
a29728463b254c Andreas Gruenbacher 2014-07-31  1644  			&state_change->devices[n_device];
a29728463b254c Andreas Gruenbacher 2014-07-31  1645  
a29728463b254c Andreas Gruenbacher 2014-07-31  1646  		if (HAS_CHANGED(device_state_change->disk_state))
a29728463b254c Andreas Gruenbacher 2014-07-31 @1647  			REMEMBER_STATE_CHANGE(notify_device_state_change,
a29728463b254c Andreas Gruenbacher 2014-07-31  1648  					      device_state_change, NOTIFY_CHANGE);
a29728463b254c Andreas Gruenbacher 2014-07-31  1649  	}
a29728463b254c Andreas Gruenbacher 2014-07-31  1650  
a29728463b254c Andreas Gruenbacher 2014-07-31  1651  	n_peer_devices = state_change->n_devices * state_change->n_connections;
a29728463b254c Andreas Gruenbacher 2014-07-31  1652  	for (n_peer_device = 0; n_peer_device < n_peer_devices; n_peer_device++) {
a29728463b254c Andreas Gruenbacher 2014-07-31  1653  		struct drbd_peer_device_state_change *p =
a29728463b254c Andreas Gruenbacher 2014-07-31  1654  			&state_change->peer_devices[n_peer_device];
a29728463b254c Andreas Gruenbacher 2014-07-31  1655  
a29728463b254c Andreas Gruenbacher 2014-07-31  1656  		if (HAS_CHANGED(p->disk_state) ||
a29728463b254c Andreas Gruenbacher 2014-07-31  1657  		    HAS_CHANGED(p->repl_state) ||
a29728463b254c Andreas Gruenbacher 2014-07-31  1658  		    HAS_CHANGED(p->resync_susp_user) ||
a29728463b254c Andreas Gruenbacher 2014-07-31  1659  		    HAS_CHANGED(p->resync_susp_peer) ||
a29728463b254c Andreas Gruenbacher 2014-07-31  1660  		    HAS_CHANGED(p->resync_susp_dependency))
a29728463b254c Andreas Gruenbacher 2014-07-31 @1661  			REMEMBER_STATE_CHANGE(notify_peer_device_state_change,
a29728463b254c Andreas Gruenbacher 2014-07-31  1662  					      p, NOTIFY_CHANGE);
a29728463b254c Andreas Gruenbacher 2014-07-31  1663  	}
a29728463b254c Andreas Gruenbacher 2014-07-31  1664  
a29728463b254c Andreas Gruenbacher 2014-07-31  1665  	FINAL_STATE_CHANGE(NOTIFY_CHANGE);
a29728463b254c Andreas Gruenbacher 2014-07-31  1666  	mutex_unlock(&notification_mutex);
a29728463b254c Andreas Gruenbacher 2014-07-31  1667  

:::::: The code at line 1629 was first introduced by commit
:::::: a29728463b254ce81ecefdf20c1a02e01d9361da drbd: Backport the "events2" command

:::::: TO: Andreas Gruenbacher <agruen@...bit.com>
:::::: CC: Jens Axboe <axboe@...com>

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

View attachment "config" of type "text/plain" (155055 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ