1. 14 9月, 2016 1 次提交
  2. 04 8月, 2016 1 次提交
    • M
      tree-wide: replace config_enabled() with IS_ENABLED() · 97f2645f
      Masahiro Yamada 提交于
      The use of config_enabled() against config options is ambiguous.  In
      practical terms, config_enabled() is equivalent to IS_BUILTIN(), but the
      author might have used it for the meaning of IS_ENABLED().  Using
      IS_ENABLED(), IS_BUILTIN(), IS_MODULE() etc.  makes the intention
      clearer.
      
      This commit replaces config_enabled() with IS_ENABLED() where possible.
      This commit is only touching bool config options.
      
      I noticed two cases where config_enabled() is used against a tristate
      option:
      
       - config_enabled(CONFIG_HWMON)
        [ drivers/net/wireless/ath/ath10k/thermal.c ]
      
       - config_enabled(CONFIG_BACKLIGHT_CLASS_DEVICE)
        [ drivers/gpu/drm/gma500/opregion.c ]
      
      I did not touch them because they should be converted to IS_BUILTIN()
      in order to keep the logic, but I was not sure it was the authors'
      intention.
      
      Link: http://lkml.kernel.org/r/1465215656-20569-1-git-send-email-yamada.masahiro@socionext.comSigned-off-by: NMasahiro Yamada <yamada.masahiro@socionext.com>
      Acked-by: NKees Cook <keescook@chromium.org>
      Cc: Stas Sergeev <stsp@list.ru>
      Cc: Matt Redfearn <matt.redfearn@imgtec.com>
      Cc: Joshua Kinard <kumba@gentoo.org>
      Cc: Jiri Slaby <jslaby@suse.com>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Cc: "Dmitry V. Levin" <ldv@altlinux.org>
      Cc: yu-cheng yu <yu-cheng.yu@intel.com>
      Cc: James Hogan <james.hogan@imgtec.com>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Johannes Berg <johannes@sipsolutions.net>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Will Drewry <wad@chromium.org>
      Cc: Nikolay Martynov <mar.kolya@gmail.com>
      Cc: Huacai Chen <chenhc@lemote.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Leonid Yegoshin <Leonid.Yegoshin@imgtec.com>
      Cc: Rafal Milecki <zajec5@gmail.com>
      Cc: James Cowgill <James.Cowgill@imgtec.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: Alex Smith <alex.smith@imgtec.com>
      Cc: Adam Buchbinder <adam.buchbinder@gmail.com>
      Cc: Qais Yousef <qais.yousef@imgtec.com>
      Cc: Jiang Liu <jiang.liu@linux.intel.com>
      Cc: Mikko Rapeli <mikko.rapeli@iki.fi>
      Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: Brian Norris <computersforpeace@gmail.com>
      Cc: Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com>
      Cc: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>
      Cc: Andy Lutomirski <luto@amacapital.net>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
      Cc: Roland McGrath <roland@hack.frob.com>
      Cc: Paul Burton <paul.burton@imgtec.com>
      Cc: Kalle Valo <kvalo@qca.qualcomm.com>
      Cc: Viresh Kumar <viresh.kumar@linaro.org>
      Cc: Tony Wu <tung7970@gmail.com>
      Cc: Huaitong Han <huaitong.han@intel.com>
      Cc: Sumit Semwal <sumit.semwal@linaro.org>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Juergen Gross <jgross@suse.com>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Andrea Gelmini <andrea.gelmini@gelma.net>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Cc: Marc Zyngier <marc.zyngier@arm.com>
      Cc: Rabin Vincent <rabin@rab.in>
      Cc: "Maciej W. Rozycki" <macro@imgtec.com>
      Cc: David Daney <david.daney@cavium.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      97f2645f
  3. 03 4月, 2016 1 次提交
  4. 28 12月, 2015 1 次提交
  5. 22 12月, 2015 3 次提交
    • J
      MIPS: uaccess: Take EVA into account in [__]clear_user · d6a428fb
      James Hogan 提交于
      __clear_user() (and clear_user() which uses it), always access the user
      mode address space, which results in EVA store instructions when EVA is
      enabled even if the current user address limit is KERNEL_DS.
      
      Fix this by adding a new symbol __bzero_kernel for the normal kernel
      address space bzero in EVA mode, and call that from __clear_user() if
      eva_kernel_access().
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Cc: Paul Burton <paul.burton@imgtec.com>
      Cc: Leonid Yegoshin <leonid.yegoshin@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/10844/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      d6a428fb
    • J
      MIPS: uaccess: Take EVA into account in __copy_from_user() · 6f06a2c4
      James Hogan 提交于
      When EVA is in use, __copy_from_user() was unconditionally using the EVA
      instructions to read the user address space, however this can also be
      used for kernel access. If the address isn't a valid user address it
      will cause an address error or TLB exception, and if it is then user
      memory may be read instead of kernel memory.
      
      For example in the following stack trace from Linux v3.10 (changes since
      then will prevent this particular one still happening) kernel_sendmsg()
      set the user address limit to KERNEL_DS, and tcp_sendmsg() goes on to
      use __copy_from_user() with a kernel address in KSeg0.
      
      [<8002d434>] __copy_fromuser_common+0x10c/0x254
      [<805710e0>] tcp_sendmsg+0x5f4/0xf00
      [<804e8e3c>] sock_sendmsg+0x78/0xa0
      [<804e8f28>] kernel_sendmsg+0x24/0x38
      [<804ee0f8>] sock_no_sendpage+0x70/0x7c
      [<8017c820>] pipe_to_sendpage+0x80/0x98
      [<8017c6b0>] splice_from_pipe_feed+0xa8/0x198
      [<8017cc54>] __splice_from_pipe+0x4c/0x8c
      [<8017e844>] splice_from_pipe+0x58/0x78
      [<8017e884>] generic_splice_sendpage+0x20/0x2c
      [<8017d690>] do_splice_from+0xb4/0x110
      [<8017d710>] direct_splice_actor+0x24/0x30
      [<8017d394>] splice_direct_to_actor+0xd8/0x208
      [<8017d51c>] do_splice_direct+0x58/0x7c
      [<8014eaf4>] do_sendfile+0x1dc/0x39c
      [<8014f82c>] SyS_sendfile+0x90/0xf8
      
      Add the eva_kernel_access() check in __copy_from_user() like the one in
      copy_from_user().
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Cc: Paul Burton <paul.burton@imgtec.com>
      Cc: Leonid Yegoshin <leonid.yegoshin@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/10843/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      6f06a2c4
    • J
      MIPS: uaccess: Fix strlen_user with EVA · 5dc62fdd
      James Hogan 提交于
      The strlen_user() function calls __strlen_kernel_asm in both branches of
      the eva_kernel_access() conditional. For EVA it should be calling
      __strlen_user_eva for user accesses, otherwise it will load from the
      kernel address space instead of the user address space, and the access
      checking will likely be ineffective at preventing it due to EVA's
      overlapping user and kernel address spaces.
      
      This was found after extending the test_user_copy module to cover user
      string access functions, which gave the following error with EVA:
      
      test_user_copy: illegal strlen_user passed
      
      Fortunately the use of strlen_user() has been all but eradicated from
      the mainline kernel, so only out of tree modules could be affected.
      
      Fixes: e3a9b07a ("MIPS: asm: uaccess: Add EVA support for str*_user operations")
      Signed-off-by: NJames Hogan <james.hogan@imgtec.com>
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Cc: Paul Burton <paul.burton@imgtec.com>
      Cc: Leonid Yegoshin <leonid.yegoshin@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Cc: <stable@vger.kernel.org> # 3.15.x-
      Patchwork: https://patchwork.linux-mips.org/patch/10842/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      5dc62fdd
  6. 22 6月, 2015 1 次提交
    • P
      MIPS: Optimise non-EVA kernel user memory accesses · 12060666
      Paul Burton 提交于
      Commits ac1d8590 (MIPS: asm: uaccess: Use EVA instructions
      wrappers), 05c65160 (MIPS: asm: uaccess: Add EVA support to
      copy_{in, to,from}_user) & e3a9b07a (MIPS: asm: uaccess: Add EVA
      support for str*_user operations) added checks to various user memory
      access functions & macros in order to determine whether to perform
      standard memory accesses or their EVA userspace equivalents. In kernels
      built without support for EVA these checks are entirely redundant. Avoid
      emitting them & allow the compiler to optimise out the EVA userspace
      code in such kernels by checking config_enabled(CONFIG_EVA).
      
      This reduces the size of a malta_defconfig kernel built using GCC 4.9.2
      by approximately 33KB (from 5995072 to 5962304 bytes).
      Signed-off-by: NPaul Burton <paul.burton@imgtec.com>
      Cc: Markos Chandras <markos.chandras@imgtec.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Cc: linux-kernel@vger.kernel.org
      Cc: linux-mips@linux-mips.org
      Patchwork: http://patchwork.linux-mips.org/patch/10165/Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      12060666
  7. 19 5月, 2015 1 次提交
  8. 24 11月, 2014 3 次提交
  9. 20 11月, 2014 2 次提交
  10. 27 3月, 2014 7 次提交
  11. 09 5月, 2013 1 次提交
    • S
      MIPS: microMIPS: Disable LL/SC and fix linker bug. · 1658f914
      Steven J. Hill 提交于
      Partially revert commit e0c14a260d66ba35935600d6435940a566fe806b
      and turn off LL/SC when building a pure microMIPS kernel. This is
      a temporary fix until the cmpxchg assembly macro functions are
      re-written to not use the HI/LO registers in address calculations.
      
      Also add .insn in selected user access functions which would
      otherwise produce ISA mode jump incompatibilities. This is also a
      temporary fix.
      Signed-off-by: NSteven J. Hill <Steven.Hill@imgtec.com>
      1658f914
  12. 08 5月, 2013 1 次提交
  13. 01 2月, 2013 1 次提交
  14. 23 7月, 2012 1 次提交
  15. 30 10月, 2010 1 次提交
    • D
      MIPS: Make TASK_SIZE reflect proper size for both 32 and 64 bit processes. · 949e51be
      David Daney 提交于
      The TASK_SIZE macro should reflect the size of a user process virtual
      address space.  Previously for 64-bit kernels, this was not the case.
      The immediate cause of pain was in
      hugetlbfs/inode.c:hugetlb_get_unmapped_area() where 32-bit processes
      trying to mmap a huge page would be served a page with an address
      outside of the 32-bit address range.  But there are other uses of
      TASK_SIZE in the kernel as well that would like an accurate value.
      
      The new definition is nice because it now makes TASK_SIZE and
      TASK_SIZE_OF() yield the same value for any given process.
      
      For 32-bit kernels there should be no change, although I did factor
      out some code in asm/processor.h that became identical for the 32-bit and
      64-bit cases.
      
      __UA_LIMIT is now set to ~((1 << SEGBITS) - 1) for 64-bit kernels.
      This should eliminate the possibility of getting a
      AddressErrorException in the kernel for addresses that pass the
      access_ok() test.
      
      With the patch applied, I can still run o32, n32 and n64 processes,
      and have an o32 shell fork/exec both n32 and n64 processes.
      Signed-off-by: NDavid Daney <ddaney@caviumnetworks.com>
      To: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/1701/
      949e51be
  16. 22 5月, 2009 1 次提交
  17. 14 5月, 2009 3 次提交
  18. 11 10月, 2008 3 次提交
  19. 29 1月, 2008 1 次提交
    • M
      [MIPS] R4000/R4400 daddiu erratum workaround · 619b6e18
      Maciej W. Rozycki 提交于
       This complements the generic R4000/R4400 errata workaround code and adds 
      bits for the daddiu problem.  In most places it just modifies handwritten 
      assembly code so that the assembler is allowed to use a temporary register 
      as daddiu may now be treated as a macro that expands to a sequence of li 
      and daddu.  It is the AT register or, where AT is unavailable or used 
      explicitly for another purpose, an explicitly-named register is selected, 
      using the .set at=<reg> feature added recently to gas.  This feature is 
      only used if CONFIG_CPU_DADDI_WORKAROUNDS has been set, so if the 
      workaround remains disabled, the required version of binutils stays 
      unchanged.
      
       Similarly, daddiu instructions put in branch delay slots in noreorder 
      fragments are now taken out of them and the assembler is allowed to 
      reorder them itself as possible (which it does making the whole idea of 
      scheduling them into delay slots manually questionable).
      
       Also in the very few places where such a simple conversion was not 
      possible, a handcoded longer sequence is implemented.
      
       Other than that there are changes to code responsible for building the 
      TLB fault and page clear/copy handlers to avoid daddiu as appropriate.  
      These are only effective if the erratum is verified to be present at the 
      run time.
      
       Finally there is a trivial update to __delay(), because it uses daddiu in 
      a branch delay slot.
      Signed-off-by: NMaciej W. Rozycki <macro@linux-mips.org>
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      619b6e18
  20. 12 10月, 2007 2 次提交
  21. 07 3月, 2007 1 次提交
  22. 20 2月, 2007 1 次提交
    • R
      [MIPS] Fixup copy_from_user_inatomic · e03b5269
      Ralf Baechle 提交于
      From the 01408c49 log message:
      
      The problem is that when we write to a file, the copy from userspace to
      pagecache is first done with preemption disabled, so if the source
      address is not immediately available the copy fails *and* *zeros* *the*
      *destination*.
      
      This is a problem because a concurrent read (which admittedly is an odd
      thing to do) might see zeros rather that was there before the write, or
      what was there after, or some mixture of the two (any of these being a
      reasonable thing to see).
      
      If the copy did fail, it will immediately be retried with preemption
      re-enabled so any transient problem with accessing the source won't
      cause an error.
      
      The first copying does not need to zero any uncopied bytes, and doing
      so causes the problem.  It uses copy_from_user_atomic rather than
      copy_from_user so the simple expedient is to change copy_from_user_atomic
      to *not* zero out bytes on failure.
      
      < --- end cite --- >
      
      This patch finally implements at least a not so pretty solution by
      duplicating the relevant part of __copy_user.
      Signed-off-by: NRalf Baechle <ralf@linux-mips.org>
      e03b5269
  23. 14 2月, 2007 2 次提交