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  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]
Date:   Sun, 23 Aug 2020 15:10:07 +0800
From:   kernel test robot <lkp@...el.com>
To:     Stephan Müller <smueller@...onox.de>,
        Arnd Bergmann <arnd@...db.de>
Cc:     kbuild-all@...ts.01.org,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-crypto@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>,
        linux-api@...r.kernel.org,
        "Eric W. Biederman" <ebiederm@...ssion.com>,
        "Alexander E. Patrakov" <patrakov@...il.com>,
        "Ahmed S. Darwish" <darwish.07@...il.com>,
        "Theodore Y. Ts'o" <tytso@....edu>, Willy Tarreau <w@....eu>
Subject: Re: [PATCH v33 03/12] LRNG - sysctls and /proc interface

Hi "Stephan,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on char-misc/char-misc-testing]
[also build test WARNING on cryptodev/master crypto/master v5.9-rc1 next-20200821]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Stephan-M-ller/dev-random-a-new-approach-with-full-SP800-90B-compliance/20200821-140523
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git d162219c655c8cf8003128a13840d6c1e183fb80
config: arm64-randconfig-s031-20200821 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.2-191-g10164920-dirty
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=arm64 

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


sparse warnings: (new ones prefixed by >>)

>> drivers/char/lrng/lrng_proc.c:49:50: sparse: sparse: incorrect type in argument 3 (different address spaces) @@     expected void * @@     got void [noderef] __user *buffer @@
>> drivers/char/lrng/lrng_proc.c:49:50: sparse:     expected void *
>> drivers/char/lrng/lrng_proc.c:49:50: sparse:     got void [noderef] __user *buffer
>> drivers/char/lrng/lrng_proc.c:100:35: sparse: sparse: incorrect type in initializer (incompatible argument 3 (different address spaces)) @@     expected int ( [usertype] *proc_handler )( ... ) @@     got int ( * )( ... ) @@
>> drivers/char/lrng/lrng_proc.c:100:35: sparse:     expected int ( [usertype] *proc_handler )( ... )
>> drivers/char/lrng/lrng_proc.c:100:35: sparse:     got int ( * )( ... )
   drivers/char/lrng/lrng_proc.c:106:35: sparse: sparse: incorrect type in initializer (incompatible argument 3 (different address spaces)) @@     expected int ( [usertype] *proc_handler )( ... ) @@     got int ( * )( ... ) @@
   drivers/char/lrng/lrng_proc.c:106:35: sparse:     expected int ( [usertype] *proc_handler )( ... )
   drivers/char/lrng/lrng_proc.c:106:35: sparse:     got int ( * )( ... )
>> drivers/char/lrng/lrng_proc.c:150:25: sparse: sparse: context imbalance in 'lrng_proc_type_show' - different lock contexts for basic block

# https://github.com/0day-ci/linux/commit/902758205b535f162d904f8209936aed9d6ae6d3
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Stephan-M-ller/dev-random-a-new-approach-with-full-SP800-90B-compliance/20200821-140523
git checkout 902758205b535f162d904f8209936aed9d6ae6d3
vim +49 drivers/char/lrng/lrng_proc.c

    15	
    16	/*
    17	 * This function is used to return both the bootid UUID, and random
    18	 * UUID.  The difference is in whether table->data is NULL; if it is,
    19	 * then a new UUID is generated and returned to the user.
    20	 *
    21	 * If the user accesses this via the proc interface, the UUID will be
    22	 * returned as an ASCII string in the standard UUID format; if via the
    23	 * sysctl system call, as 16 bytes of binary data.
    24	 */
    25	static int lrng_proc_do_uuid(struct ctl_table *table, int write,
    26				     void __user *buffer, size_t *lenp, loff_t *ppos)
    27	{
    28		struct ctl_table fake_table;
    29		unsigned char buf[64], tmp_uuid[16], *uuid;
    30	
    31		uuid = table->data;
    32		if (!uuid) {
    33			uuid = tmp_uuid;
    34			generate_random_uuid(uuid);
    35		} else {
    36			static DEFINE_SPINLOCK(bootid_spinlock);
    37	
    38			spin_lock(&bootid_spinlock);
    39			if (!uuid[8])
    40				generate_random_uuid(uuid);
    41			spin_unlock(&bootid_spinlock);
    42		}
    43	
    44		sprintf(buf, "%pU", uuid);
    45	
    46		fake_table.data = buf;
    47		fake_table.maxlen = sizeof(buf);
    48	
  > 49		return proc_dostring(&fake_table, write, buffer, lenp, ppos);
    50	}
    51	
    52	static int lrng_proc_do_entropy(struct ctl_table *table, int write,
    53					void *buffer, size_t *lenp, loff_t *ppos)
    54	{
    55		struct ctl_table fake_table;
    56		int entropy_count;
    57	
    58		entropy_count = lrng_avail_entropy();
    59	
    60		fake_table.data = &entropy_count;
    61		fake_table.maxlen = sizeof(entropy_count);
    62	
    63		return proc_dointvec(&fake_table, write, buffer, lenp, ppos);
    64	}
    65	
    66	static int lrng_sysctl_poolsize = LRNG_POOL_SIZE_BITS;
    67	static int lrng_min_write_thresh;
    68	static int lrng_max_write_thresh = LRNG_POOL_SIZE_BITS;
    69	static char lrng_sysctl_bootid[16];
    70	static int lrng_drng_reseed_max_min;
    71	
    72	struct ctl_table random_table[] = {
    73		{
    74			.procname	= "poolsize",
    75			.data		= &lrng_sysctl_poolsize,
    76			.maxlen		= sizeof(int),
    77			.mode		= 0444,
    78			.proc_handler	= proc_dointvec,
    79		},
    80		{
    81			.procname	= "entropy_avail",
    82			.maxlen		= sizeof(int),
    83			.mode		= 0444,
    84			.proc_handler	= lrng_proc_do_entropy,
    85		},
    86		{
    87			.procname	= "write_wakeup_threshold",
    88			.data		= &lrng_write_wakeup_bits,
    89			.maxlen		= sizeof(int),
    90			.mode		= 0644,
    91			.proc_handler	= proc_dointvec_minmax,
    92			.extra1		= &lrng_min_write_thresh,
    93			.extra2		= &lrng_max_write_thresh,
    94		},
    95		{
    96			.procname	= "boot_id",
    97			.data		= &lrng_sysctl_bootid,
    98			.maxlen		= 16,
    99			.mode		= 0444,
 > 100			.proc_handler	= lrng_proc_do_uuid,
   101		},
   102		{
   103			.procname	= "uuid",
   104			.maxlen		= 16,
   105			.mode		= 0444,
   106			.proc_handler	= lrng_proc_do_uuid,
   107		},
   108		{
   109			.procname       = "urandom_min_reseed_secs",
   110			.data           = &lrng_drng_reseed_max_time,
   111			.maxlen         = sizeof(int),
   112			.mode           = 0644,
   113			.proc_handler   = proc_dointvec,
   114			.extra1		= &lrng_drng_reseed_max_min,
   115		},
   116		{ }
   117	};
   118	
   119	/* Number of online DRNGs */
   120	static u32 numa_drngs = 1;
   121	
   122	void lrng_pool_inc_numa_node(void)
   123	{
   124		numa_drngs++;
   125	}
   126	
   127	static int lrng_proc_type_show(struct seq_file *m, void *v)
   128	{
   129		struct lrng_drng *lrng_drng_init = lrng_drng_init_instance();
   130		unsigned long flags = 0;
   131		unsigned char buf[300];
   132	
   133		lrng_drng_lock(lrng_drng_init, &flags);
   134		snprintf(buf, sizeof(buf),
   135			 "DRNG name: %s\n"
   136			 "Hash for reading entropy pool: %s\n"
   137			 "DRNG security strength: %d bits\n"
   138			 "number of DRNG instances: %u\n"
   139			 "SP800-90B compliance: %s\n"
   140			 "High-resolution timer: %s\n"
   141			 "LRNG minimally seeded: %s\n"
   142			 "LRNG fully seeded: %s\n",
   143			 lrng_drng_init->crypto_cb->lrng_drng_name(),
   144			 lrng_drng_init->crypto_cb->lrng_hash_name(),
   145			 LRNG_DRNG_SECURITY_STRENGTH_BITS, numa_drngs,
   146			 lrng_sp80090b_compliant() ? "true" : "false",
   147			 lrng_pool_highres_timer() ? "true" : "false",
   148			 lrng_state_min_seeded() ? "true" : "false",
   149			 lrng_state_fully_seeded() ? "true" : "false");
 > 150		lrng_drng_unlock(lrng_drng_init, &flags);
   151	
   152		seq_write(m, buf, strlen(buf));
   153	
   154		return 0;
   155	}
   156	

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

Download attachment ".config.gz" of type "application/gzip" (34610 bytes)

Powered by blists - more mailing lists