[hare-scsi-devel:tls-upcall.v4 145/156] drivers/nvme/host/tcp.c:1814: undefined reference to `tls_client_hello'

From: kernel test robot
Date: Sun Mar 13 2022 - 17:14:24 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git tls-upcall.v4
head: d2416ecdb6b03fc2e4aa40b20cdf919322713224
commit: 0683576e9521319c36f3a3a728cc0f9205a51065 [145/156] nvme-tcp: start TLS if requested
config: i386-randconfig-a012 (https://download.01.org/0day-ci/archive/20220314/202203140523.xM6MD8hZ-lkp@xxxxxxxxx/config)
compiler: gcc-9 (Ubuntu 9.4.0-1ubuntu1~20.04) 9.4.0
reproduce (this is a W=1 build):
# https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git/commit/?id=0683576e9521319c36f3a3a728cc0f9205a51065
git remote add hare-scsi-devel https://git.kernel.org/pub/scm/linux/kernel/git/hare/scsi-devel.git
git fetch --no-tags hare-scsi-devel tls-upcall.v4
git checkout 0683576e9521319c36f3a3a728cc0f9205a51065
# save the config file to linux build tree
mkdir build_dir
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

ld: drivers/nvme/host/core.o: in function `nvme_core_exit':
drivers/nvme/host/core.c:4946: undefined reference to `nvme_keyring_exit'
ld: drivers/nvme/host/core.o: in function `nvme_core_init':
drivers/nvme/host/core.c:4918: undefined reference to `nvme_keyring_init'
ld: drivers/nvme/host/tcp.o: in function `nvme_tcp_lookup_psk':
drivers/nvme/host/tcp.c:1764: undefined reference to `nvme_keyring_lookup_generated_key'
ld: drivers/nvme/host/tcp.c:1780: undefined reference to `nvme_keyring_insert_tls'
ld: drivers/nvme/host/tcp.o: in function `nvme_tcp_start_tls_with_key':
>> drivers/nvme/host/tcp.c:1814: undefined reference to `tls_client_hello'
ld: drivers/nvme/host/tcp.o: in function `nvme_tcp_lookup_psk':
>> drivers/nvme/host/tcp.c:1775: undefined reference to `nvme_keyring_lookup_tls'
ld: drivers/nvme/host/tcp.c:1778: undefined reference to `nvme_keyring_lookup_retained_key'


vim +1814 drivers/nvme/host/tcp.c

1737
1738 /*
1739 * nvme_tcp_lookup_psk - Look up PSKs to use for TLS
1740 *
1741 * We have several combinations to worry about:
1742 * 1) Host requires encryption (opts->tls is set)
1743 * -> lookup pre-provisioned TLS PSKs; keys must be set for
1744 * a connection to be allowed.
1745 * 2) Host allows encryptionn (opts->tls is not set)
1746 * -> lookup pre-provisioned TLS PSK;
1747 * -> lookup retained TLS key if no PSKs are found, and
1748 * generate PSK based on the retained TLS key.
1749 * -> Do not start TLS if no key (PSK or retained) is found.
1750 * 2) Host does not use encryption (opts->tls is not set)
1751 * -> no keys are provisioned.
1752 */
1753 static struct key *nvme_tcp_lookup_psk(struct nvme_ctrl *nctrl, int qid,
1754 int hmac, bool generated)
1755 {
1756 char *hostnqn = nctrl->opts->host->nqn;
1757 char *subnqn = nvmf_ctrl_subsysnqn(nctrl);
1758 struct key *nvme_key, *tls_key;
1759 bool force_tls = nctrl->opts->tls;
1760
1761 /* Check for pre-provisioned keys */
1762 if (generated) {
1763 /* Lookup generated key */
1764 nvme_key = nvme_keyring_lookup_generated_key(hostnqn, subnqn,
1765 hmac);
1766 if (!IS_ERR(nvme_key)) {
1767 tls_key = nvme_keyring_insert_tls(nvme_key, nctrl,
1768 hmac, true);
1769 key_put(nvme_key);
1770 return tls_key;
1771 }
1772 return ERR_PTR(-ENOKEY);
1773 }
1774 /* Lookup retained key */
> 1775 tls_key = nvme_keyring_lookup_tls(nctrl, hmac, false);
1776 if (IS_ERR(tls_key) && !force_tls) {
1777 /* Not found, derive key from PSK if present */
1778 nvme_key = nvme_keyring_lookup_retained_key(hostnqn, hmac);
1779 if (!IS_ERR(nvme_key)) {
1780 tls_key = nvme_keyring_insert_tls(nvme_key, nctrl,
1781 hmac, false);
1782 key_put(nvme_key);
1783 return tls_key;
1784 }
1785 }
1786 return ERR_PTR(-ENOKEY);
1787 }
1788
1789 static void nvme_tcp_tls_handshake_done(void *data, int status)
1790 {
1791 struct nvme_tcp_queue *queue = data;
1792
1793 queue->tls_err = status;
1794 if (queue->tls_complete)
1795 complete(queue->tls_complete);
1796 }
1797
1798 static int nvme_tcp_start_tls_with_key(struct nvme_ctrl *nctrl, int qid,
1799 struct key *tls_key)
1800 {
1801 struct nvme_tcp_ctrl *ctrl = to_tcp_ctrl(nctrl);
1802 struct nvme_tcp_queue *queue = &ctrl->queues[qid];
1803 DECLARE_COMPLETION_ONSTACK(tls_complete);
1804 unsigned long tmo = 10 * HZ;
1805 int rc;
1806
1807 queue->tls_complete = &tls_complete;
1808 queue->tls_err = -EOPNOTSUPP;
1809
1810 dev_dbg(nctrl->device,
1811 "starting TLS handshake on queue %d with key %u\n",
1812 nvme_tcp_queue_id(queue), tls_key->serial);
1813
> 1814 rc = tls_client_hello(queue->sock, nvme_tcp_tls_handshake_done,
1815 queue, NULL, tls_key->serial);
1816 if (rc) {
1817 queue->tls_complete = NULL;
1818 dev_err(nctrl->device, "error %d starting TLS handshake\n", rc);
1819 return rc;
1820 }
1821
1822 if (wait_for_completion_timeout(queue->tls_complete, tmo) == 0)
1823 rc = -ETIMEDOUT;
1824 else
1825 rc = queue->tls_err;
1826
1827 queue->tls_complete = NULL;
1828 dev_dbg(nctrl->device,
1829 "TLS handshake on queue %d complete, tmo %lu, error %d\n",
1830 nvme_tcp_queue_id(queue), tmo, rc);
1831 return rc;
1832 }
1833

---
0-DAY CI Kernel Test Service
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx