[jj-apparmor:apparmor-next 3/14] security/apparmor/apparmorfs.c:519:undefined reference to `zstd_get_frame_header'

kernel test robot <[email protected]>
Newsgroups dev.linux.lists.oe-kbuild-all
Message-ID <[email protected]>
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/jj/linux-apparmor.git apparmor-next
head:   1555a0e2a149cba4578f5270e7fb9efb420b985f
commit: 17b5758bf35c7a113363cd7a350b7e6a251b80f4 [3/14] apparmor: Initial support for compressed policies
config: x86_64-randconfig-004-20260810 (https://download.01.org/0day-ci/archive/20260810/[email protected]/config)
compiler: gcc-12 (Debian 12.4.0-5) 12.4.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260810/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

Note: the jj-apparmor/apparmor-next HEAD 1555a0e2a149cba4578f5270e7fb9efb420b985f builds fine.
      It only hurts bisectability.

All errors (new ones prefixed by >>):

   ld: security/apparmor/apparmorfs.o: in function `aa_get_data_from_compressed':
>> security/apparmor/apparmorfs.c:519:(.text+0x2c21): undefined reference to `zstd_get_frame_header'
   ld: security/apparmor/apparmorfs.c:533:(.text+0x2cac): undefined reference to `decompress_zstd'


vim +519 security/apparmor/apparmorfs.c

   442	
   443	
   444	/*
   445	 * aa_fs - policy load/replace/remove
   446	 */
   447	
   448	/**
   449	 * aa_simple_write_to_buffer - common routine for getting policy from user
   450	 * @userbuf: user buffer to copy data from  (NOT NULL)
   451	 * @alloc_size: size of user buffer (REQUIRES: @alloc_size >= @copy_size)
   452	 * @copy_size: size of data to copy from user buffer
   453	 * @pos: position write is at in the file (NOT NULL)
   454	 *
   455	 * Returns: kernel buffer containing copy of user buffer data or an
   456	 *          ERR_PTR on failure.
   457	 */
   458	static struct aa_loaddata *aa_simple_write_to_buffer(const char __user *userbuf,
   459							     size_t alloc_size,
   460							     size_t copy_size,
   461							     loff_t *pos)
   462	{
   463		struct aa_loaddata *data;
   464	
   465		AA_BUG(copy_size > alloc_size);
   466	
   467		if (*pos != 0)
   468			/* only writes from pos 0, that is complete writes */
   469			return ERR_PTR(-ESPIPE);
   470	
   471		/* freed by caller to simple_write_to_buffer */
   472		data = aa_loaddata_alloc(alloc_size);
   473		if (IS_ERR(data))
   474			return data;
   475	
   476		data->size = copy_size;
   477		if (copy_from_user(data->data, userbuf, copy_size)) {
   478			/* trigger free - don't need to put pcount */
   479			aa_put_i_loaddata(data);
   480			return ERR_PTR(-EFAULT);
   481		}
   482	
   483		return data;
   484	}
   485	static int decompress_zstd(char *src, size_t slen, char *dst, size_t dlen);
   486	/**
   487	 * aa_get_data_from_compressed - common routine for getting compressed policy
   488	 * from user and get both compressed and uncompressed version.
   489	 * @userbuf: user buffer to copy data from  (NOT NULL)
   490	 * @buffer_size: size of user buffer
   491	 * @pos: position write is at in the file (NOT NULL)
   492	 * @compressed_data Ptr on compressed data. *compressed_data is allocated there
   493	 *
   494	 * Returns: kernel buffer containing copy of user buffer data or an
   495	 *          ERR_PTR on failure.
   496	 */
   497	
   498	static struct aa_loaddata *aa_get_data_from_compressed(const char __user *userbuf,
   499							  size_t buffer_size,
   500							  loff_t *pos,
   501							  char **compressed_data)
   502	{
   503		struct aa_loaddata *data;
   504		zstd_frame_header header;
   505		int error;
   506	
   507		if (!userbuf || !pos)
   508			return ERR_PTR(-EINVAL);
   509		if (*pos)
   510			return ERR_PTR(-ESPIPE);
   511	
   512		*compressed_data = kvmalloc(buffer_size, GFP_KERNEL);
   513		if (!*compressed_data)
   514			return ERR_PTR(-ENOMEM);
   515		error = copy_from_user(*compressed_data, userbuf, buffer_size);
   516		if (error)
   517			goto fail;
   518	
 > 519		error = zstd_get_frame_header(&header, *compressed_data, buffer_size);
   520		if (error || header.frameContentSize == ZSTD_CONTENTSIZE_UNKNOWN ||
   521		    header.frameContentSize == ZSTD_CONTENTSIZE_ERROR) {
   522			error = -EINVAL;
   523			goto fail;
   524		}
   525	
   526		data = aa_loaddata_alloc(header.frameContentSize);
   527		if (IS_ERR(data)) {
   528			error = PTR_ERR(data);
   529			goto fail;
   530		}
   531	
   532		// We then decompress the data
   533		error = decompress_zstd(*compressed_data, buffer_size, data->data,
   534					header.frameContentSize);
   535		if (error)
   536			goto fail_decompress;
   537	
   538		data->size = header.frameContentSize;
   539		return data;
   540	
   541	fail_decompress:
   542		aa_put_i_loaddata(data);
   543	fail:
   544		kvfree(*compressed_data);
   545		return ERR_PTR(error);
   546	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.