1. 01 9月, 2017 1 次提交
    • M
      kbuild: use $(abspath ...) instead of $(shell cd ... && /bin/pwd) · 8e9b4667
      Masahiro Yamada 提交于
      Kbuild conventionally uses $(shell cd ... && /bin/pwd) idiom to get
      the absolute path of the directory because GNU Make 3.80, the minimal
      supported version at that time, did not support $(abspath ...) or
      $(realpath ...).
      
      Commit 37d69ee3 ("docs: bump minimal GNU Make version to 3.81")
      dropped the GNU Make 3.80 support, so we are now allowed to use those
      make-builtin helpers.
      
      This conversion will provide better portability without relying on
      the pwd command or its location /bin/pwd.
      
      I am intentionally using $(realpath ...) instead $(abspath ...) in
      some places.  The difference between the two is $(realpath ...)
      returns an empty string if the given path does not exist.  It is
      convenient in places where we need to error-out if the makefile fails
      to create an output directory.
      Signed-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Acked-by: NThierry Reding <treding@nvidia.com>
      8e9b4667
  2. 24 7月, 2017 1 次提交
    • L
      Properly alphabetize MAINTAINERS file · 7683e9e5
      Linus Torvalds 提交于
      This adds a perl script to actually parse the MAINTAINERS file, clean up
      some whitespace in it, warn about errors in it, and then properly sort
      the end result.
      
      My perl-fu is atrocious, so the script has basically been created by
      randomly putting various characters in a pile, mixing them around, and
      then looking it the end result does anything interesting when used as a
      perl script.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      7683e9e5
  3. 20 7月, 2017 1 次提交
  4. 13 7月, 2017 4 次提交
  5. 11 7月, 2017 12 次提交
  6. 10 7月, 2017 2 次提交
  7. 07 7月, 2017 2 次提交
  8. 03 7月, 2017 2 次提交
  9. 30 6月, 2017 3 次提交
  10. 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
  11. 25 6月, 2017 2 次提交
  12. 24 6月, 2017 1 次提交
  13. 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
  14. 22 6月, 2017 1 次提交
    • 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