1. 12 Aug, 2015 23 commits
  2. 06 Aug, 2015 17 commits
    • Ben Hutchings's avatar
      Linux 3.2.70 · 058fbb1d
      Ben Hutchings authored
      058fbb1d
    • Lv Zheng's avatar
      ACPICA: Utilities: Cleanup to remove useless ACPI_PRINTF/FORMAT_xxx helpers. · 18a1b310
      Lv Zheng authored
      commit 1d0a0b2f upstream.
      
      ACPICA commit b60612373a4ef63b64a57c124576d7ddb6d8efb6
      
      For physical addresses, since the address may exceed 32-bit address range
      after calculation, we should use 0x%8.8X%8.8X instead of ACPI_PRINTF_UINT
      and ACPI_FORMAT_UINT64() instead of
      ACPI_FORMAT_NATIVE_UINT()/ACPI_FORMAT_TO_UINT().
      
      This patch also removes above replaced macros as there are no users.
      
      This is a preparation to switch acpi_physical_address to 64-bit on 32-bit
      kernel builds.
      
      Link: https://github.com/acpica/acpica/commit/b6061237Signed-off-by: default avatarLv Zheng <lv.zheng@intel.com>
      Signed-off-by: default avatarBob Moore <robert.moore@intel.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarDirk Behme <dirk.behme@gmail.com>
      [gdavis: Move tbprint.c changes to tbutils.c due to lack of commit
      	 "42f47869 ACPICA: Split table print utilities to a new a
      	 separate file" in linux-3.10.y]
      Signed-off-by: default avatarGeorge G. Davis <george_davis@mentor.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      [bwh: Backported to 3.2: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      18a1b310
    • Lv Zheng's avatar
      ACPICA: Utilities: Cleanup to convert physical address printing formats. · 4eba3fca
      Lv Zheng authored
      commit cc2080b0 upstream.
      
      ACPICA commit 7f06739db43a85083a70371c14141008f20b2198
      
      For physical addresses, since the address may exceed 32-bit address range
      after calculation, we should use %8.8X%8.8X (see ACPI_FORMAT_UINT64()) to
      convert the %p formats.
      
      This is a preparation to switch acpi_physical_address to 64-bit on 32-bit
      kernel builds.
      
      Link: https://github.com/acpica/acpica/commit/7f06739dSigned-off-by: default avatarLv Zheng <lv.zheng@intel.com>
      Signed-off-by: default avatarBob Moore <robert.moore@intel.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarDirk Behme <dirk.behme@gmail.com>
      [gdavis: Move tbinstall.c changes to tbutils.c due to lack of commit
      	 "42f47869 ACPICA: Split table print utilities to a new a
      	 separate file" in linux-3.10.y]
      Signed-off-by: default avatarGeorge G. Davis <george_davis@mentor.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      [bwh: Backported to 3.2:
       - Drop inapplicable changes to drivers/acpi/acpica/utaddress.c and
         acpi_tb_install_table()
       - Fix similar format issues in acpi_tb_add_table() and
         acpi_tb_install_table() that aren't present upstream]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      4eba3fca
    • Bob Moore's avatar
      ACPICA: Debug output: Update output for Processor object. · 0e3c5ec2
      Bob Moore authored
      commit 0b232fca upstream.
      
      Cleanup output for Processor(). Length is a byte, not a word.
      Signed-off-by: default avatarBob Moore <robert.moore@intel.com>
      Signed-off-by: default avatarFeng Tang <feng.tang@intel.com>
      Signed-off-by: default avatarLen Brown <len.brown@intel.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      0e3c5ec2
    • Lv Zheng's avatar
      ACPICA: Tables: Change acpi_find_root_pointer() to use acpi_physical_address. · 405909c2
      Lv Zheng authored
      commit 85e014b4 upstream.
      
      commit f254e3c5 upstream.
      
      ACPICA commit 7d9fd64397d7c38899d3dc497525f6e6b044e0e3
      
      OSPMs like Linux expect an acpi_physical_address returning value from
      acpi_find_root_pointer(). This triggers warnings if sizeof (acpi_size) doesn't
      equal to sizeof (acpi_physical_address):
        drivers/acpi/osl.c:275:3: warning: passing argument 1 of 'acpi_find_root_pointer' from incompatible pointer type [enabled by default]
        In file included from include/acpi/acpi.h:64:0,
                         from include/linux/acpi.h:36,
                         from drivers/acpi/osl.c:41:
        include/acpi/acpixf.h:433:1: note: expected 'acpi_size *' but argument is of type 'acpi_physical_address *'
      This patch corrects acpi_find_root_pointer().
      
      Link: https://github.com/acpica/acpica/commit/7d9fd643Signed-off-by: default avatarLv Zheng <lv.zheng@intel.com>
      Signed-off-by: default avatarBob Moore <robert.moore@intel.com>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarDirk Behme <dirk.behme@gmail.com>
      Signed-off-by: default avatarGeorge G. Davis <george_davis@mentor.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      405909c2
    • Sam Ravnborg's avatar
      sparc32,leon: fix leon build · 7402a5fe
      Sam Ravnborg authored
      commit d657784b upstream.
      
      Minimal fix to allow leon to be built.
      Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
      Cc: Konrad Eisele <konrad@gaisler.com>
      Cc: Daniel Hellstrom <daniel@gaisler.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      7402a5fe
    • Arnd Bergmann's avatar
      staging: line6: avoid __sync_fetch_and_{and,or} · cee9e1e8
      Arnd Bergmann authored
      commit 9f613601 upstream.
      
      __sync_fetch_and_and and __sync_fetch_and_or are functions that are provided
      by gcc and depending on the target architecture may be implemented in libgcc,
      which is not always available in the kernel. This leads to a build failure
      on ARMv5:
      
      drivers/built-in.o: In function `line6_pcm_release':
      :(.text+0x3bfe80): undefined reference to `__sync_fetch_and_and_4'
      drivers/built-in.o: In function `line6_pcm_acquire':
      :(.text+0x3bff30): undefined reference to `__sync_fetch_and_or_4'
      
      To work around this, we can use the kernel-provided cmpxchg macro.
      
      Build-tested only.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Cc: Markus Grabner <grabner@icg.tugraz.at>
      Acked-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      [bwh: Backported to 3.2:
       - Adjust context
       - Fix up two more instances of __sync_fetch_and_and() that were removed
         separately upstream]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      cee9e1e8
    • John David Anglin's avatar
      parisc: Provide __ucmpdi2 to resolve undefined references in 32 bit builds. · 53774d1d
      John David Anglin authored
      commit ca0ad83d upstream.
      
      The Debian experimental linux source package (3.8.5-1) build fails
      with the following errors:
      ...
      MODPOST 2016 modules
      ERROR: "__ucmpdi2" [fs/btrfs/btrfs.ko] undefined!
      ERROR: "__ucmpdi2" [drivers/md/dm-verity.ko] undefined!
      
      The attached patch resolves this problem.  It is based on the s390
      implementation of ucmpdi2.c.
      Signed-off-by: default avatarJohn David Anglin <dave.anglin@bell.net>
      Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
      Signed-off-by: default avatarHelge Deller <deller@gmx.de>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      53774d1d
    • hujianyang's avatar
      UBI: fix soft lockup in ubi_check_volume() · 6876b78e
      hujianyang authored
      commit 9aa272b4 upstream.
      
      Running mtd-utils/tests/ubi-tests/io_basic.c could cause
      soft lockup or watchdog reset. It is because *updatevol*
      will perform ubi_check_volume() after updating finish
      and this function will full scan the updated lebs if the
      volume is initialized as STATIC_VOLUME.
      
      This patch adds *cond_resched()* in the loop of lebs scan
      to avoid soft lockup.
      
      Helped by Richard Weinberger <richard@nod.at>
      
      [ 2158.067096] INFO: rcu_sched self-detected stall on CPU { 1}  (t=2101 jiffies g=1606 c=1605 q=56)
      [ 2158.172867] CPU: 1 PID: 2073 Comm: io_basic Tainted: G           O 3.10.53 #21
      [ 2158.172898] [<c000f624>] (unwind_backtrace+0x0/0x120) from [<c000c294>] (show_stack+0x10/0x14)
      [ 2158.172918] [<c000c294>] (show_stack+0x10/0x14) from [<c008ac3c>] (rcu_check_callbacks+0x1c0/0x660)
      [ 2158.172936] [<c008ac3c>] (rcu_check_callbacks+0x1c0/0x660) from [<c002b480>] (update_process_times+0x38/0x64)
      [ 2158.172953] [<c002b480>] (update_process_times+0x38/0x64) from [<c005ff38>] (tick_sched_handle+0x54/0x60)
      [ 2158.172966] [<c005ff38>] (tick_sched_handle+0x54/0x60) from [<c00601ac>] (tick_sched_timer+0x44/0x74)
      [ 2158.172978] [<c00601ac>] (tick_sched_timer+0x44/0x74) from [<c003f348>] (__run_hrtimer+0xc8/0x1b8)
      [ 2158.172992] [<c003f348>] (__run_hrtimer+0xc8/0x1b8) from [<c003fd9c>] (hrtimer_interrupt+0x128/0x2a4)
      [ 2158.173007] [<c003fd9c>] (hrtimer_interrupt+0x128/0x2a4) from [<c0246f1c>] (arch_timer_handler_virt+0x28/0x30)
      [ 2158.173022] [<c0246f1c>] (arch_timer_handler_virt+0x28/0x30) from [<c0086214>] (handle_percpu_devid_irq+0x9c/0x124)
      [ 2158.173036] [<c0086214>] (handle_percpu_devid_irq+0x9c/0x124) from [<c0082bd8>] (generic_handle_irq+0x20/0x30)
      [ 2158.173049] [<c0082bd8>] (generic_handle_irq+0x20/0x30) from [<c000969c>] (handle_IRQ+0x64/0x8c)
      [ 2158.173060] [<c000969c>] (handle_IRQ+0x64/0x8c) from [<c0008544>] (gic_handle_irq+0x3c/0x60)
      [ 2158.173074] [<c0008544>] (gic_handle_irq+0x3c/0x60) from [<c02f0f80>] (__irq_svc+0x40/0x50)
      [ 2158.173083] Exception stack(0xc4043c98 to 0xc4043ce0)
      [ 2158.173092] 3c80:                                                       c4043ce4 00000019
      [ 2158.173102] 3ca0: 1f8a865f c050ad10 1f8a864c 00000031 c04b5970 0003ebce 00000000 f3550000
      [ 2158.173113] 3cc0: bf00bc68 00000800 0003ebce c4043ce0 c0186d14 c0186cb8 80000013 ffffffff
      [ 2158.173130] [<c02f0f80>] (__irq_svc+0x40/0x50) from [<c0186cb8>] (read_current_timer+0x4/0x38)
      [ 2158.173145] [<c0186cb8>] (read_current_timer+0x4/0x38) from [<1f8a865f>] (0x1f8a865f)
      [ 2183.927097] BUG: soft lockup - CPU#1 stuck for 22s! [io_basic:2073]
      [ 2184.002229] Modules linked in: nandflash(O) [last unloaded: nandflash]
      Signed-off-by: default avatarWang Kai <morgan.wang@huawei.com>
      Signed-off-by: default avatarhujianyang <hujianyang@huawei.com>
      Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      6876b78e
    • Ralf Baechle's avatar
      MIPS: Octeon: Delete override of cpu_has_mips_r2_exec_hazard. · af2b0e80
      Ralf Baechle authored
      commit f05ff433 upstream.
      
      This is no longer needed with the fixed, new and improved definition
      of cpu_has_mips_r2_exec_hazard in <asm/cpu-features.h>.
      
      For a discussion, see http://patchwork.linux-mips.org/patch/9539/.
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      af2b0e80
    • Ralf Baechle's avatar
      MIPS: Fix cpu_has_mips_r2_exec_hazard. · 8feb2a71
      Ralf Baechle authored
      commit 9cdf30bd upstream.
      
      Returns a non-zero value if the current processor implementation requires
      an IHB instruction to deal with an instruction hazard as per MIPS R2
      architecture specification, zero otherwise.
      
      For a discussion, see http://patchwork.linux-mips.org/patch/9539/.
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      [bwh: Backported to 3.2: trim the CPU type list]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      8feb2a71
    • Alexander Sverdlin's avatar
      MIPS: Octeon: Remove udelay() causing huge IRQ latency · 53493d44
      Alexander Sverdlin authored
      commit 73bf3c2a upstream.
      
      udelay() in PCI/PCIe read/write callbacks cause 30ms IRQ latency on Octeon
      platforms because these operations are called from PCI_OP_READ() and
      PCI_OP_WRITE() under raw_spin_lock_irqsave().
      Signed-off-by: default avatarAlexander Sverdlin <alexander.sverdlin@nokia.com>
      Cc: linux-mips@linux-mips.org
      Cc: David Daney <ddaney@cavium.com>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Jiri Kosina <jkosina@suse.cz>
      Cc: Randy Dunlap <rdunlap@infradead.org>
      Cc: Masanari Iida <standby24x7@gmail.com>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: Mathias <mathias.rulf@nokia.com>
      Patchwork: https://patchwork.linux-mips.org/patch/9576/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      [bwh: Backported to 3.2: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      53493d44
    • Lars Persson's avatar
      MIPS: Fix race condition in lazy cache flushing. · 6bde6a3d
      Lars Persson authored
      commit 4d46a67a upstream.
      
      The lazy cache flushing implemented in the MIPS kernel suffers from a
      race condition that is exposed by do_set_pte() in mm/memory.c.
      
      A pre-condition is a file-system that writes to the page from the CPU
      in its readpage method and then calls flush_dcache_page(). One example
      is ubifs. Another pre-condition is that the dcache flush is postponed
      in __flush_dcache_page().
      
      Upon a page fault for an executable mapping not existing in the
      page-cache, the following will happen:
      1. Write to the page
      2. flush_dcache_page
      3. flush_icache_page
      4. set_pte_at
      5. update_mmu_cache (commits the flush of a dcache-dirty page)
      
      Between steps 4 and 5 another thread can hit the same page and it will
      encounter a valid pte. Because the data still is in the L1 dcache the CPU
      will fetch stale data from L2 into the icache and execute garbage.
      
      This fix moves the commit of the cache flush to step 3 to close the
      race window. It also reduces the amount of flushes on non-executable
      mappings because we never enter __flush_dcache_page() for non-aliasing
      CPUs.
      
      Regressions can occur in drivers that mistakenly relies on the
      flush_dcache_page() in get_user_pages() for DMA operations.
      
      [ralf@linux-mips.org: Folded in patch 9346 to fix highmem issue.]
      Signed-off-by: default avatarLars Persson <larper@axis.com>
      Cc: linux-mips@linux-mips.org
      Cc: paul.burton@imgtec.com
      Cc: linux-kernel@vger.kernel.org
      Patchwork: https://patchwork.linux-mips.org/patch/9346/
      Patchwork: https://patchwork.linux-mips.org/patch/9738/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      6bde6a3d
    • Ben Greear's avatar
      Fix lockup related to stop_machine being stuck in __do_softirq. · 383253cf
      Ben Greear authored
      commit 34376a50 upstream.
      
      The stop machine logic can lock up if all but one of the migration
      threads make it through the disable-irq step and the one remaining
      thread gets stuck in __do_softirq.  The reason __do_softirq can hang is
      that it has a bail-out based on jiffies timeout, but in the lockup case,
      jiffies itself is not incremented.
      
      To work around this, re-add the max_restart counter in __do_irq and stop
      processing irqs after 10 restarts.
      
      Thanks to Tejun Heo and Rusty Russell and others for helping me track
      this down.
      
      This was introduced in 3.9 by commit c10d7367 ("softirq: reduce
      latencies").
      
      It may be worth looking into ath9k to see if it has issues with its irq
      handler at a later date.
      
      The hang stack traces look something like this:
      
          ------------[ cut here ]------------
          WARNING: at kernel/watchdog.c:245 watchdog_overflow_callback+0x9c/0xa7()
          Watchdog detected hard LOCKUP on cpu 2
          Modules linked in: ath9k ath9k_common ath9k_hw ath mac80211 cfg80211 nfsv4 auth_rpcgss nfs fscache nf_nat_ipv4 nf_nat veth 8021q garp stp mrp llc pktgen lockd sunrpc]
          Pid: 23, comm: migration/2 Tainted: G         C   3.9.4+ #11
          Call Trace:
           <NMI>   warn_slowpath_common+0x85/0x9f
            warn_slowpath_fmt+0x46/0x48
            watchdog_overflow_callback+0x9c/0xa7
            __perf_event_overflow+0x137/0x1cb
            perf_event_overflow+0x14/0x16
            intel_pmu_handle_irq+0x2dc/0x359
            perf_event_nmi_handler+0x19/0x1b
            nmi_handle+0x7f/0xc2
            do_nmi+0xbc/0x304
            end_repeat_nmi+0x1e/0x2e
           <<EOE>>
            cpu_stopper_thread+0xae/0x162
            smpboot_thread_fn+0x258/0x260
            kthread+0xc7/0xcf
            ret_from_fork+0x7c/0xb0
          ---[ end trace 4947dfa9b0a4cec3 ]---
          BUG: soft lockup - CPU#1 stuck for 22s! [migration/1:17]
          Modules linked in: ath9k ath9k_common ath9k_hw ath mac80211 cfg80211 nfsv4 auth_rpcgss nfs fscache nf_nat_ipv4 nf_nat veth 8021q garp stp mrp llc pktgen lockd sunrpc]
          irq event stamp: 835637905
          hardirqs last  enabled at (835637904): __do_softirq+0x9f/0x257
          hardirqs last disabled at (835637905): apic_timer_interrupt+0x6d/0x80
          softirqs last  enabled at (5654720): __do_softirq+0x1ff/0x257
          softirqs last disabled at (5654725): irq_exit+0x5f/0xbb
          CPU 1
          Pid: 17, comm: migration/1 Tainted: G        WC   3.9.4+ #11 To be filled by O.E.M. To be filled by O.E.M./To be filled by O.E.M.
          RIP: tasklet_hi_action+0xf0/0xf0
          Process migration/1
          Call Trace:
           <IRQ>
            __do_softirq+0x117/0x257
            irq_exit+0x5f/0xbb
            smp_apic_timer_interrupt+0x8a/0x98
            apic_timer_interrupt+0x72/0x80
           <EOI>
            printk+0x4d/0x4f
            stop_machine_cpu_stop+0x22c/0x274
            cpu_stopper_thread+0xae/0x162
            smpboot_thread_fn+0x258/0x260
            kthread+0xc7/0xcf
            ret_from_fork+0x7c/0xb0
      Signed-off-by: default avatarBen Greear <greearb@candelatech.com>
      Acked-by: default avatarTejun Heo <tj@kernel.org>
      Acked-by: default avatarPekka Riikonen <priikone@iki.fi>
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      [bwh: Backported to 3.2: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      Cc: Rui Xiang <rui.xiang@huawei.com>
      383253cf
    • Eric Dumazet's avatar
      softirq: reduce latencies · 29a07c1e
      Eric Dumazet authored
      commit c10d7367 upstream.
      
      In various network workloads, __do_softirq() latencies can be up
      to 20 ms if HZ=1000, and 200 ms if HZ=100.
      
      This is because we iterate 10 times in the softirq dispatcher,
      and some actions can consume a lot of cycles.
      
      This patch changes the fallback to ksoftirqd condition to :
      
      - A time limit of 2 ms.
      - need_resched() being set on current task
      
      When one of this condition is met, we wakeup ksoftirqd for further
      softirq processing if we still have pending softirqs.
      
      Using need_resched() as the only condition can trigger RCU stalls,
      as we can keep BH disabled for too long.
      
      I ran several benchmarks and got no significant difference in
      throughput, but a very significant reduction of latencies (one order
      of magnitude) :
      
      In following bench, 200 antagonist "netperf -t TCP_RR" are started in
      background, using all available cpus.
      
      Then we start one "netperf -t TCP_RR", bound to the cpu handling the NIC
      IRQ (hard+soft)
      
      Before patch :
      
      # netperf -H 7.7.7.84 -t TCP_RR -T2,2 -- -k
      RT_LATENCY,MIN_LATENCY,MAX_LATENCY,P50_LATENCY,P90_LATENCY,P99_LATENCY,MEAN_LATENCY,STDDEV_LATENCY
      MIGRATED TCP REQUEST/RESPONSE TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET
      to 7.7.7.84 () port 0 AF_INET : first burst 0 : cpu bind
      RT_LATENCY=550110.424
      MIN_LATENCY=146858
      MAX_LATENCY=997109
      P50_LATENCY=305000
      P90_LATENCY=550000
      P99_LATENCY=710000
      MEAN_LATENCY=376989.12
      STDDEV_LATENCY=184046.92
      
      After patch :
      
      # netperf -H 7.7.7.84 -t TCP_RR -T2,2 -- -k
      RT_LATENCY,MIN_LATENCY,MAX_LATENCY,P50_LATENCY,P90_LATENCY,P99_LATENCY,MEAN_LATENCY,STDDEV_LATENCY
      MIGRATED TCP REQUEST/RESPONSE TEST from 0.0.0.0 (0.0.0.0) port 0 AF_INET
      to 7.7.7.84 () port 0 AF_INET : first burst 0 : cpu bind
      RT_LATENCY=40545.492
      MIN_LATENCY=9834
      MAX_LATENCY=78366
      P50_LATENCY=33583
      P90_LATENCY=59000
      P99_LATENCY=69000
      MEAN_LATENCY=38364.67
      STDDEV_LATENCY=12865.26
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: David Miller <davem@davemloft.net>
      Cc: Tom Herbert <therbert@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      Cc: Rui Xiang <rui.xiang@huawei.com>
      29a07c1e
    • Dan McGee's avatar
      powerpc+sparc64/mm: Remove hack in mmap randomize layout · f9cedbf0
      Dan McGee authored
      commit fa8cbaaf upstream.
      
      Since commit 8a0a9bd4, this comment in mmap_rnd() does not
      hold true as the value returned by get_random_int() will in fact be
      
      different every single call. Remove the comment and simplify the code
      back to its original desired form.
      
      This reverts commit a5adc91a which is no longer necessary and
      also fixes the sparc code that copied this same adjustment.
      Signed-off-by: default avatarDan McGee <dpmcgee@gmail.com>
      Acked-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      Cc: Moritz Mühlenhoff <jmm@inutil.org>
      f9cedbf0
    • Mark Grondona's avatar
      __ptrace_may_access() should not deny sub-threads · f062bd6e
      Mark Grondona authored
      commit 73af963f upstream.
      
      __ptrace_may_access() checks get_dumpable/ptrace_has_cap/etc if task !=
      current, this can can lead to surprising results.
      
      For example, a sub-thread can't readlink("/proc/self/exe") if the
      executable is not readable.  setup_new_exec()->would_dump() notices that
      inode_permission(MAY_READ) fails and then it does
      set_dumpable(suid_dumpable).  After that get_dumpable() fails.
      
      (It is not clear why proc_pid_readlink() checks get_dumpable(), perhaps we
      could add PTRACE_MODE_NODUMPABLE)
      
      Change __ptrace_may_access() to use same_thread_group() instead of "task
      == current".  Any security check is pointless when the tasks share the
      same ->mm.
      Signed-off-by: default avatarMark Grondona <mgrondona@llnl.gov>
      Signed-off-by: default avatarBen Woodard <woodard@redhat.com>
      Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      Cc: Sheng Yong <shengyong1@huawei.com>
      f062bd6e