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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202601200047.d0uwB8zw-lkp@intel.com>
Date: Tue, 20 Jan 2026 00:39:59 +0800
From: kernel test robot <lkp@...el.com>
To: Holger Dengler <dengler@...ux.ibm.com>,
	Eric Biggers <ebiggers@...nel.org>,
	David Laight <david.laight.linux@...il.com>
Cc: oe-kbuild-all@...ts.linux.dev, Ard Biesheuvel <ardb@...nel.org>,
	"Jason A . Donenfeld" <Jason@...c4.com>,
	Herbert Xu <herbert@...dor.apana.org.au>,
	Harald Freudenberger <freude@...ux.ibm.com>,
	Holger Dengler <dengler@...ux.ibm.com>,
	linux-kernel@...r.kernel.org, linux-crypto@...r.kernel.org
Subject: Re: [PATCH v2 1/1] lib/crypto: tests: Add KUnit tests for AES

Hi Holger,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 47753e09a15d9fd7cdf114550510f4f2af9333ec]

url:    https://github.com/intel-lab-lkp/linux/commits/Holger-Dengler/lib-crypto-tests-Add-KUnit-tests-for-AES/20260119-201615
base:   47753e09a15d9fd7cdf114550510f4f2af9333ec
patch link:    https://lore.kernel.org/r/20260119121210.2662-2-dengler%40linux.ibm.com
patch subject: [PATCH v2 1/1] lib/crypto: tests: Add KUnit tests for AES
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20260120/202601200047.d0uwB8zw-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 15.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260120/202601200047.d0uwB8zw-lkp@intel.com/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 <lkp@...el.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202601200047.d0uwB8zw-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from include/kunit/assert.h:13,
                    from include/kunit/test.h:12,
                    from lib/crypto/tests/aes_kunit.c:2:
   lib/crypto/tests/aes_kunit.c: In function 'benchmark_aes':
>> lib/crypto/tests/aes_kunit.c:77:45: warning: integer overflow in expression of type 'long int' results in '-1179869184' [-Woverflow]
      77 |                    div64_u64(AES_BLOCK_SIZE * NSEC_PER_SEC / 1000000,
         |                                             ^
   include/linux/printk.h:484:33: note: in definition of macro 'printk_index_wrap'
     484 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
         |                                 ^~~~~~~~~~~
   include/kunit/test.h:661:17: note: in expansion of macro 'printk'
     661 |                 printk(lvl fmt, ##__VA_ARGS__);                         \
         |                 ^~~~~~
   include/kunit/test.h:667:9: note: in expansion of macro 'kunit_log'
     667 |         kunit_log(lvl, test, KUNIT_SUBTEST_INDENT "# %s: " fmt,         \
         |         ^~~~~~~~~
   include/kunit/test.h:680:9: note: in expansion of macro 'kunit_printk'
     680 |         kunit_printk(KERN_INFO, test, fmt, ##__VA_ARGS__)
         |         ^~~~~~~~~~~~
   lib/crypto/tests/aes_kunit.c:76:9: note: in expansion of macro 'kunit_info'
      76 |         kunit_info(test, "enc (len=%zu): %llu MB/s", (size_t)AES_BLOCK_SIZE,
         |         ^~~~~~~~~~
>> lib/crypto/tests/aes_kunit.c:77:45: warning: integer overflow in expression of type 'long int' results in '-1179869184' [-Woverflow]
      77 |                    div64_u64(AES_BLOCK_SIZE * NSEC_PER_SEC / 1000000,
         |                                             ^
   include/kunit/test.h:663:36: note: in definition of macro 'kunit_log'
     663 |                                  ##__VA_ARGS__);                        \
         |                                    ^~~~~~~~~~~
   include/kunit/test.h:680:9: note: in expansion of macro 'kunit_printk'
     680 |         kunit_printk(KERN_INFO, test, fmt, ##__VA_ARGS__)
         |         ^~~~~~~~~~~~
   lib/crypto/tests/aes_kunit.c:76:9: note: in expansion of macro 'kunit_info'
      76 |         kunit_info(test, "enc (len=%zu): %llu MB/s", (size_t)AES_BLOCK_SIZE,
         |         ^~~~~~~~~~
   lib/crypto/tests/aes_kunit.c:80:45: warning: integer overflow in expression of type 'long int' results in '-1179869184' [-Woverflow]
      80 |                    div64_u64(AES_BLOCK_SIZE * NSEC_PER_SEC / 1000000,
         |                                             ^
   include/linux/printk.h:484:33: note: in definition of macro 'printk_index_wrap'
     484 |                 _p_func(_fmt, ##__VA_ARGS__);                           \
         |                                 ^~~~~~~~~~~
   include/kunit/test.h:661:17: note: in expansion of macro 'printk'
     661 |                 printk(lvl fmt, ##__VA_ARGS__);                         \
         |                 ^~~~~~
   include/kunit/test.h:667:9: note: in expansion of macro 'kunit_log'
     667 |         kunit_log(lvl, test, KUNIT_SUBTEST_INDENT "# %s: " fmt,         \
         |         ^~~~~~~~~
   include/kunit/test.h:680:9: note: in expansion of macro 'kunit_printk'
     680 |         kunit_printk(KERN_INFO, test, fmt, ##__VA_ARGS__)
         |         ^~~~~~~~~~~~
   lib/crypto/tests/aes_kunit.c:79:9: note: in expansion of macro 'kunit_info'
      79 |         kunit_info(test, "dec (len=%zu): %llu MB/s", (size_t)AES_BLOCK_SIZE,
         |         ^~~~~~~~~~
   lib/crypto/tests/aes_kunit.c:80:45: warning: integer overflow in expression of type 'long int' results in '-1179869184' [-Woverflow]
      80 |                    div64_u64(AES_BLOCK_SIZE * NSEC_PER_SEC / 1000000,
         |                                             ^
   include/kunit/test.h:663:36: note: in definition of macro 'kunit_log'
     663 |                                  ##__VA_ARGS__);                        \
         |                                    ^~~~~~~~~~~
   include/kunit/test.h:680:9: note: in expansion of macro 'kunit_printk'
     680 |         kunit_printk(KERN_INFO, test, fmt, ##__VA_ARGS__)
         |         ^~~~~~~~~~~~
   lib/crypto/tests/aes_kunit.c:79:9: note: in expansion of macro 'kunit_info'
      79 |         kunit_info(test, "dec (len=%zu): %llu MB/s", (size_t)AES_BLOCK_SIZE,
         |         ^~~~~~~~~~


vim +77 lib/crypto/tests/aes_kunit.c

   > 2	#include <kunit/test.h>
     3	#include <linux/preempt.h>
     4	#include "aes-testvecs.h"
     5	
     6	static void test_aes(struct kunit *test, const struct aes_testvector *tv,
     7			     bool enc)
     8	{
     9		struct aes_key aes_key;
    10		u8 out[AES_BLOCK_SIZE];
    11		const u8 *input, *expect;
    12		int rc;
    13	
    14		rc = aes_preparekey(&aes_key, tv->key.b, tv->key.len);
    15		KUNIT_ASSERT_EQ(test, 0, rc);
    16	
    17		if (enc) {
    18			input = tv->plain;
    19			expect = tv->cipher;
    20			aes_encrypt(&aes_key, out, input);
    21		} else {
    22			input = tv->cipher;
    23			expect = tv->plain;
    24			aes_decrypt(&aes_key, out, input);
    25		}
    26		KUNIT_ASSERT_MEMEQ(test, out, expect, sizeof(out));
    27	}
    28	
    29	static __always_inline u64 time_aes_op(bool encrypt, struct aes_key *aes_key,
    30					       u8 *out, const u8 *in)
    31	{
    32		void (*aes_op)(const struct aes_key *key, u8 *out, const u8 *in);
    33		u64 t;
    34	
    35		aes_op = encrypt ? &aes_encrypt : &aes_decrypt;
    36	
    37		preempt_disable();
    38		t = ktime_get_ns();
    39		aes_op(aes_key, out, in);
    40		t = ktime_get_ns() - t;
    41		preempt_enable();
    42	
    43		return t;
    44	}
    45	
    46	static void benchmark_aes(struct kunit *test, const struct aes_testvector *tv)
    47	{
    48		const size_t num_iters = 100;
    49		struct aes_key aes_key;
    50		u8 out[AES_BLOCK_SIZE];
    51		u64 t, t_enc, t_dec;
    52		int rc;
    53	
    54		if (!IS_ENABLED(CONFIG_CRYPTO_LIB_BENCHMARK))
    55			kunit_skip(test, "not enabled");
    56	
    57		rc = aes_preparekey(&aes_key, tv->key.b, tv->key.len);
    58		KUNIT_ASSERT_EQ(test, 0, rc);
    59	
    60		/* warm-up */
    61		for (size_t i = 0; i < num_iters; i++) {
    62			aes_encrypt(&aes_key, out, tv->plain);
    63			aes_decrypt(&aes_key, out, tv->cipher);
    64		}
    65	
    66		t_enc = NSEC_PER_SEC;
    67		t_dec = NSEC_PER_SEC;
    68		for (size_t i = 0; i < num_iters; i++) {
    69			t = time_aes_op(true, &aes_key, out, tv->plain);
    70			t_enc = MIN_T(u64, t, t_enc);
    71	
    72			t = time_aes_op(false, &aes_key, out, tv->cipher);
    73			t_dec = MIN_T(u64, t, t_dec);
    74		}
    75	
    76		kunit_info(test, "enc (len=%zu): %llu MB/s", (size_t)AES_BLOCK_SIZE,
  > 77			   div64_u64(AES_BLOCK_SIZE * NSEC_PER_SEC / 1000000,
    78				     (t_enc ?: 1)));
    79		kunit_info(test, "dec (len=%zu): %llu MB/s", (size_t)AES_BLOCK_SIZE,
    80			   div64_u64(AES_BLOCK_SIZE * NSEC_PER_SEC / 1000000,
    81				     (t_dec ?: 1)));
    82	}
    83	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ