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: <202208200658.d5mG6HxB-lkp@intel.com>
Date:   Sat, 20 Aug 2022 06:10:37 +0800
From:   kernel test robot <lkp@...el.com>
To:     Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Cc:     llvm@...ts.linux.dev, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org
Subject: [intel-tdx:guest-hardening-rebased 35/36]
 drivers/virtio/virtio_mmio.c:611:6: error: implicit declaration of function
 'cc_platform_has' is invalid in C99

drivers/virtio/virtio_mmio.c
tree:   https://github.com/intel/tdx.git guest-hardening-rebased
head:   d941f409a509c084250b50a3b5fc1c3c84a596a0
commit: 8aee8422c3b96f5d4dde1f31f8a96409a3e55c48 [35/36] virtio-mmio: Disable in TDX guest
config: hexagon-buildonly-randconfig-r005-20220820 (https://download.01.org/0day-ci/archive/20220820/202208200658.d5mG6HxB-lkp@intel.com/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 0ac597f3cacf60479ffd36b03766fa7462dabd78)
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
        # https://github.com/intel/tdx/commit/8aee8422c3b96f5d4dde1f31f8a96409a3e55c48
        git remote add intel-tdx https://github.com/intel/tdx.git
        git fetch --no-tags intel-tdx guest-hardening-rebased
        git checkout 8aee8422c3b96f5d4dde1f31f8a96409a3e55c48
        # 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=hexagon SHELL=/bin/bash drivers/virtio/

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

All errors (new ones prefixed by >>):

>> drivers/virtio/virtio_mmio.c:611:6: error: implicit declaration of function 'cc_platform_has' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
           if (cc_platform_has(CC_ATTR_GUEST_HARDENED))
               ^
>> drivers/virtio/virtio_mmio.c:611:22: error: use of undeclared identifier 'CC_ATTR_GUEST_HARDENED'
           if (cc_platform_has(CC_ATTR_GUEST_HARDENED))
                               ^
>> drivers/virtio/virtio_mmio.c:611:22: error: use of undeclared identifier 'CC_ATTR_GUEST_HARDENED'
>> drivers/virtio/virtio_mmio.c:611:22: error: use of undeclared identifier 'CC_ATTR_GUEST_HARDENED'
   drivers/virtio/virtio_mmio.c:657:33: warning: shift count >= width of type [-Wshift-count-overflow]
                   rc = dma_set_mask(&pdev->dev, DMA_BIT_MASK(64));
                                                 ^~~~~~~~~~~~~~~~
   include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
   #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
                                                        ^ ~~~
   drivers/virtio/virtio_mmio.c:666:46: warning: shift count >= width of type [-Wshift-count-overflow]
                   rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
                                                              ^~~~~~~~~~~~~~~~
   include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
   #define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
                                                        ^ ~~~
   2 warnings and 4 errors generated.


vim +/cc_platform_has +611 drivers/virtio/virtio_mmio.c

   604	
   605	static int virtio_mmio_probe(struct platform_device *pdev)
   606	{
   607		struct virtio_mmio_device *vm_dev;
   608		unsigned long magic;
   609		int rc;
   610	
 > 611		if (cc_platform_has(CC_ATTR_GUEST_HARDENED))
   612			return -ENODEV;
   613	
   614		vm_dev = devm_kzalloc(&pdev->dev, sizeof(*vm_dev), GFP_KERNEL);
   615		if (!vm_dev)
   616			return -ENOMEM;
   617	
   618		vm_dev->vdev.dev.parent = &pdev->dev;
   619		vm_dev->vdev.dev.release = virtio_mmio_release_dev;
   620		vm_dev->vdev.config = &virtio_mmio_config_ops;
   621		vm_dev->pdev = pdev;
   622		INIT_LIST_HEAD(&vm_dev->virtqueues);
   623		spin_lock_init(&vm_dev->lock);
   624	
   625		vm_dev->base = devm_platform_ioremap_resource(pdev, 0);
   626		if (IS_ERR(vm_dev->base))
   627			return PTR_ERR(vm_dev->base);
   628	
   629		/* Check magic value */
   630		magic = readl(vm_dev->base + VIRTIO_MMIO_MAGIC_VALUE);
   631		if (magic != ('v' | 'i' << 8 | 'r' << 16 | 't' << 24)) {
   632			dev_warn(&pdev->dev, "Wrong magic value 0x%08lx!\n", magic);
   633			return -ENODEV;
   634		}
   635	
   636		/* Check device version */
   637		vm_dev->version = readl(vm_dev->base + VIRTIO_MMIO_VERSION);
   638		if (vm_dev->version < 1 || vm_dev->version > 2) {
   639			dev_err(&pdev->dev, "Version %ld not supported!\n",
   640					vm_dev->version);
   641			return -ENXIO;
   642		}
   643	
   644		vm_dev->vdev.id.device = readl(vm_dev->base + VIRTIO_MMIO_DEVICE_ID);
   645		if (vm_dev->vdev.id.device == 0) {
   646			/*
   647			 * virtio-mmio device with an ID 0 is a (dummy) placeholder
   648			 * with no function. End probing now with no error reported.
   649			 */
   650			return -ENODEV;
   651		}
   652		vm_dev->vdev.id.vendor = readl(vm_dev->base + VIRTIO_MMIO_VENDOR_ID);
   653	
   654		if (vm_dev->version == 1) {
   655			writel(PAGE_SIZE, vm_dev->base + VIRTIO_MMIO_GUEST_PAGE_SIZE);
   656	
   657			rc = dma_set_mask(&pdev->dev, DMA_BIT_MASK(64));
   658			/*
   659			 * In the legacy case, ensure our coherently-allocated virtio
   660			 * ring will be at an address expressable as a 32-bit PFN.
   661			 */
   662			if (!rc)
   663				dma_set_coherent_mask(&pdev->dev,
   664						      DMA_BIT_MASK(32 + PAGE_SHIFT));
   665		} else {
   666			rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
   667		}
   668		if (rc)
   669			rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
   670		if (rc)
   671			dev_warn(&pdev->dev, "Failed to enable 64-bit or 32-bit DMA.  Trying to continue, but this might not work.\n");
   672	
   673		platform_set_drvdata(pdev, vm_dev);
   674	
   675		rc = register_virtio_device(&vm_dev->vdev);
   676		if (rc)
   677			put_device(&vm_dev->vdev.dev);
   678	
   679		return rc;
   680	}
   681	

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ