Hi Tobin,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[also build test ERROR on v4.14-rc7 next-20171018]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:    
https://github.com/0day-ci/linux/commits/Tobin-C-Harding/printk-hash-addresses-printed-with-p/20171101-080718
config: i386-tinyconfig (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   lib/vsprintf.c: In function 'kernel_pointer':
>> lib/vsprintf.c:1359:10: error: 'kptr_restrict' undeclared (first use in this 
>> function)
     switch (kptr_restrict) {
             ^~~~~~~~~~~~~
   lib/vsprintf.c:1359:10: note: each undeclared identifier is reported only 
once for each function it appears in

vim +/kptr_restrict +1359 lib/vsprintf.c

  1347  
  1348  static noinline_for_stack
  1349  char *kernel_pointer(char *buf, char *end, const void *ptr,
  1350                       struct printf_spec spec)
  1351  {
  1352          spec.base = 16;
  1353          spec.flags |= SMALL;
  1354          if (spec.field_width == -1) {
  1355                  spec.field_width = 2 * sizeof(void *);
  1356                  spec.flags |= ZEROPAD;
  1357          }
  1358  
> 1359          switch (kptr_restrict) {
  1360          case 0:
  1361                  /* Always print %pK values */
  1362                  break;
  1363          case 1: {
  1364                  const struct cred *cred;
  1365  
  1366                  /*
  1367                   * kptr_restrict==1 cannot be used in IRQ context
  1368                   * because its test for CAP_SYSLOG would be meaningless.
  1369                   */
  1370                  if (in_irq() || in_serving_softirq() || in_nmi())
  1371                          return string(buf, end, "pK-error", spec);
  1372  
  1373                  /*
  1374                   * Only print the real pointer value if the current
  1375                   * process has CAP_SYSLOG and is running with the
  1376                   * same credentials it started with. This is because
  1377                   * access to files is checked at open() time, but %pK
  1378                   * checks permission at read() time. We don't want to
  1379                   * leak pointer values if a binary opens a file using
  1380                   * %pK and then elevates privileges before reading it.
  1381                   */
  1382                  cred = current_cred();
  1383                  if (!has_capability_noaudit(current, CAP_SYSLOG) ||
  1384                      !uid_eq(cred->euid, cred->uid) ||
  1385                      !gid_eq(cred->egid, cred->gid))
  1386                          ptr = NULL;
  1387                  break;
  1388          }
  1389          case 2:
  1390          default:
  1391                  /* Always print 0's for %pK */
  1392                  ptr = NULL;
  1393                  break;
  1394          }
  1395  
  1396          return number(buf, end, (unsigned long)ptr, spec);
  1397  }
  1398  

---
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