1. 11 7月, 2017 8 次提交
  2. 07 7月, 2017 2 次提交
  3. 03 7月, 2017 2 次提交
  4. 30 6月, 2017 3 次提交
  5. 28 6月, 2017 1 次提交
    • P
      vsprintf: Add %p extension "%pOF" for device tree · ce4fecf1
      Pantelis Antoniou 提交于
      90% of the usage of device node's full_name is printing it out in a
      kernel message. However, storing the full path for every node is
      wasteful and redundant. With a custom format specifier, we can generate
      the full path at run-time and eventually remove the full path from every
      node.
      
      For instance typical use is:
      	pr_info("Frobbing node %s\n", node->full_name);
      
      Which can be written now as:
      	pr_info("Frobbing node %pOF\n", node);
      
      '%pO' is the base specifier to represent kobjects with '%pOF'
      representing struct device_node. Currently, struct device_node is the
      only supported type of kobject.
      
      More fine-grained control of formatting includes printing the name,
      flags, path-spec name and others, explained in the documentation entry.
      
      Originally written by Pantelis, but pretty much rewrote the core
      function using existing string/number functions. The 2 passes were
      unnecessary and have been removed. Also, updated the checkpatch.pl
      check. The unittest code was written by Grant Likely.
      Signed-off-by: NPantelis Antoniou <pantelis.antoniou@konsulko.com>
      Acked-by: NJoe Perches <joe@perches.com>
      Signed-off-by: NRob Herring <robh@kernel.org>
      ce4fecf1
  6. 25 6月, 2017 2 次提交
  7. 24 6月, 2017 1 次提交
  8. 23 6月, 2017 7 次提交
    • K
      randstruct: Whitelist NIU struct page overloading · 1854c19c
      Kees Cook 提交于
      The NIU ethernet driver intentionally stores a page struct pointer on
      top of the "mapping" field. Whitelist this case:
      
      drivers/net/ethernet/sun/niu.c: In function ‘niu_rx_pkt_ignore’:
      drivers/net/ethernet/sun/niu.c:3402:10: note: found mismatched ssa struct pointer types: ‘struct page’ and ‘struct address_space’
      
          *link = (struct page *) page->mapping;
          ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      Cc: David S. Miller <davem@davemloft.net>
      Signed-off-by: NKees Cook <keescook@chromium.org>
      1854c19c
    • K
      randstruct: Whitelist big_key path struct overloading · 802762cd
      Kees Cook 提交于
      The big_key payload structure intentionally stores a struct path in
      two void pointers to avoid header soup. Whitelist this case:
      
      security/keys/big_key.c: In function ‘big_key_read’:
      security/keys/big_key.c:293:16: note: found mismatched rhs struct pointer types: ‘struct path’ and ‘void *’
      
         struct path *path = (struct path *)&key->payload.data[big_key_path];
                      ^~~~
      
      Cc: David Howells <dhowells@redhat.com>
      Signed-off-by: NKees Cook <keescook@chromium.org>
      802762cd
    • K
      randstruct: Whitelist UNIXCB cast · b07b6584
      Kees Cook 提交于
      This is another false positive in bad cast detection:
      
      net/unix/af_unix.c: In function ‘unix_skb_scm_eq’:
      net/unix/af_unix.c:1621:31: note: found mismatched rhs struct pointer types: ‘struct unix_skb_parms’ and ‘char’
      
        const struct unix_skb_parms *u = &UNIXCB(skb);
                                     ^
      
      UNIXCB is:
      
      	#define UNIXCB(skb)     (*(struct unix_skb_parms *)&((skb)->cb))
      
      And ->cb is:
      
      	char                    cb[48] __aligned(8);
      
      This is a rather crazy cast, but appears to be safe in the face of
      randomization, so whitelist it in the plugin.
      
      Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
      Cc: David S. Miller <davem@davemloft.net>
      Signed-off-by: NKees Cook <keescook@chromium.org>
      b07b6584
    • K
      randstruct: Whitelist struct security_hook_heads cast · fd466e06
      Kees Cook 提交于
      The LSM initialization routines walk security_hook_heads as an array
      of struct list_head instead of via names to avoid a ton of needless
      source. Whitelist this to avoid the false positive warning from the
      plugin:
      
      security/security.c: In function ‘security_init’:
      security/security.c:59:20: note: found mismatched op0 struct pointer types: ‘struct list_head’ and ‘struct security_hook_heads’
      
        struct list_head *list = (struct list_head *) &security_hook_heads;
                          ^
      
      Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Cc: James Morris <james.l.morris@oracle.com>
      Signed-off-by: NKees Cook <keescook@chromium.org>
      fd466e06
    • K
      gcc-plugins: Add the randstruct plugin · 313dd1b6
      Kees Cook 提交于
      This randstruct plugin is modified from Brad Spengler/PaX Team's code
      in the last public patch of grsecurity/PaX based on my understanding
      of the code. Changes or omissions from the original code are mine and
      don't reflect the original grsecurity/PaX code.
      
      The randstruct GCC plugin randomizes the layout of selected structures
      at compile time, as a probabilistic defense against attacks that need to
      know the layout of structures within the kernel. This is most useful for
      "in-house" kernel builds where neither the randomization seed nor other
      build artifacts are made available to an attacker. While less useful for
      distribution kernels (where the randomization seed must be exposed for
      third party kernel module builds), it still has some value there since now
      all kernel builds would need to be tracked by an attacker.
      
      In more performance sensitive scenarios, GCC_PLUGIN_RANDSTRUCT_PERFORMANCE
      can be selected to make a best effort to restrict randomization to
      cacheline-sized groups of elements, and will not randomize bitfields. This
      comes at the cost of reduced randomization.
      
      Two annotations are defined,__randomize_layout and __no_randomize_layout,
      which respectively tell the plugin to either randomize or not to
      randomize instances of the struct in question. Follow-on patches enable
      the auto-detection logic for selecting structures for randomization
      that contain only function pointers. It is disabled here to assist with
      bisection.
      
      Since any randomized structs must be initialized using designated
      initializers, __randomize_layout includes the __designated_init annotation
      even when the plugin is disabled so that all builds will require
      the needed initialization. (With the plugin enabled, annotations for
      automatically chosen structures are marked as well.)
      
      The main differences between this implemenation and grsecurity are:
      - disable automatic struct selection (to be enabled in follow-up patch)
      - add designated_init attribute at runtime and for manual marking
      - clarify debugging output to differentiate bad cast warnings
      - add whitelisting infrastructure
      - support gcc 7's DECL_ALIGN and DECL_MODE changes (Laura Abbott)
      - raise minimum required GCC version to 4.7
      
      Earlier versions of this patch series were ported by Michael Leibowitz.
      Signed-off-by: NKees Cook <keescook@chromium.org>
      313dd1b6
    • R
      kconfig: fix sparse warnings in nconfig · ad818106
      Randy Dunlap 提交于
      Fix sparse warnings in scripts/kconfig/nconf* ('make nconfig'):
      
      ../scripts/kconfig/nconf.c:1071:32: warning: Using plain integer as NULL pointer
      ../scripts/kconfig/nconf.c:1238:30: warning: Using plain integer as NULL pointer
      ../scripts/kconfig/nconf.c:511:51: warning: Using plain integer as NULL pointer
      ../scripts/kconfig/nconf.c:1460:6: warning: symbol 'setup_windows' was not declared. Should it be static?
      ../scripts/kconfig/nconf.c:274:12: warning: symbol 'current_instructions' was not declared. Should it be static?
      ../scripts/kconfig/nconf.c:308:22: warning: symbol 'function_keys' was not declared. Should it be static?
      ../scripts/kconfig/nconf.gui.c:132:17: warning: non-ANSI function declaration of function 'set_colors'
      ../scripts/kconfig/nconf.gui.c:195:24: warning: Using plain integer as NULL pointer
      
      nconf.gui.o before/after files are the same.
      nconf.o before/after files are the same until the 'static' function
      declarations are added.
      Signed-off-by: NRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      ad818106
    • G
      scripts/dtc: dtx_diff - Show real file names in diff header · 7782b144
      Geert Uytterhoeven 提交于
      As the comparison uses process substitution to pass files after
      conversion to DTS format, the diff header doesn't show the real
      filenames, but the names of the file descriptors used:
      
          --- /dev/fd/63  2017-06-22 11:21:47.531637188 +0200
          +++ /dev/fd/62  2017-06-22 11:21:47.531637188 +0200
      
      This is especially annoying when comparing a bunch of DT files in a
      loop, as the output doesn't show a clue about which files it refers to.
      
      Fix this by explicitly passing the original file names to the diff
      command using the --label option, giving e.g.:
      
          --- arch/arm/boot/dts/r8a7791-koelsch.dtb
          +++ arch/arm/boot/dts/r8a7791-porter.dtb
      Signed-off-by: NGeert Uytterhoeven <geert+renesas@glider.be>
      Reviewed-by: NFrank Rowand <frank.rowand@sony.com>
      Signed-off-by: NRob Herring <robh@kernel.org>
      7782b144
  9. 22 6月, 2017 2 次提交
    • M
      kbuild: replace genhdr-y with generated-y · ae3f4151
      Masahiro Yamada 提交于
      Originally, generated-y and genhdr-y had different meaning, like
      follows:
      
      - generated-y: generated headers (other than asm-generic wrappers)
      - header-y   : headers to be exported
      - genhdr-y   : generated headers to be exported (generated-y + header-y)
      
      Since commit fcc8487d ("uapi: export all headers under uapi
      directories"), headers under UAPI directories are all exported.
      So, there is no more difference between generated-y and genhdr-y.
      
      We see two users of genhdr-y, arch/{arm,x86}/include/uapi/asm/Kbuild.
      They generate some headers in arch/{arm,x86}/include/generated/uapi/asm
      directories, which are obviously exported.
      
      Replace them with generated-y, and abolish genhdr-y.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Acked-by: NNicolas Dichtel <nicolas.dichtel@6wind.com>
      ae3f4151
    • R
      kbuild: fix header installation under fakechroot environment · 2f263d14
      Richard Genoud 提交于
      Since commit fcc8487d ("uapi: export all headers under uapi
      directories") fakechroot make bindeb-pkg fails, mismatching files for
      directories:
      touch: cannot touch 'usr/include/video/uvesafb.h/.install': Not a
      directory
      
      This due to a bug in fakechroot:
      when using the function $(wildcard $(srcdir)/*/.) in a makefile, under a
      fakechroot environment, not only directories but also files are
      returned.
      
      To circumvent that, we are using the functions:
      $(sort $(dir $(wildcard $(srcdir)/*/))))
      
      Fixes: fcc8487d ("uapi: export all headers under uapi directories")
      Signed-off-by: NRichard Genoud <richard.genoud@gmail.com>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      2f263d14
  10. 19 6月, 2017 1 次提交
  11. 10 6月, 2017 2 次提交
    • B
      kconfig: Check for libncurses before menuconfig · ff85a1a8
      Borislav Petkov 提交于
      There is a check and a nice user-friendly message when the curses
      library is not present on the system and the user wants to do "make
      menuconfig". It doesn't get issued, though. Instead, we fail the build
      when mconf.c doesn't find the curses.h header:
      
          HOSTCC  scripts/kconfig/mconf.o
        In file included from scripts/kconfig/mconf.c:23:0:
        scripts/kconfig/lxdialog/dialog.h:38:20: fatal error: curses.h: No such file or directory
         #include CURSES_LOC
                            ^
        compilation terminated.
      
      Make that check a prerequisite to mconf so that the user sees the error
      message instead:
      
        $ make menuconfig
         *** Unable to find the ncurses libraries or the
         *** required header files.
         *** 'make menuconfig' requires the ncurses libraries.
         ***
         *** Install ncurses (ncurses-devel) and try again.
         ***
        scripts/kconfig/Makefile:203: recipe for target 'scripts/kconfig/dochecklxdialog' failed
        make[1]: *** [scripts/kconfig/dochecklxdialog] Error 1
        Makefile:548: recipe for target 'menuconfig' failed
        make: *** [menuconfig] Error 2
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      ff85a1a8
    • A
      kbuild: speed up checksyscalls.sh · d21832e2
      Arnd Bergmann 提交于
      checksyscalls.sh is run at every "make" run while building the kernel,
      even if no files have changed. I looked at where we spend time in
      a trivial empty rebuild and found checksyscalls.sh to be a source
      of noticeable overhead, as it spawns a lot of child processes just
      to call 'cat' copying from stdin to stdout, once for each of the
      over 400 x86 syscalls.
      
      Using a shell-builtin (echo) instead of the external command gives
      us a 13x speedup:
      
          Before		   After
      real	0m1.018s       real	0m0.077s
      user	0m0.068s       user	0m0.048s
      sys	0m0.156s       sys	0m0.024s
      
      The time it took to rebuild a single file on my machine dropped
      from 5.5 seconds to 4.5 seconds.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      d21832e2
  12. 08 6月, 2017 1 次提交
    • P
      checkpatch: Remove checks for expedited grace periods · 98953135
      Paul E. McKenney 提交于
      There was a time when the expedited grace-period primitives
      (synchronize_rcu_expedited(), synchronize_rcu_bh_expedited(), and
      synchronize_sched_expedited()) used rather antisocial kernel
      facilities like try_stop_cpus().  However, they have since been
      housebroken to use only single-CPU IPIs, and typically cause less
      disturbance than a scheduling-clock interrupt.  Furthermore, this
      disturbance can be eliminated entirely using NO_HZ_FULL on the
      one hand or the rcupdate.rcu_normal boot parameter on the other.
      
      This commit therefore removes checkpatch's complaints about use
      of the expedited RCU primitives.
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      98953135
  13. 06 6月, 2017 2 次提交
  14. 03 6月, 2017 1 次提交
  15. 29 5月, 2017 1 次提交
    • K
      gcc-plugins: Detail c-common.h location for GCC 4.6 · 1132e1e4
      Kees Cook 提交于
      The c-common.h file moved in stock gcc 4.7, not gcc 4.6. However, most
      people building plugins with gcc 4.6 are using the Debian or Ubuntu
      version, which includes a patch to move the headers to the 4.7 location.
      In case anyone trips over this with a stock gcc 4.6, add a pointer to the
      patch used by Debian/Ubuntu.
      Signed-off-by: NKees Cook <keescook@chromium.org>
      1132e1e4
  16. 19 5月, 2017 2 次提交
    • O
      devicetree: Move include prefixes from arch to separate directory · d5d332d3
      Olof Johansson 提交于
      We use a directory under arch/$ARCH/boot/dts as an include path
      that has links outside of the subtree to find dt-bindings from under
      include/dt-bindings. That's been working well, but new DT architectures
      haven't been adding them by default.
      
      Recently there's been a desire to share some of the DT material between
      arm and arm64, which originally caused developers to create symlinks or
      relative includes between the subtrees. This isn't ideal -- it breaks
      if the DT files aren't stored in the exact same hierarchy as the kernel
      tree, and generally it's just icky.
      
      As a somewhat cleaner solution we decided to add a $ARCH/ prefix link
      once, and allow DTS files to reference dtsi (and dts) files in other
      architectures that way.
      
      Original approach was to create these links under each architecture,
      but it lead to the problem of recursive symlinks.
      
      As a remedy, move the include link directories out of the architecture
      trees into a common location. At the same time, they can now share one
      directory and one dt-bindings/ link as well.
      
      Fixes: 4027494a ('ARM: dts: add arm/arm64 include symlinks')
      Reported-by: NRussell King <linux@armlinux.org.uk>
      Reported-by: NOmar Sandoval <osandov@osandov.com>
      Reviewed-by: NHeiko Stuebner <heiko@sntech.de>
      Reviewed-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Tested-by: NHeiko Stuebner <heiko@sntech.de>
      Acked-by: NRob Herring <robh@kernel.org>
      Cc: Heiko Stuebner <heiko@sntech.de>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Mikael Starvik <starvik@axis.com>
      Cc: Jesper Nilsson <jesper.nilsson@axis.com>
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Frank Rowand <frowand.list@gmail.com>
      Cc: linux-arch <linux-arch@vger.kernel.org>
      Signed-off-by: NOlof Johansson <olof@lixom.net>
      d5d332d3
    • K
      doc: ReSTify SELinux.txt · 229fd05c
      Kees Cook 提交于
      Adjusts for ReST markup and moves under LSM admin guide.
      
      Cc: Paul Moore <paul@paul-moore.com>
      Signed-off-by: NKees Cook <keescook@chromium.org>
      Signed-off-by: NJonathan Corbet <corbet@lwn.net>
      229fd05c
  17. 18 5月, 2017 2 次提交
    • M
      kbuild: skip install/check of headers right under uapi directories · 05d8cba4
      Masahiro Yamada 提交于
      Since commit 61562f98 ("uapi: export all arch specifics
      directories"), "make INSTALL_HDR_PATH=$root/usr headers_install"
      deletes standard glibc headers and others in $(root)/usr/include.
      
      The cause of the issue is that headers_install now starts descending
      from arch/$(hdr-arch)/include/uapi with $(root)/usr/include for its
      destination when installing asm headers.  So, headers already there
      are assumed to be unwanted.
      
      When headers_install starts descending from include/uapi with
      $(root)/usr/include for its destination, it works around the problem
      by creating an dummy destination $(root)/usr/include/uapi, but this
      is tricky.
      
      To fix the problem in a clean way is to skip headers install/check
      in include/uapi and arch/$(hdr-arch)/include/uapi because we know
      there are only sub-directories in uapi directories.  A good side
      effect is the empty destination $(root)/usr/include/uapi will go
      away.
      
      I am also removing the trailing slash in the headers_check target to
      skip checking in arch/$(hdr-arch)/include/uapi.
      
      Fixes: 61562f98 ("uapi: export all arch specifics directories")
      Reported-by: NDan Williams <dan.j.williams@intel.com>
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Tested-by: NDan Williams <dan.j.williams@intel.com>
      Acked-by: NNicolas Dichtel <nicolas.dichtel@6wind.com>
      05d8cba4
    • S
      dtc: check.c fix compile error · 828d4cdd
      Shuah Khan 提交于
      Fix the following compile error found on odroid-xu4:
      
      checks.c: In function ‘check_simple_bus_reg’:
      checks.c:876:41: error: format ‘%lx’ expects argument of type
      ‘long unsigned int’, but argument 4 has type
      ‘uint64_t{aka long long unsigned int}’ [-Werror=format=]
        snprintf(unit_addr, sizeof(unit_addr), "%lx", reg);
                                               ^
      checks.c:876:41: error: format ‘%lx’ expects argument of type
      ‘long unsigned int’, but argument 4 has type
      ‘uint64_t {aka long long unsigned int}’ [-Werror=format=]
      cc1: all warnings being treated as errors
      Makefile:304: recipe for target 'checks.o' failed
      make: *** [checks.o] Error 1
      Signed-off-by: NShuah Khan <shuahkh@osg.samsung.com>
      [dwg: Correct new format to be correct in general]
      Signed-off-by: NDavid Gibson <david@gibson.dropbear.id.au>
      [robh: cherry-picked from upstream dtc commit 2a42b14d0d03]
      Signed-off-by: NRob Herring <robh@kernel.org>
      828d4cdd