Hi Daniel,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on pcmoore-audit/next]
[also build test WARNING on linus/master v5.11-rc6 next-20210125]
[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/Daniel-Walker/audit-show-user-land-backtrace-as-part-of-audit-context-messages/20210203-112432
base:   https://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/audit.git next
config: i386-randconfig-s002-20210203 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-215-g0fb77bb6-dirty
        # 
https://github.com/0day-ci/linux/commit/75f9146bb5f0b81f6e398a1e7d509df9b2dd990a
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review 
Daniel-Walker/audit-show-user-land-backtrace-as-part-of-audit-context-messages/20210203-112432
        git checkout 75f9146bb5f0b81f6e398a1e7d509df9b2dd990a
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386 

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


"sparse warnings: (new ones prefixed by >>)"
>> kernel/auditsc.c:1525:31: sparse: sparse: incompatible types in comparison 
>> expression (different address spaces):
>> kernel/auditsc.c:1525:31: sparse:    struct task_struct *
>> kernel/auditsc.c:1525:31: sparse:    struct task_struct [noderef] __rcu *

vim +1525 kernel/auditsc.c

  1478  
  1479  static void audit_log_parents(void)
  1480  {
  1481          int res, len, item_cnt;
  1482          u32 sid;
  1483          char *buf;
  1484          char *ctx = NULL;
  1485          struct audit_context *context = audit_context();
  1486          struct audit_buffer *ab;
  1487          struct task_struct *task_iter;
  1488  
  1489          if (!context || context->dummy)
  1490                  return;
  1491  
  1492          buf = kmalloc(MAX_PARENT_AUDIT_LEN, GFP_KERNEL);
  1493          if (!buf)
  1494                  return;
  1495  
  1496          rcu_read_lock();
  1497          task_iter = rcu_dereference(current->real_parent);
  1498          for (item_cnt = 0; item_cnt < MAX_PARENT_ENTRY_CNT; ++item_cnt) 
{
  1499                  ab = audit_log_start(context, GFP_ATOMIC, AUDIT_PARENT);
  1500                  if (!ab)
  1501                          break;
  1502  
  1503                  // get subject context
  1504                  security_task_getsecid(task_iter, &sid);
  1505                  if (sid) {
  1506                          res = security_secid_to_secctx(sid, &ctx, &len);
  1507                          if (!res) {
  1508                                  audit_log_format(ab, "subj=%-60s", ctx);
  1509                                  security_release_secctx(ctx, len);
  1510                          }
  1511                  }
  1512  
  1513                  // get cmdline
  1514                  res = get_cmdline(task_iter, buf, MAX_PARENT_AUDIT_LEN);
  1515                  if (res) {
  1516                          res = audit_proctitle_rtrim(buf, res);
  1517                          if (res) {
  1518                                  audit_log_format(ab, " proctitle=");
  1519                                  audit_log_n_untrustedstring(ab, buf, 
res);
  1520                          }
  1521                  }
  1522  
  1523                  audit_log_end(ab);
  1524  
> 1525                  if (task_iter == task_iter->real_parent)
  1526                          break;
  1527                  task_iter = rcu_dereference(task_iter->real_parent);
  1528          }
  1529          rcu_read_unlock();
  1530  
  1531          kfree(buf);
  1532  }
  1533  

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

Attachment: .config.gz
Description: application/gzip

Reply via email to