tree:   https://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git 
dev.2019.10.02a
head:   06250c65ccb8bd7cbaffe62ed0cc638c0f15b49c
commit: 06250c65ccb8bd7cbaffe62ed0cc638c0f15b49c [24/24] rcu: Remove 
rcu_swap_protected()
config: i386-randconfig-a002-201940 (attached as .config)
compiler: gcc-6 (Debian 6.3.0-18+deb9u1) 6.3.0 20170516
reproduce:
        git checkout 06250c65ccb8bd7cbaffe62ed0cc638c0f15b49c
        # save the attached .config to linux build tree
        make ARCH=i386 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <l...@intel.com>

All errors (new ones prefixed by >>):

   security/safesetid/securityfs.c: In function 'handle_policy_update':
>> security/safesetid/securityfs.c:182:2: error: implicit declaration of 
>> function 'rcu_swap_protected' [-Werror=implicit-function-declaration]
     rcu_swap_protected(safesetid_setuid_rules, pol,
     ^~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +/rcu_swap_protected +182 security/safesetid/securityfs.c

4f72123da57965 Jann Horn    2019-04-11  109  
03638e62f55f27 Jann Horn    2019-04-10  110  static ssize_t 
handle_policy_update(struct file *file,
03638e62f55f27 Jann Horn    2019-04-10  111                                 
const char __user *ubuf, size_t len)
03638e62f55f27 Jann Horn    2019-04-10  112  {
03638e62f55f27 Jann Horn    2019-04-10  113     struct setuid_ruleset *pol;
03638e62f55f27 Jann Horn    2019-04-10  114     char *buf, *p, *end;
03638e62f55f27 Jann Horn    2019-04-10  115     int err;
03638e62f55f27 Jann Horn    2019-04-10  116  
03638e62f55f27 Jann Horn    2019-04-10  117     pol = kmalloc(sizeof(struct 
setuid_ruleset), GFP_KERNEL);
03638e62f55f27 Jann Horn    2019-04-10  118     if (!pol)
03638e62f55f27 Jann Horn    2019-04-10  119             return -ENOMEM;
fbd9acb2dc2aa5 Jann Horn    2019-04-11  120     pol->policy_str = NULL;
03638e62f55f27 Jann Horn    2019-04-10  121     hash_init(pol->rules);
03638e62f55f27 Jann Horn    2019-04-10  122  
03638e62f55f27 Jann Horn    2019-04-10  123     p = buf = memdup_user_nul(ubuf, 
len);
03638e62f55f27 Jann Horn    2019-04-10  124     if (IS_ERR(buf)) {
03638e62f55f27 Jann Horn    2019-04-10  125             err = PTR_ERR(buf);
03638e62f55f27 Jann Horn    2019-04-10  126             goto out_free_pol;
03638e62f55f27 Jann Horn    2019-04-10  127     }
fbd9acb2dc2aa5 Jann Horn    2019-04-11  128     pol->policy_str = kstrdup(buf, 
GFP_KERNEL);
fbd9acb2dc2aa5 Jann Horn    2019-04-11  129     if (pol->policy_str == NULL) {
fbd9acb2dc2aa5 Jann Horn    2019-04-11  130             err = -ENOMEM;
fbd9acb2dc2aa5 Jann Horn    2019-04-11  131             goto out_free_buf;
fbd9acb2dc2aa5 Jann Horn    2019-04-11  132     }
03638e62f55f27 Jann Horn    2019-04-10  133  
03638e62f55f27 Jann Horn    2019-04-10  134     /* policy lines, including the 
last one, end with \n */
03638e62f55f27 Jann Horn    2019-04-10  135     while (*p != '\0') {
03638e62f55f27 Jann Horn    2019-04-10  136             struct setuid_rule 
*rule;
03638e62f55f27 Jann Horn    2019-04-10  137  
03638e62f55f27 Jann Horn    2019-04-10  138             end = strchr(p, '\n');
03638e62f55f27 Jann Horn    2019-04-10  139             if (end == NULL) {
03638e62f55f27 Jann Horn    2019-04-10  140                     err = -EINVAL;
03638e62f55f27 Jann Horn    2019-04-10  141                     goto 
out_free_buf;
03638e62f55f27 Jann Horn    2019-04-10  142             }
03638e62f55f27 Jann Horn    2019-04-10  143             *end = '\0';
03638e62f55f27 Jann Horn    2019-04-10  144  
03638e62f55f27 Jann Horn    2019-04-10  145             rule = 
kmalloc(sizeof(struct setuid_rule), GFP_KERNEL);
03638e62f55f27 Jann Horn    2019-04-10  146             if (!rule) {
03638e62f55f27 Jann Horn    2019-04-10  147                     err = -ENOMEM;
03638e62f55f27 Jann Horn    2019-04-10  148                     goto 
out_free_buf;
03638e62f55f27 Jann Horn    2019-04-10  149             }
03638e62f55f27 Jann Horn    2019-04-10  150  
03638e62f55f27 Jann Horn    2019-04-10  151             err = 
parse_policy_line(file, p, rule);
03638e62f55f27 Jann Horn    2019-04-10  152             if (err)
03638e62f55f27 Jann Horn    2019-04-10  153                     goto 
out_free_rule;
03638e62f55f27 Jann Horn    2019-04-10  154  
03638e62f55f27 Jann Horn    2019-04-10  155             if 
(_setuid_policy_lookup(pol, rule->src_uid, rule->dst_uid) ==
03638e62f55f27 Jann Horn    2019-04-10  156                 SIDPOL_ALLOWED) {
03638e62f55f27 Jann Horn    2019-04-10  157                     pr_warn("bad 
policy: duplicate entry\n");
03638e62f55f27 Jann Horn    2019-04-10  158                     err = -EEXIST;
03638e62f55f27 Jann Horn    2019-04-10  159                     goto 
out_free_rule;
03638e62f55f27 Jann Horn    2019-04-10  160             }
03638e62f55f27 Jann Horn    2019-04-10  161  
4f72123da57965 Jann Horn    2019-04-11  162             insert_rule(pol, rule);
03638e62f55f27 Jann Horn    2019-04-10  163             p = end + 1;
03638e62f55f27 Jann Horn    2019-04-10  164             continue;
03638e62f55f27 Jann Horn    2019-04-10  165  
03638e62f55f27 Jann Horn    2019-04-10  166  out_free_rule:
03638e62f55f27 Jann Horn    2019-04-10  167             kfree(rule);
03638e62f55f27 Jann Horn    2019-04-10  168             goto out_free_buf;
03638e62f55f27 Jann Horn    2019-04-10  169     }
03638e62f55f27 Jann Horn    2019-04-10  170  
4f72123da57965 Jann Horn    2019-04-11  171     err = verify_ruleset(pol);
4f72123da57965 Jann Horn    2019-04-11  172     /* bogus policy falls through 
after fixing it up */
4f72123da57965 Jann Horn    2019-04-11  173     if (err && err != -EINVAL)
4f72123da57965 Jann Horn    2019-04-11  174             goto out_free_buf;
4f72123da57965 Jann Horn    2019-04-11  175  
03638e62f55f27 Jann Horn    2019-04-10  176     /*
03638e62f55f27 Jann Horn    2019-04-10  177      * Everything looks good, apply 
the policy and release the old one.
03638e62f55f27 Jann Horn    2019-04-10  178      * What we really want here is 
an xchg() wrapper for RCU, but since that
03638e62f55f27 Jann Horn    2019-04-10  179      * doesn't currently exist, 
just use a spinlock for now.
03638e62f55f27 Jann Horn    2019-04-10  180      */
fbd9acb2dc2aa5 Jann Horn    2019-04-11  181     mutex_lock(&policy_update_lock);
03638e62f55f27 Jann Horn    2019-04-10 @182     
rcu_swap_protected(safesetid_setuid_rules, pol,
03638e62f55f27 Jann Horn    2019-04-10  183                        
lockdep_is_held(&policy_update_lock));
fbd9acb2dc2aa5 Jann Horn    2019-04-11  184     
mutex_unlock(&policy_update_lock);
03638e62f55f27 Jann Horn    2019-04-10  185     err = len;
03638e62f55f27 Jann Horn    2019-04-10  186  
03638e62f55f27 Jann Horn    2019-04-10  187  out_free_buf:
03638e62f55f27 Jann Horn    2019-04-10  188     kfree(buf);
03638e62f55f27 Jann Horn    2019-04-10  189  out_free_pol:
21ab8580b383f2 Micah Morton 2019-09-17  190     if (pol)
03638e62f55f27 Jann Horn    2019-04-10  191                  
release_ruleset(pol);
03638e62f55f27 Jann Horn    2019-04-10  192     return err;
aeca4e2ca65c1a Micah Morton 2019-01-16  193  }
aeca4e2ca65c1a Micah Morton 2019-01-16  194  

:::::: The code at line 182 was first introduced by commit
:::::: 03638e62f55f27e7a96d6b1175e75b7a81e562b3 LSM: SafeSetID: rewrite 
userspace API to atomic updates

:::::: TO: Jann Horn <ja...@google.com>
:::::: CC: Micah Morton <mort...@chromium.org>

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

Attachment: .config.gz
Description: application/gzip

Reply via email to