[integrity:next-integrity-testing 3/5] security/integrity/ima/ima_asymmetric_keys.c:32:14: error: dereferencing pointer to incomplete type 'struct ima_key_entry'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/zohar/linux-integrity.git next-integrity-testing
head:   cc3e145566e2f2b697e67f01ed973b3782ba8b83
commit: f5d0a8ae6bd1e88c22a20daa2aab5acba2addb1d [3/5] IMA: Define workqueue for early boot key measurements
config: x86_64-randconfig-e003-20200105 (attached as .config)
compiler: gcc-7 (Debian 7.5.0-3) 7.5.0
reproduce:
        git checkout f5d0a8ae6bd1e88c22a20daa2aab5acba2addb1d
        # save the attached .config to linux build tree
        make ARCH=x86_64 

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

All error/warnings (new ones prefixed by >>):

>> security/integrity/ima/ima_asymmetric_keys.c:29:39: warning: 'struct ima_key_entry' declared inside parameter list will not be visible outside of this definition or declaration
    static void ima_free_key_entry(struct ima_key_entry *entry)
                                          ^~~~~~~~~~~~~
   security/integrity/ima/ima_asymmetric_keys.c: In function 'ima_free_key_entry':
>> security/integrity/ima/ima_asymmetric_keys.c:32:14: error: dereferencing pointer to incomplete type 'struct ima_key_entry'
      kfree(entry->payload);
                 ^~
   security/integrity/ima/ima_asymmetric_keys.c: In function 'ima_alloc_key_entry':
   security/integrity/ima/ima_asymmetric_keys.c:45:25: error: dereferencing pointer to incomplete type 'struct ima_key_entry'
     entry = kzalloc(sizeof(*entry), GFP_KERNEL);
                            ^~~~~~
>> security/integrity/ima/ima_asymmetric_keys.c:63:22: error: passing argument 1 of 'ima_free_key_entry' from incompatible pointer type [-Werror=incompatible-pointer-types]
      ima_free_key_entry(entry);
                         ^~~~~
   security/integrity/ima/ima_asymmetric_keys.c:29:13: note: expected 'struct ima_key_entry *' but argument is of type 'struct ima_key_entry *'
    static void ima_free_key_entry(struct ima_key_entry *entry)
                ^~~~~~~~~~~~~~~~~~
   security/integrity/ima/ima_asymmetric_keys.c: In function 'ima_queue_key':
   security/integrity/ima/ima_asymmetric_keys.c:88:22: error: passing argument 1 of 'ima_free_key_entry' from incompatible pointer type [-Werror=incompatible-pointer-types]
      ima_free_key_entry(entry);
                         ^~~~~
   security/integrity/ima/ima_asymmetric_keys.c:29:13: note: expected 'struct ima_key_entry *' but argument is of type 'struct ima_key_entry *'
    static void ima_free_key_entry(struct ima_key_entry *entry)
                ^~~~~~~~~~~~~~~~~~
   security/integrity/ima/ima_asymmetric_keys.c: At top level:
>> security/integrity/ima/ima_asymmetric_keys.c:99:6: error: redefinition of 'ima_process_queued_keys'
    void ima_process_queued_keys(void)
         ^~~~~~~~~~~~~~~~~~~~~~~
   In file included from security/integrity/ima/ima_asymmetric_keys.c:15:0:
   security/integrity/ima/ima.h:220:20: note: previous definition of 'ima_process_queued_keys' was here
    static inline void ima_process_queued_keys(void) {}
                       ^~~~~~~~~~~~~~~~~~~~~~~
   In file included from include/linux/key.h:14:0,
                    from include/linux/key-type.h:11,
                    from include/keys/asymmetric-type.h:13,
                    from security/integrity/ima/ima_asymmetric_keys.c:14:
   security/integrity/ima/ima_asymmetric_keys.c: In function 'ima_process_queued_keys':
   include/linux/list.h:664:57: warning: left-hand operand of comma expression has no effect [-Wunused-value]
     for (pos = list_first_entry(head, typeof(*pos), member), \
                                                            ^
>> security/integrity/ima/ima_asymmetric_keys.c:123:2: note: in expansion of macro 'list_for_each_entry_safe'
     list_for_each_entry_safe(entry, tmp, &ima_keys, list) {
     ^~~~~~~~~~~~~~~~~~~~~~~~
   security/integrity/ima/ima_asymmetric_keys.c:128:22: error: passing argument 1 of 'ima_free_key_entry' from incompatible pointer type [-Werror=incompatible-pointer-types]
      ima_free_key_entry(entry);
                         ^~~~~
   security/integrity/ima/ima_asymmetric_keys.c:29:13: note: expected 'struct ima_key_entry *' but argument is of type 'struct ima_key_entry *'
    static void ima_free_key_entry(struct ima_key_entry *entry)
                ^~~~~~~~~~~~~~~~~~
   At top level:
   security/integrity/ima/ima_asymmetric_keys.c:70:13: warning: 'ima_queue_key' defined but not used [-Wunused-function]
    static bool ima_queue_key(struct key *keyring, const void *payload,
                ^~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +32 security/integrity/ima/ima_asymmetric_keys.c

    13	
  > 14	#include <keys/asymmetric-type.h>
    15	#include "ima.h"
    16	
    17	/*
    18	 * Flag to indicate whether a key can be processed
    19	 * right away or should be queued for processing later.
    20	 */
    21	static bool ima_process_keys;
    22	
    23	/*
    24	 * To synchronize access to the list of keys that need to be measured
    25	 */
    26	static DEFINE_SPINLOCK(ima_keys_lock);
    27	static LIST_HEAD(ima_keys);
    28	
  > 29	static void ima_free_key_entry(struct ima_key_entry *entry)
    30	{
    31		if (entry) {
  > 32			kfree(entry->payload);
    33			kfree(entry->keyring_name);
    34			kfree(entry);
    35		}
    36	}
    37	
    38	static struct ima_key_entry *ima_alloc_key_entry(
    39		struct key *keyring,
    40		const void *payload, size_t payload_len)
    41	{
    42		int rc = 0;
    43		struct ima_key_entry *entry;
    44	
    45		entry = kzalloc(sizeof(*entry), GFP_KERNEL);
    46		if (entry) {
    47			entry->payload = kmemdup(payload, payload_len, GFP_KERNEL);
    48			entry->keyring_name = kstrdup(keyring->description,
    49						      GFP_KERNEL);
    50			entry->payload_len = payload_len;
    51		}
    52	
    53		if ((entry == NULL) || (entry->payload == NULL) ||
    54		    (entry->keyring_name == NULL)) {
    55			rc = -ENOMEM;
    56			goto out;
    57		}
    58	
    59		INIT_LIST_HEAD(&entry->list);
    60	
    61	out:
    62		if (rc) {
  > 63			ima_free_key_entry(entry);
    64			entry = NULL;
    65		}
    66	
    67		return entry;
    68	}
    69	
    70	static bool ima_queue_key(struct key *keyring, const void *payload,
    71				  size_t payload_len)
    72	{
    73		bool queued = false;
    74		struct ima_key_entry *entry;
    75	
    76		entry = ima_alloc_key_entry(keyring, payload, payload_len);
    77		if (!entry)
    78			return false;
    79	
    80		spin_lock(&ima_keys_lock);
    81		if (!ima_process_keys) {
    82			list_add_tail(&entry->list, &ima_keys);
    83			queued = true;
    84		}
    85		spin_unlock(&ima_keys_lock);
    86	
    87		if (!queued)
  > 88			ima_free_key_entry(entry);
    89	
    90		return queued;
    91	}
    92	
    93	/*
    94	 * ima_process_queued_keys() - process keys queued for measurement
    95	 *
    96	 * This function sets ima_process_keys to true and processes queued keys.
    97	 * From here on keys will be processed right away (not queued).
    98	 */
  > 99	void ima_process_queued_keys(void)
   100	{
   101		struct ima_key_entry *entry, *tmp;
   102		bool process = false;
   103	
   104		if (ima_process_keys)
   105			return;
   106	
   107		/*
   108		 * Since ima_process_keys is set to true, any new key will be
   109		 * processed immediately and not be queued to ima_keys list.
   110		 * First one setting the ima_process_keys flag to true will
   111		 * process the queued keys.
   112		 */
   113		spin_lock(&ima_keys_lock);
   114		if (!ima_process_keys) {
   115			ima_process_keys = true;
   116			process = true;
   117		}
   118		spin_unlock(&ima_keys_lock);
   119	
   120		if (!process)
   121			return;
   122	
 > 123		list_for_each_entry_safe(entry, tmp, &ima_keys, list) {
   124			process_buffer_measurement(entry->payload, entry->payload_len,
   125						   entry->keyring_name, KEY_CHECK, 0,
   126						   entry->keyring_name);
   127			list_del(&entry->list);
   128			ima_free_key_entry(entry);
   129		}
   130	}
   131	

---
0-DAY kernel test infrastructure                 Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx Intel Corporation

Attachment: .config.gz
Description: application/gzip


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux Kernel]     [Linux Kernel Hardening]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux