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: <202208200821.ZCtdp6wi-lkp@intel.com>
Date:   Sat, 20 Aug 2022 08:13:53 +0800
From:   kernel test robot <lkp@...el.com>
To:     Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: [intel-tdx:guest-hardening-rebased 35/36]
 drivers/virtio/virtio_mmio.c:611:13: error: implicit declaration of function
 'cc_platform_has'

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: microblaze-buildonly-randconfig-r001-20220820 (https://download.01.org/0day-ci/archive/20220820/202208200821.ZCtdp6wi-lkp@intel.com/config)
compiler: microblaze-linux-gcc (GCC) 12.1.0
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=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=microblaze 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 >>):

   In file included from include/linux/build_bug.h:5,
                    from include/linux/bits.h:22,
                    from include/linux/ioport.h:13,
                    from include/linux/acpi.h:12,
                    from drivers/virtio/virtio_mmio.c:57:
   drivers/virtio/virtio_mmio.c: In function 'virtio_mmio_probe':
>> drivers/virtio/virtio_mmio.c:611:13: error: implicit declaration of function 'cc_platform_has' [-Werror=implicit-function-declaration]
     611 |         if (cc_platform_has(CC_ATTR_GUEST_HARDENED))
         |             ^~~~~~~~~~~~~~~
   include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
      58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
         |                                                    ^~~~
   drivers/virtio/virtio_mmio.c:611:9: note: in expansion of macro 'if'
     611 |         if (cc_platform_has(CC_ATTR_GUEST_HARDENED))
         |         ^~
>> drivers/virtio/virtio_mmio.c:611:29: error: 'CC_ATTR_GUEST_HARDENED' undeclared (first use in this function)
     611 |         if (cc_platform_has(CC_ATTR_GUEST_HARDENED))
         |                             ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
      58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
         |                                                    ^~~~
   drivers/virtio/virtio_mmio.c:611:9: note: in expansion of macro 'if'
     611 |         if (cc_platform_has(CC_ATTR_GUEST_HARDENED))
         |         ^~
   drivers/virtio/virtio_mmio.c:611:29: note: each undeclared identifier is reported only once for each function it appears in
     611 |         if (cc_platform_has(CC_ATTR_GUEST_HARDENED))
         |                             ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/compiler.h:58:52: note: in definition of macro '__trace_if_var'
      58 | #define __trace_if_var(cond) (__builtin_constant_p(cond) ? (cond) : __trace_if_value(cond))
         |                                                    ^~~~
   drivers/virtio/virtio_mmio.c:611:9: note: in expansion of macro 'if'
     611 |         if (cc_platform_has(CC_ATTR_GUEST_HARDENED))
         |         ^~
   cc1: some warnings being treated as errors


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