lkml.org 
[lkml]   [2017]   [Oct]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    SubjectRe: [PATCH v2] printk: hash addresses printed with %p
    From
    Date
    On Tue, 2017-10-17 at 15:52 +1100, Tobin C. Harding wrote:
    > Currently there are many places in the kernel where addresses are being
    > printed using an unadorned %p. Kernel pointers should be printed using
    > %pK allowing some control via the kptr_restrict sysctl. Exposing addresses
    > gives attackers sensitive information about the kernel layout in memory.
    >
    > We can reduce the attack surface by hashing all addresses printed with
    > %p. This will of course break some users, forcing code printing needed
    > addresses to be updated.
    >
    > For what it's worth, usage of unadorned %p can be broken down as follows
    >
    > git grep '%p[^KFfSsBRrbMmIiEUVKNhdDgCGO]' | wc -l

    Not really.
    There are many asm uses included there

    I think a better grep is:

    $ git grep -E '%p[^A-Za-z0-9]' | cut -f1 -d"/" | sort | uniq -c
       1084 arch
         20 block
         10 crypto
         32 Documentation
       8121 drivers
       1221 fs
        143 include
        101 kernel
         69 lib
        100 mm
       1510 net
         40 samples
          7 scripts
         11 security
        166 sound
        152 tools
          2 virt

    > arch: 2512

    arch is especially overestimated.

    \
     
     \ /
      Last update: 2017-10-17 07:20    [W:3.836 / U:0.028 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site