summaryrefslogtreecommitdiff
path: root/kernel
AgeCommit message (Collapse)Author
2017-07-11Merge "Merge android-4.4@8c91412 (v4.4.75) into msm-4.4"Linux Build Service Account
2017-07-06Merge "genirq: Don't allow user space to set IRQ affinity to isolated CPUs"Linux Build Service Account
2017-07-06Merge android-4.4@8c91412 (v4.4.75) into msm-4.4Blagovest Kolenichev
* refs/heads/tmp-8c91412: Linux 4.4.75 nvme: apply DELAY_BEFORE_CHK_RDY quirk at probe time too nvme/quirk: Add a delay before checking for adapter readiness net: phy: fix marvell phy status reading net: phy: Initialize mdio clock at probe function usb: gadget: f_fs: avoid out of bounds access on comp_desc powerpc/slb: Force a full SLB flush when we insert for a bad EA mtd: spi-nor: fix spansion quad enable of: Add check to of_scan_flat_dt() before accessing initial_boot_params rxrpc: Fix several cases where a padded len isn't checked in ticket decode USB: usbip: fix nonconforming hub descriptor drm/amdgpu: adjust default display clock drm/amdgpu/atom: fix ps allocation size for EnableDispPowerGating drm/radeon: add a quirk for Toshiba Satellite L20-183 drm/radeon: add a PX quirk for another K53TK variant iscsi-target: Reject immediate data underflow larger than SCSI transfer length target: Fix kref->refcount underflow in transport_cmd_finish_abort time: Fix clock->read(clock) race around clocksource changes Input: i8042 - add Fujitsu Lifebook AH544 to notimeout list powerpc/kprobes: Pause function_graph tracing during jprobes handling signal: Only reschedule timers on signals timers have sent HID: Add quirk for Dell PIXART OEM mouse CIFS: Improve readdir verbosity KVM: PPC: Book3S HV: Preserve userspace HTM state properly lib/cmdline.c: fix get_options() overflow while parsing ranges autofs: sanity check status reported with AUTOFS_DEV_IOCTL_FAIL fs/exec.c: account for argv/envp pointers UPSTREAM: drivers/perf: arm-pmu: fix RCU usage on pmu resume from low-power UPSTREAM: drivers/perf: arm_pmu: implement CPU_PM notifier ANDROID: squashfs: Fix endianness issue ANDROID: squashfs: Fix signed division issue Change-Id: Iabe0921dd7b9a582f5237235338ef0f730de7edb Signed-off-by: Blagovest Kolenichev <bkolenichev@codeaurora.org>
2017-07-04Merge "genirq: honour default IRQ affinity setting during migration"Linux Build Service Account
2017-07-03Merge "osq_lock: fix osq_lock queue corruption"Linux Build Service Account
2017-07-03Merge "Merge branch 'android-4.4@77ddb50' (v4.4.74) into 'msm-4.4'"Linux Build Service Account
2017-07-03Merge "osq_lock: avoid live-lock issue for RT task"Linux Build Service Account
2017-07-03Merge "cpu-hotplug: Keep atleast 1 online and un-isolated CPU"Linux Build Service Account
2017-07-03Merge "cgroup: Fix potential race between cgroup_exit and migrate path"Linux Build Service Account
2017-07-02osq_lock: fix osq_lock queue corruptionPrateek Sood
Fix ordering of link creation between node->prev and prev->next in osq_lock(). A case in which the status of optimistic spin queue is CPU6->CPU2 in which CPU6 has acquired the lock. At this point if CPU0 comes in to acquire osq_lock, it will update the tail count. After tail count update if CPU2 starts to unqueue itself from optimistic spin queue, it will find updated tail count with CPU0 and update CPU2 node->next to NULL in osq_wait_next(). If reordering of following stores happen then prev->next where prev being CPU2 would be updated to point to CPU0 node: node->prev = prev; WRITE_ONCE(prev->next, node); At this point if next instruction WRITE_ONCE(next->prev, prev); in CPU2 path is committed before the update of CPU0 node->prev = prev then CPU0 node->prev will point to CPU6 node. At this point if CPU0 path's node->prev = prev is committed resulting in change of CPU0 prev back to CPU2 node. CPU2 node->next is NULL currently, so if CPU0 gets into unqueue path of osq_lock it will keep spinning in infinite loop as condition prev->next == node will never be true. Change-Id: I48d847096daf3c228de90ae1cd2a6415b7bde65a Signed-off-by: Prateek Sood <prsood@codeaurora.org>
2017-06-30osq_lock: avoid live-lock issue for RT taskPrateek Sood
Live Lock due to task spinning while unqueue of CPU osq_node from optimistic_spin_queue. Task T1 had decremented mutex count to acquire the lock on CPU0. Before setting owner it got preempted. On CPU1 task T2 acquired osq_lock and started spinning on owner of mutex with preemption disabled. CPU1 runq has one task, so need_resched will not be set. On CPU0 task T3 tried to acquire osq_lock to spin on the same mutex. At this time following scenario causes soft lockup: After preemption of task T1, RT task T3 tried to acquire the same mutex. It will start spinning on the osq_lock until the lock is available or need_resched is set. For RT task, need_resched will not be set. Task T3 will not be able to bail out of the infinite loop. Change-Id: Ifd7506047119a22e14b15459ac6b04b410ba1c84 Signed-off-by: Prateek Sood <prsood@codeaurora.org>
2017-06-30genirq: Don't allow user space to set IRQ affinity to isolated CPUsPavankumar Kondeti
The PM_QOS_CPU_DMA_LATENCY QOS request attached to an IRQ is ignored if the IRQ is affined to an isolated CPU. As isolated CPUs enter deep sleep state, it is better not to affine IRQs to those CPUs. Change-Id: Ieab4a04eca222b91159208b21bc9e14390ecd62e Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
2017-06-30genirq: honour default IRQ affinity setting during migrationPavankumar Kondeti
Userspace can set the default IRQ affinity setting by writing into /proc/irq/default_smp_affinity file. When an IRQ affinity is broken during isolation/hotplug,override the affinity to online and un-isolated CPUs from the default affinity CPUs. If no such CPU is available, then only override with cpu_online_mask. Change-Id: I7578728ed0d7c17c5890d9916cfd6451d1968568 Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
2017-06-30genriq: pick only one CPU while overriding the affinity during migrationPavankumar Kondeti
With commit bfc60d474137 ("genirq: Use irq_set_affinity_locked to change irq affinity"), affinity listeners receive the notification when the irq affinity is changed during migration. If there is no online and un-isolated CPU available from the user specified affinity, the affinity is overridden with all online and un-isolated CPUs. The same cpumask is notified to PM QOS affinity listener which applies PM_QOS_CPU_DMA_LATENCY vote to all those CPUs. As the low level irqchip driver sets affinity to only one CPU, do the same while overriding the affinity during migration. Change-Id: I0bcb75dd356658da100fbeeefd33ef8b121f4d6d Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
2017-06-29Merge 4.4.75 into android-4.4Greg Kroah-Hartman
Changes in 4.4.75 fs/exec.c: account for argv/envp pointers autofs: sanity check status reported with AUTOFS_DEV_IOCTL_FAIL lib/cmdline.c: fix get_options() overflow while parsing ranges KVM: PPC: Book3S HV: Preserve userspace HTM state properly CIFS: Improve readdir verbosity HID: Add quirk for Dell PIXART OEM mouse signal: Only reschedule timers on signals timers have sent powerpc/kprobes: Pause function_graph tracing during jprobes handling Input: i8042 - add Fujitsu Lifebook AH544 to notimeout list time: Fix clock->read(clock) race around clocksource changes target: Fix kref->refcount underflow in transport_cmd_finish_abort iscsi-target: Reject immediate data underflow larger than SCSI transfer length drm/radeon: add a PX quirk for another K53TK variant drm/radeon: add a quirk for Toshiba Satellite L20-183 drm/amdgpu/atom: fix ps allocation size for EnableDispPowerGating drm/amdgpu: adjust default display clock USB: usbip: fix nonconforming hub descriptor rxrpc: Fix several cases where a padded len isn't checked in ticket decode of: Add check to of_scan_flat_dt() before accessing initial_boot_params mtd: spi-nor: fix spansion quad enable powerpc/slb: Force a full SLB flush when we insert for a bad EA usb: gadget: f_fs: avoid out of bounds access on comp_desc net: phy: Initialize mdio clock at probe function net: phy: fix marvell phy status reading nvme/quirk: Add a delay before checking for adapter readiness nvme: apply DELAY_BEFORE_CHK_RDY quirk at probe time too Linux 4.4.75 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2017-06-29cpu-hotplug: Keep atleast 1 online and un-isolated CPUPavankumar Kondeti
The PM_QOS_CPU_DMA_LATENCY vote attached to an IRQ is discarded, if it is affined to an isolated CPU. So we need atleast 1 CPU in online and un-isolate state. The scheduler rejects isolating a CPU if it is the only online and un-isolated CPU in the system. Add the same check for CPU hotplug. Change-Id: I5bdfe6e3bb0352ed3ae5a2de90097b73d248f3fc Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
2017-06-29time: Fix clock->read(clock) race around clocksource changesJohn Stultz
commit ceea5e3771ed2378668455fa21861bead7504df5 upstream. In tests, which excercise switching of clocksources, a NULL pointer dereference can be observed on AMR64 platforms in the clocksource read() function: u64 clocksource_mmio_readl_down(struct clocksource *c) { return ~(u64)readl_relaxed(to_mmio_clksrc(c)->reg) & c->mask; } This is called from the core timekeeping code via: cycle_now = tkr->read(tkr->clock); tkr->read is the cached tkr->clock->read() function pointer. When the clocksource is changed then tkr->clock and tkr->read are updated sequentially. The code above results in a sequential load operation of tkr->read and tkr->clock as well. If the store to tkr->clock hits between the loads of tkr->read and tkr->clock, then the old read() function is called with the new clock pointer. As a consequence the read() function dereferences a different data structure and the resulting 'reg' pointer can point anywhere including NULL. This problem was introduced when the timekeeping code was switched over to use struct tk_read_base. Before that, it was theoretically possible as well when the compiler decided to reload clock in the code sequence: now = tk->clock->read(tk->clock); Add a helper function which avoids the issue by reading tk_read_base->clock once into a local variable clk and then issue the read function via clk->read(clk). This guarantees that the read() function always gets the proper clocksource pointer handed in. Since there is now no use for the tkr.read pointer, this patch also removes it, and to address stopping the fast timekeeper during suspend/resume, it introduces a dummy clocksource to use rather then just a dummy read function. Signed-off-by: John Stultz <john.stultz@linaro.org> Acked-by: Ingo Molnar <mingo@kernel.org> Cc: Prarit Bhargava <prarit@redhat.com> Cc: Richard Cochran <richardcochran@gmail.com> Cc: Stephen Boyd <stephen.boyd@linaro.org> Cc: Miroslav Lichvar <mlichvar@redhat.com> Cc: Daniel Mentz <danielmentz@google.com> Link: http://lkml.kernel.org/r/1496965462-20003-2-git-send-email-john.stultz@linaro.org Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-29signal: Only reschedule timers on signals timers have sentEric W. Biederman
commit 57db7e4a2d92c2d3dfbca4ef8057849b2682436b upstream. Thomas Gleixner wrote: > The CRIU support added a 'feature' which allows a user space task to send > arbitrary (kernel) signals to itself. The changelog says: > > The kernel prevents sending of siginfo with positive si_code, because > these codes are reserved for kernel. I think we can allow a task to > send such a siginfo to itself. This operation should not be dangerous. > > Quite contrary to that claim, it turns out that it is outright dangerous > for signals with info->si_code == SI_TIMER. The following code sequence in > a user space task allows to crash the kernel: > > id = timer_create(CLOCK_XXX, ..... signo = SIGX); > timer_set(id, ....); > info->si_signo = SIGX; > info->si_code = SI_TIMER: > info->_sifields._timer._tid = id; > info->_sifields._timer._sys_private = 2; > rt_[tg]sigqueueinfo(..., SIGX, info); > sigemptyset(&sigset); > sigaddset(&sigset, SIGX); > rt_sigtimedwait(sigset, info); > > For timers based on CLOCK_PROCESS_CPUTIME_ID, CLOCK_THREAD_CPUTIME_ID this > results in a kernel crash because sigwait() dequeues the signal and the > dequeue code observes: > > info->si_code == SI_TIMER && info->_sifields._timer._sys_private != 0 > > which triggers the following callchain: > > do_schedule_next_timer() -> posix_cpu_timer_schedule() -> arm_timer() > > arm_timer() executes a list_add() on the timer, which is already armed via > the timer_set() syscall. That's a double list add which corrupts the posix > cpu timer list. As a consequence the kernel crashes on the next operation > touching the posix cpu timer list. > > Posix clocks which are internally implemented based on hrtimers are not > affected by this because hrtimer_start() can handle already armed timers > nicely, but it's a reliable way to trigger the WARN_ON() in > hrtimer_forward(), which complains about calling that function on an > already armed timer. This problem has existed since the posix timer code was merged into 2.5.63. A few releases earlier in 2.5.60 ptrace gained the ability to inject not just a signal (which linux has supported since 1.0) but the full siginfo of a signal. The core problem is that the code will reschedule in response to signals getting dequeued not just for signals the timers sent but for other signals that happen to a si_code of SI_TIMER. Avoid this confusion by testing to see if the queued signal was preallocated as all timer signals are preallocated, and so far only the timer code preallocates signals. Move the check for if a timer needs to be rescheduled up into collect_signal where the preallocation check must be performed, and pass the result back to dequeue_signal where the code reschedules timers. This makes it clear why the code cares about preallocated timers. Reported-by: Thomas Gleixner <tglx@linutronix.de> History Tree: https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git Reference: 66dd34ad31e5 ("signal: allow to send any siginfo to itself") Reference: 1669ce53e2ff ("Add PTRACE_GETSIGINFO and PTRACE_SETSIGINFO") Fixes: db8b50ba75f2 ("[PATCH] POSIX clocks & timers") Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-28Merge branch 'android-4.4@77ddb50' (v4.4.74) into 'msm-4.4'Blagovest Kolenichev
* refs/heads/tmp-77ddb50: UPSTREAM: usb: gadget: f_fs: avoid out of bounds access on comp_desc Linux 4.4.74 mm: fix new crash in unmapped_area_topdown() Allow stack to grow up to address space limit mm: larger stack guard gap, between vmas alarmtimer: Rate limit periodic intervals MIPS: Fix bnezc/jialc return address calculation usb: dwc3: exynos fix axius clock error path to do cleanup alarmtimer: Prevent overflow of relative timers genirq: Release resources in __setup_irq() error path swap: cond_resched in swap_cgroup_prepare() mm/memory-failure.c: use compound_head() flags for huge pages USB: gadgetfs, dummy-hcd, net2280: fix locking for callbacks usb: xhci: ASMedia ASM1042A chipset need shorts TX quirk drivers/misc/c2port/c2port-duramar2150.c: checking for NULL instead of IS_ERR() usb: r8a66597-hcd: decrease timeout usb: r8a66597-hcd: select a different endpoint on timeout USB: gadget: dummy_hcd: fix hub-descriptor removable fields pvrusb2: reduce stack usage pvr2_eeprom_analyze() usb: core: fix potential memory leak in error path during hcd creation USB: hub: fix SS max number of ports iio: proximity: as3935: recalibrate RCO after resume staging: rtl8188eu: prevent an underflow in rtw_check_beacon_data() mfd: omap-usb-tll: Fix inverted bit use for USB TLL mode x86/mm/32: Set the '__vmalloc_start_set' flag in initmem_init() serial: efm32: Fix parity management in 'efm32_uart_console_get_options()' mac80211: fix IBSS presp allocation size mac80211: fix CSA in IBSS mode mac80211/wpa: use constant time memory comparison for MACs mac80211: don't look at the PM bit of BAR frames vb2: Fix an off by one error in 'vb2_plane_vaddr' cpufreq: conservative: Allow down_threshold to take values from 1 to 10 can: gs_usb: fix memory leak in gs_cmd_reset() configfs: Fix race between create_link and configfs_rmdir UPSTREAM: bpf: don't let ldimm64 leak map addresses on unprivileged BACKPORT: ext4: fix data exposure after a crash ANDROID: sdcardfs: remove dead function open_flags_to_access_mode() ANDROID: android-base.cfg: split out arm64-specific configs Linux 4.4.73 sparc64: make string buffers large enough s390/kvm: do not rely on the ILC on kvm host protection fauls xtensa: don't use linux IRQ #0 tipc: ignore requests when the connection state is not CONNECTED proc: add a schedule point in proc_pid_readdir() romfs: use different way to generate fsid for BLOCK or MTD sctp: sctp_addr_id2transport should verify the addr before looking up assoc r8152: avoid start_xmit to schedule napi when napi is disabled r8152: fix rtl8152_post_reset function r8152: re-schedule napi for tx nfs: Fix "Don't increment lock sequence ID after NFS4ERR_MOVED" ravb: unmap descriptors when freeing rings drm/ast: Fixed system hanged if disable P2A drm/nouveau: Don't enabling polling twice on runtime resume parisc, parport_gsc: Fixes for printk continuation lines net: adaptec: starfire: add checks for dma mapping errors pinctrl: berlin-bg4ct: fix the value for "sd1a" of pin SCRD0_CRD_PRES gianfar: synchronize DMA API usage by free_skb_rx_queue w/ gfar_new_page net/mlx4_core: Avoid command timeouts during VF driver device shutdown drm/nouveau/fence/g84-: protect against concurrent access to semaphore buffers drm/nouveau: prevent userspace from deleting client object ipv6: fix flow labels when the traffic class is non-0 FS-Cache: Initialise stores_lock in netfs cookie fscache: Clear outstanding writes when disabling a cookie fscache: Fix dead object requeue ethtool: do not vzalloc(0) on registers dump log2: make order_base_2() behave correctly on const input value zero kasan: respect /proc/sys/kernel/traceoff_on_warning jump label: pass kbuild_cflags when checking for asm goto support PM / runtime: Avoid false-positive warnings from might_sleep_if() ipv6: Fix IPv6 packet loss in scenarios involving roaming + snooping switches i2c: piix4: Fix request_region size sierra_net: Add support for IPv6 and Dual-Stack Link Sense Indications sierra_net: Skip validating irrelevant fields for IDLE LSIs net: hns: Fix the device being used for dma mapping during TX NET: mkiss: Fix panic NET: Fix /proc/net/arp for AX.25 ipv6: Inhibit IPv4-mapped src address on the wire. ipv6: Handle IPv4-mapped src to in6addr_any dst. net: xilinx_emaclite: fix receive buffer overflow net: xilinx_emaclite: fix freezes due to unordered I/O Call echo service immediately after socket reconnect staging: rtl8192e: rtl92e_fill_tx_desc fix write to mapped out memory. ARM: dts: imx6dl: Fix the VDD_ARM_CAP voltage for 396MHz operation partitions/msdos: FreeBSD UFS2 file systems are not recognized s390/vmem: fix identity mapping usb: gadget: f_fs: Fix possibe deadlock Conflicts: drivers/usb/gadget/function/f_fs.c Change-Id: I23106e9fc2c4f2d0b06acce59b781f6c36487fcc Signed-off-by: Blagovest Kolenichev <bkolenichev@codeaurora.org>
2017-06-28perf: stop deadlock if attempt to bring cpu up failsNeil Leeder
When an attempt is made to free an event on a CPU which is no longer online, perf tries to bring the CPU online. This can fail, resulting in an UP_CANCELLED notifier, which eventually tries to acquire the ctx->mutex which is already being held by the code, which brings up the CPU. Removing the attempt to bring the cpu up will remove this deadlock, but also requires temporarily removing support of counting events across hotplug. This will be restored in a later patch. Conflicts: kernel/events/core.c kernel/events/hw_breakpoint.c Change-Id: Iaafa3c6688d26508857472fd5bb32139a137880e Signed-off-by: Neil Leeder <nleeder@codeaurora.org>
2017-06-27Merge 4.4.74 into android-4.4Greg Kroah-Hartman
Changes in 4.4.74 configfs: Fix race between create_link and configfs_rmdir can: gs_usb: fix memory leak in gs_cmd_reset() cpufreq: conservative: Allow down_threshold to take values from 1 to 10 vb2: Fix an off by one error in 'vb2_plane_vaddr' mac80211: don't look at the PM bit of BAR frames mac80211/wpa: use constant time memory comparison for MACs mac80211: fix CSA in IBSS mode mac80211: fix IBSS presp allocation size serial: efm32: Fix parity management in 'efm32_uart_console_get_options()' x86/mm/32: Set the '__vmalloc_start_set' flag in initmem_init() mfd: omap-usb-tll: Fix inverted bit use for USB TLL mode staging: rtl8188eu: prevent an underflow in rtw_check_beacon_data() iio: proximity: as3935: recalibrate RCO after resume USB: hub: fix SS max number of ports usb: core: fix potential memory leak in error path during hcd creation pvrusb2: reduce stack usage pvr2_eeprom_analyze() USB: gadget: dummy_hcd: fix hub-descriptor removable fields usb: r8a66597-hcd: select a different endpoint on timeout usb: r8a66597-hcd: decrease timeout drivers/misc/c2port/c2port-duramar2150.c: checking for NULL instead of IS_ERR() usb: xhci: ASMedia ASM1042A chipset need shorts TX quirk USB: gadgetfs, dummy-hcd, net2280: fix locking for callbacks mm/memory-failure.c: use compound_head() flags for huge pages swap: cond_resched in swap_cgroup_prepare() genirq: Release resources in __setup_irq() error path alarmtimer: Prevent overflow of relative timers usb: dwc3: exynos fix axius clock error path to do cleanup MIPS: Fix bnezc/jialc return address calculation alarmtimer: Rate limit periodic intervals mm: larger stack guard gap, between vmas Allow stack to grow up to address space limit mm: fix new crash in unmapped_area_topdown() Linux 4.4.74 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2017-06-26alarmtimer: Rate limit periodic intervalsThomas Gleixner
commit ff86bf0c65f14346bf2440534f9ba5ac232c39a0 upstream. The alarmtimer code has another source of potentially rearming itself too fast. Interval timers with a very samll interval have a similar CPU hog effect as the previously fixed overflow issue. The reason is that alarmtimers do not implement the normal protection against this kind of problem which the other posix timer use: timer expires -> queue signal -> deliver signal -> rearm timer This scheme brings the rearming under scheduler control and prevents permanently firing timers which hog the CPU. Bringing this scheme to the alarm timer code is a major overhaul because it lacks all the necessary mechanisms completely. So for a quick fix limit the interval to one jiffie. This is not problematic in practice as alarmtimers are usually backed by an RTC for suspend which have 1 second resolution. It could be therefor argued that the resolution of this clock should be set to 1 second in general, but that's outside the scope of this fix. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Kostya Serebryany <kcc@google.com> Cc: syzkaller <syzkaller@googlegroups.com> Cc: John Stultz <john.stultz@linaro.org> Cc: Dmitry Vyukov <dvyukov@google.com> Link: http://lkml.kernel.org/r/20170530211655.896767100@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-26alarmtimer: Prevent overflow of relative timersThomas Gleixner
commit f4781e76f90df7aec400635d73ea4c35ee1d4765 upstream. Andrey reported a alartimer related RCU stall while fuzzing the kernel with syzkaller. The reason for this is an overflow in ktime_add() which brings the resulting time into negative space and causes immediate expiry of the timer. The following rearm with a small interval does not bring the timer back into positive space due to the same issue. This results in a permanent firing alarmtimer which hogs the CPU. Use ktime_add_safe() instead which detects the overflow and clamps the result to KTIME_SEC_MAX. Reported-by: Andrey Konovalov <andreyknvl@google.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Kostya Serebryany <kcc@google.com> Cc: syzkaller <syzkaller@googlegroups.com> Cc: John Stultz <john.stultz@linaro.org> Cc: Dmitry Vyukov <dvyukov@google.com> Link: http://lkml.kernel.org/r/20170530211655.802921648@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-26genirq: Release resources in __setup_irq() error pathHeiner Kallweit
commit fa07ab72cbb0d843429e61bf179308aed6cbe0dd upstream. In case __irq_set_trigger() fails the resources requested via irq_request_resources() are not released. Add the missing release call into the error handling path. Fixes: c1bacbae8192 ("genirq: Provide irq_request/release_resources chip callbacks") Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/655538f5-cb20-a892-ff15-fbd2dd1fa4ec@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-23UPSTREAM: bpf: don't let ldimm64 leak map addresses on unprivilegedDaniel Borkmann
[ Upstream commit 0d0e57697f162da4aa218b5feafe614fb666db07 ] The patch fixes two things at once: 1) It checks the env->allow_ptr_leaks and only prints the map address to the log if we have the privileges to do so, otherwise it just dumps 0 as we would when kptr_restrict is enabled on %pK. Given the latter is off by default and not every distro sets it, I don't want to rely on this, hence the 0 by default for unprivileged. 2) Printing of ldimm64 in the verifier log is currently broken in that we don't print the full immediate, but only the 32 bit part of the first insn part for ldimm64. Thus, fix this up as well; it's okay to access, since we verified all ldimm64 earlier already (including just constants) through replace_map_fd_with_map_ptr(). Fixes: 1be7f75d1668 ("bpf: enable non-root eBPF programs") Fixes: cbd357008604 ("bpf: verifier (add ability to receive verification log)") Reported-by: Jann Horn <jannh@google.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Alexei Starovoitov <ast@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Bug: 62199770 Change-Id: I62ee47d06ddc669ba2863e8cf24f8f3e7683a461
2017-06-22Merge "Merge branch 'android-4.4@e76c0fa' into branch 'msm-4.4'"Linux Build Service Account
2017-06-22Merge "sched: avoid migrating when softint on tgt cpu should be short"Linux Build Service Account
2017-06-22Merge "Merge branch 'android-4.4@6fc0573' into branch 'msm-4.4'"Linux Build Service Account
2017-06-21cgroup: Fix potential race between cgroup_exit and migrate pathNeeraj Upadhyay
There is a potential race between cgroup_exit() and the migration path. This race happens because cgroup_exit path reads the css_set and does cg_list empty check outside of css_set lock. This can potentially race with the migrate path trying to move the tasks to a different css_set. For instance, below is the interleaved sequence of events, where race is observed: cpuset_hotplug_workfn() cgroup_transfer_tasks() cgroup_migrate() cgroup_taskset_migrate() css_set_move_task() list_del_init(&task->cg_list); <TASK EXIT> cgroup_exit() cset = task_css_set(tsk); if (!list_empty(&tsk->cg_list)) <TASK NOT DISSOCIATED FROM ITS CSS_SET> list_add_tail(&task->cg_list, use_mg_tasks In above sequence, as cgroup_exit() read the cg_list for the task as empty, it didn't disassociate it from its current css_set, and was moved to new css_set instance css_set_move_task() called from cpuset_hotplug_workfn() path. This eventually can result in use after free scenarios, while accessing the same task_struct again, like in following sequence: kernfs_seq_start() cgroup_seqfile_start() cgroup_pidlist_start() css_task_iter_next() __put_task_struct() <NULL pointer dereference> Fix this problem, by moving the css_set and cg_list fetch in cgroup_exit() inside css_set lock. Change-Id: I66060b8faffc06ffb19e2c166013551d4c9cb746 Signed-off-by: Neeraj Upadhyay <neeraju@codeaurora.org>
2017-06-20Merge branch 'android-4.4@e76c0fa' into branch 'msm-4.4'Blagovest Kolenichev
* refs/heads/tmp-e76c0fa Linux 4.4.72 arm64: ensure extension of smp_store_release value arm64: armv8_deprecated: ensure extension of addr usercopy: Adjust tests to deal with SMAP/PAN RDMA/qib,hfi1: Fix MR reference count leak on write with immediate arm64: entry: improve data abort handling of tagged pointers arm64: hw_breakpoint: fix watchpoint matching for tagged pointers Make __xfs_xattr_put_listen preperly report errors. NFSv4: Don't perform cached access checks before we've OPENed the file NFS: Ensure we revalidate attributes before using execute_ok() mm: consider memblock reservations for deferred memory initialization sizing net: better skb->sender_cpu and skb->napi_id cohabitation serial: sh-sci: Fix panic when serial console and DMA are enabled tty: Drop krefs for interrupted tty lock drivers: char: mem: Fix wraparound check to allow mappings up to the end ASoC: Fix use-after-free at card unregistration ALSA: timer: Fix missing queue indices reset at SNDRV_TIMER_IOCTL_SELECT ALSA: timer: Fix race between read and ioctl drm/nouveau/tmr: fully separate alarm execution/pending lists drm/vmwgfx: Make sure backup_handle is always valid drm/vmwgfx: limit the number of mip levels in vmw_gb_surface_define_ioctl() drm/vmwgfx: Handle vmalloc() failure in vmw_local_fifo_reserve() perf/core: Drop kernel samples even though :u is specified powerpc/hotplug-mem: Fix missing endian conversion of aa_index powerpc/numa: Fix percpu allocations to be NUMA aware powerpc/eeh: Avoid use after free in eeh_handle_special_event() scsi: qla2xxx: don't disable a not previously enabled PCI device KVM: arm/arm64: Handle possible NULL stage2 pud when ageing pages btrfs: fix memory leak in update_space_info failure path btrfs: use correct types for page indices in btrfs_page_exists_in_range cxl: Fix error path on bad ioctl ufs_getfrag_block(): we only grab ->truncate_mutex on block creation path ufs_extend_tail(): fix the braino in calling conventions of ufs_new_fragments() ufs: set correct ->s_maxsize ufs: restore maintaining ->i_blocks fix ufs_isblockset() ufs: restore proper tail allocation fs: add i_blocksize() cpuset: consider dying css as offline Input: elantech - add Fujitsu Lifebook E546/E557 to force crc_enabled drm/msm: Expose our reservation object when exporting a dmabuf. target: Re-add check to reject control WRITEs with overflow data cpufreq: cpufreq_register_driver() should return -ENODEV if init fails stackprotector: Increase the per-task stack canary's random range from 32 bits to 64 bits on 64-bit platforms random: properly align get_random_int_hash drivers: char: random: add get_random_long() iio: proximity: as3935: fix AS3935_INT mask iio: light: ltr501 Fix interchanged als/ps register field staging/lustre/lov: remove set_fs() call from lov_getstripe() usb: chipidea: debug: check before accessing ci_role usb: chipidea: udc: fix NULL pointer dereference if udc_start failed usb: gadget: f_mass_storage: Serialize wake and sleep execution ext4: fix fdatasync(2) after extent manipulation operations ext4: keep existing extra fields when inode expands ext4: fix SEEK_HOLE xen-netfront: cast grant table reference first to type int xen-netfront: do not cast grant table reference to signed short xen/privcmd: Support correctly 64KB page granularity when mapping memory dmaengine: ep93xx: Always start from BASE0 dmaengine: usb-dmac: Fix DMAOR AE bit definition KVM: async_pf: avoid async pf injection when in guest mode arm: KVM: Allow unaligned accesses at HYP KVM: cpuid: Fix read/write out-of-bounds vulnerability in cpuid emulation kvm: async_pf: fix rcu_irq_enter() with irqs enabled nfsd: Fix up the "supattr_exclcreat" attributes nfsd4: fix null dereference on replay drm/amdgpu/ci: disable mclk switching for high refresh rates (v2) crypto: gcm - wait for crypto op not signal safe KEYS: fix freeing uninitialized memory in key_update() KEYS: fix dereferencing NULL payload with nonzero length ptrace: Properly initialize ptracer_cred on fork serial: ifx6x60: fix use-after-free on module unload arch/sparc: support NR_CPUS = 4096 sparc64: delete old wrap code sparc64: new context wrap sparc64: add per-cpu mm of secondary contexts sparc64: redefine first version sparc64: combine activate_mm and switch_mm sparc64: reset mm cpumask after wrap sparc: Machine description indices can vary sparc64: mm: fix copy_tsb to correctly copy huge page TSBs net: bridge: start hello timer only if device is up net: ethoc: enable NAPI before poll may be scheduled net: ping: do not abuse udp_poll() ipv6: Fix leak in ipv6_gso_segment(). vxlan: fix use-after-free on deletion tcp: disallow cwnd undo when switching congestion control cxgb4: avoid enabling napi twice to the same queue ipv6: xfrm: Handle errors reported by xfrm6_find_1stfragopt() bnx2x: Fix Multi-Cos ANDROID: uid_sys_stats: check previous uid_entry before call find_or_register_uid ANDROID: sdcardfs: d_splice_alias can return error values Change-Id: I829ebf1a9271dcf0462c537e7bfcbcfde322f336 Signed-off-by: Blagovest Kolenichev <bkolenichev@codeaurora.org>
2017-06-19Merge branch 'android-4.4@6fc0573' into branch 'msm-4.4'Blagovest Kolenichev
* refs/heads/tmp-6fc0573: Linux 4.4.71 xfs: only return -errno or success from attr ->put_listent xfs: in _attrlist_by_handle, copy the cursor back to userspace xfs: fix unaligned access in xfs_btree_visit_blocks xfs: bad assertion for delalloc an extent that start at i_size xfs: fix indlen accounting error on partial delalloc conversion xfs: wait on new inodes during quotaoff dquot release xfs: update ag iterator to support wait on new inodes xfs: support ability to wait on new inodes xfs: fix up quotacheck buffer list error handling xfs: prevent multi-fsb dir readahead from reading random blocks xfs: handle array index overrun in xfs_dir2_leaf_readbuf() xfs: fix over-copying of getbmap parameters from userspace xfs: fix off-by-one on max nr_pages in xfs_find_get_desired_pgoff() xfs: Fix missed holes in SEEK_HOLE implementation mlock: fix mlock count can not decrease in race condition mm/migrate: fix refcount handling when !hugepage_migration_supported() drm/gma500/psb: Actually use VBT mode when it is found slub/memcg: cure the brainless abuse of sysfs attributes ALSA: hda - apply STAC_9200_DELL_M22 quirk for Dell Latitude D430 pcmcia: remove left-over %Z format drm/radeon: Unbreak HPD handling for r600+ drm/radeon/ci: disable mclk switching for high refresh rates (v2) scsi: mpt3sas: Force request partial completion alignment HID: wacom: Have wacom_tpc_irq guard against possible NULL dereference mmc: sdhci-iproc: suppress spurious interrupt with Multiblock read i2c: i2c-tiny-usb: fix buffer not being DMA capable vlan: Fix tcp checksum offloads in Q-in-Q vlans net: phy: marvell: Limit errata to 88m1101 netem: fix skb_orphan_partial() ipv4: add reference counting to metrics sctp: fix ICMP processing if skb is non-linear tcp: avoid fastopen API to be used on AF_UNSPEC virtio-net: enable TSO/checksum offloads for Q-in-Q vlans be2net: Fix offload features for Q-in-Q packets ipv6: fix out of bound writes in __ip6_append_data() bridge: start hello_timer when enabling KERNEL_STP in br_stp_start qmi_wwan: add another Lenovo EM74xx device ID bridge: netlink: check vlan_default_pvid range ipv6: Check ip6_find_1stfragopt() return value properly. ipv6: Prevent overrun when parsing v6 header options net: Improve handling of failures on link and route dumps tcp: eliminate negative reordering in tcp_clean_rtx_queue sctp: do not inherit ipv6_{mc|ac|fl}_list from parent sctp: fix src address selection if using secondary addresses for ipv6 tcp: avoid fragmenting peculiar skbs in SACK s390/qeth: avoid null pointer dereference on OSN s390/qeth: unbreak OSM and OSN support s390/qeth: handle sysfs error during initialization ipv6/dccp: do not inherit ipv6_mc_list from parent dccp/tcp: do not inherit mc_list from parent sparc: Fix -Wstringop-overflow warning android: base-cfg: disable CONFIG_NFS_FS and CONFIG_NFSD schedstats/eas: guard properly to avoid breaking non-smp schedstats users BACKPORT: f2fs: sanity check size of nat and sit cache FROMLIST: f2fs: sanity check checkpoint segno and blkoff sched/tune: don't use schedtune before it is ready sched/fair: use SCHED_CAPACITY_SCALE for energy normalization sched/{fair,tune}: use reciprocal_value to compute boost margin sched/tune: Initialize raw_spin_lock in boosted_groups sched/tune: report when SchedTune has not been initialized sched/tune: fix sched_energy_diff tracepoint sched/tune: increase group count to 5 cpufreq/schedutil: use boosted_cpu_util for PELT to match WALT sched/fair: Fix sched_group_energy() to support per-cpu capacity states sched/fair: discount task contribution to find CPU with lowest utilization sched/fair: ensure utilization signals are synchronized before use sched/fair: remove task util from own cpu when placing waking task trace:sched: Make util_avg in load_avg trace reflect PELT/WALT as used sched/fair: Add eas (& cas) specific rq, sd and task stats sched/core: Fix PELT jump to max OPP upon util increase sched: EAS & 'single cpu per cluster'/cpu hotplug interoperability UPSTREAM: sched/core: Fix group_entity's share update UPSTREAM: sched/fair: Fix calc_cfs_shares() fixed point arithmetics width confusion UPSTREAM: sched/fair: Fix incorrect task group ->load_avg UPSTREAM: sched/fair: Fix effective_load() to consistently use smoothed load UPSTREAM: sched/fair: Propagate asynchrous detach UPSTREAM: sched/fair: Propagate load during synchronous attach/detach UPSTREAM: sched/fair: Fix hierarchical order in rq->leaf_cfs_rq_list BACKPORT: sched/fair: Factorize PELT update UPSTREAM: sched/fair: Factorize attach/detach entity UPSTREAM: sched/fair: Improve PELT stuff some more UPSTREAM: sched/fair: Apply more PELT fixes UPSTREAM: sched/fair: Fix post_init_entity_util_avg() serialization BACKPORT: sched/fair: Initiate a new task's util avg to a bounded value sched/fair: Simplify idle_idx handling in select_idle_sibling() sched/fair: refactor find_best_target() for simplicity sched/fair: Change cpu iteration order in find_best_target() sched/core: Add first cpu w/ max/min orig capacity to root domain sched/core: Remove remnants of commit fd5c98da1a42 sched: Remove sysctl_sched_is_big_little sched/fair: Code !is_big_little path into select_energy_cpu_brute() EAS: sched/fair: Re-integrate 'honor sync wakeups' into wakeup path Fixup!: sched/fair.c: Set SchedTune specific struct energy_env.task sched/fair: Energy-aware wake-up task placement sched/fair: Add energy_diff dead-zone margin sched/fair: Decommission energy_aware_wake_cpu() sched/fair: Do not force want_affine eq. true if EAS is enabled arm64: Set SD_ASYM_CPUCAPACITY sched_domain flag on DIE level UPSTREAM: sched/fair: Fix incorrect comment for capacity_margin UPSTREAM: sched/fair: Avoid pulling tasks from non-overloaded higher capacity groups UPSTREAM: sched/fair: Add per-CPU min capacity to sched_group_capacity UPSTREAM: sched/fair: Consider spare capacity in find_idlest_group() UPSTREAM: sched/fair: Compute task/cpu utilization at wake-up correctly UPSTREAM: sched/fair: Let asymmetric CPU configurations balance at wake-up UPSTREAM: sched/core: Enable SD_BALANCE_WAKE for asymmetric capacity systems UPSTREAM: sched/core: Pass child domain into sd_init() UPSTREAM: sched/core: Introduce SD_ASYM_CPUCAPACITY sched_domain topology flag UPSTREAM: sched/core: Remove unnecessary NULL-pointer check UPSTREAM: sched/fair: Optimize find_idlest_cpu() when there is no choice BACKPORT: sched/fair: Make the use of prev_cpu consistent in the wakeup path UPSTREAM: sched/core: Fix power to capacity renaming in comment Partial Revert: "WIP: sched: Add cpu capacity awareness to wakeup balancing" Revert "WIP: sched: Consider spare cpu capacity at task wake-up" FROM-LIST: cpufreq: schedutil: Redefine the rate_limit_us tunable cpufreq: schedutil: add up/down frequency transition rate limits trace/sched: add rq utilization signal for WALT sched/cpufreq: make schedutil use WALT signal sched: cpufreq: use rt_avg as estimate of required RT CPU capacity cpufreq: schedutil: move slow path from workqueue to SCHED_FIFO task BACKPORT: kthread: allow to cancel kthread work sched/cpufreq: fix tunables for schedfreq governor BACKPORT: cpufreq: schedutil: New governor based on scheduler utilization data sched: backport cpufreq hooks from 4.9-rc4 ANDROID: Kconfig: add depends for UID_SYS_STATS ANDROID: hid: uhid: implement refcount for open and close Revert "ext4: require encryption feature for EXT4_IOC_SET_ENCRYPTION_POLICY" ANDROID: mnt: Fix next_descendent Conflicts: include/trace/events/sched.h kernel/sched/Makefile kernel/sched/core.c kernel/sched/fair.c kernel/sched/sched.h Change-Id: I55318828f2c858e192ac7015bcf2bf0ec5c5b2c5 Signed-off-by: Blagovest Kolenichev <bkolenichev@codeaurora.org>
2017-06-14Merge 4.4.72 into android-4.4Greg Kroah-Hartman
Changes in 4.4.72 bnx2x: Fix Multi-Cos ipv6: xfrm: Handle errors reported by xfrm6_find_1stfragopt() cxgb4: avoid enabling napi twice to the same queue tcp: disallow cwnd undo when switching congestion control vxlan: fix use-after-free on deletion ipv6: Fix leak in ipv6_gso_segment(). net: ping: do not abuse udp_poll() net: ethoc: enable NAPI before poll may be scheduled net: bridge: start hello timer only if device is up sparc64: mm: fix copy_tsb to correctly copy huge page TSBs sparc: Machine description indices can vary sparc64: reset mm cpumask after wrap sparc64: combine activate_mm and switch_mm sparc64: redefine first version sparc64: add per-cpu mm of secondary contexts sparc64: new context wrap sparc64: delete old wrap code arch/sparc: support NR_CPUS = 4096 serial: ifx6x60: fix use-after-free on module unload ptrace: Properly initialize ptracer_cred on fork KEYS: fix dereferencing NULL payload with nonzero length KEYS: fix freeing uninitialized memory in key_update() crypto: gcm - wait for crypto op not signal safe drm/amdgpu/ci: disable mclk switching for high refresh rates (v2) nfsd4: fix null dereference on replay nfsd: Fix up the "supattr_exclcreat" attributes kvm: async_pf: fix rcu_irq_enter() with irqs enabled KVM: cpuid: Fix read/write out-of-bounds vulnerability in cpuid emulation arm: KVM: Allow unaligned accesses at HYP KVM: async_pf: avoid async pf injection when in guest mode dmaengine: usb-dmac: Fix DMAOR AE bit definition dmaengine: ep93xx: Always start from BASE0 xen/privcmd: Support correctly 64KB page granularity when mapping memory xen-netfront: do not cast grant table reference to signed short xen-netfront: cast grant table reference first to type int ext4: fix SEEK_HOLE ext4: keep existing extra fields when inode expands ext4: fix fdatasync(2) after extent manipulation operations usb: gadget: f_mass_storage: Serialize wake and sleep execution usb: chipidea: udc: fix NULL pointer dereference if udc_start failed usb: chipidea: debug: check before accessing ci_role staging/lustre/lov: remove set_fs() call from lov_getstripe() iio: light: ltr501 Fix interchanged als/ps register field iio: proximity: as3935: fix AS3935_INT mask drivers: char: random: add get_random_long() random: properly align get_random_int_hash stackprotector: Increase the per-task stack canary's random range from 32 bits to 64 bits on 64-bit platforms cpufreq: cpufreq_register_driver() should return -ENODEV if init fails target: Re-add check to reject control WRITEs with overflow data drm/msm: Expose our reservation object when exporting a dmabuf. Input: elantech - add Fujitsu Lifebook E546/E557 to force crc_enabled cpuset: consider dying css as offline fs: add i_blocksize() ufs: restore proper tail allocation fix ufs_isblockset() ufs: restore maintaining ->i_blocks ufs: set correct ->s_maxsize ufs_extend_tail(): fix the braino in calling conventions of ufs_new_fragments() ufs_getfrag_block(): we only grab ->truncate_mutex on block creation path cxl: Fix error path on bad ioctl btrfs: use correct types for page indices in btrfs_page_exists_in_range btrfs: fix memory leak in update_space_info failure path KVM: arm/arm64: Handle possible NULL stage2 pud when ageing pages scsi: qla2xxx: don't disable a not previously enabled PCI device powerpc/eeh: Avoid use after free in eeh_handle_special_event() powerpc/numa: Fix percpu allocations to be NUMA aware powerpc/hotplug-mem: Fix missing endian conversion of aa_index perf/core: Drop kernel samples even though :u is specified drm/vmwgfx: Handle vmalloc() failure in vmw_local_fifo_reserve() drm/vmwgfx: limit the number of mip levels in vmw_gb_surface_define_ioctl() drm/vmwgfx: Make sure backup_handle is always valid drm/nouveau/tmr: fully separate alarm execution/pending lists ALSA: timer: Fix race between read and ioctl ALSA: timer: Fix missing queue indices reset at SNDRV_TIMER_IOCTL_SELECT ASoC: Fix use-after-free at card unregistration drivers: char: mem: Fix wraparound check to allow mappings up to the end tty: Drop krefs for interrupted tty lock serial: sh-sci: Fix panic when serial console and DMA are enabled net: better skb->sender_cpu and skb->napi_id cohabitation mm: consider memblock reservations for deferred memory initialization sizing NFS: Ensure we revalidate attributes before using execute_ok() NFSv4: Don't perform cached access checks before we've OPENed the file Make __xfs_xattr_put_listen preperly report errors. arm64: hw_breakpoint: fix watchpoint matching for tagged pointers arm64: entry: improve data abort handling of tagged pointers RDMA/qib,hfi1: Fix MR reference count leak on write with immediate usercopy: Adjust tests to deal with SMAP/PAN arm64: armv8_deprecated: ensure extension of addr arm64: ensure extension of smp_store_release value Linux 4.4.72 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2017-06-14perf/core: Drop kernel samples even though :u is specifiedJin Yao
commit cc1582c231ea041fbc68861dfaf957eaf902b829 upstream. When doing sampling, for example: perf record -e cycles:u ... On workloads that do a lot of kernel entry/exits we see kernel samples, even though :u is specified. This is due to skid existing. This might be a security issue because it can leak kernel addresses even though kernel sampling support is disabled. The patch drops the kernel samples if exclude_kernel is specified. For example, test on Haswell desktop: perf record -e cycles:u <mgen> perf report --stdio Before patch applied: 99.77% mgen mgen [.] buf_read 0.20% mgen mgen [.] rand_buf_init 0.01% mgen [kernel.vmlinux] [k] apic_timer_interrupt 0.00% mgen mgen [.] last_free_elem 0.00% mgen libc-2.23.so [.] __random_r 0.00% mgen libc-2.23.so [.] _int_malloc 0.00% mgen mgen [.] rand_array_init 0.00% mgen [kernel.vmlinux] [k] page_fault 0.00% mgen libc-2.23.so [.] __random 0.00% mgen libc-2.23.so [.] __strcasestr 0.00% mgen ld-2.23.so [.] strcmp 0.00% mgen ld-2.23.so [.] _dl_start 0.00% mgen libc-2.23.so [.] sched_setaffinity@@GLIBC_2.3.4 0.00% mgen ld-2.23.so [.] _start We can see kernel symbols apic_timer_interrupt and page_fault. After patch applied: 99.79% mgen mgen [.] buf_read 0.19% mgen mgen [.] rand_buf_init 0.00% mgen libc-2.23.so [.] __random_r 0.00% mgen mgen [.] rand_array_init 0.00% mgen mgen [.] last_free_elem 0.00% mgen libc-2.23.so [.] vfprintf 0.00% mgen libc-2.23.so [.] rand 0.00% mgen libc-2.23.so [.] __random 0.00% mgen libc-2.23.so [.] _int_malloc 0.00% mgen libc-2.23.so [.] _IO_doallocbuf 0.00% mgen ld-2.23.so [.] do_lookup_x 0.00% mgen ld-2.23.so [.] open_verify.constprop.7 0.00% mgen ld-2.23.so [.] _dl_important_hwcaps 0.00% mgen libc-2.23.so [.] sched_setaffinity@@GLIBC_2.3.4 0.00% mgen ld-2.23.so [.] _start There are only userspace symbols. Signed-off-by: Jin Yao <yao.jin@linux.intel.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Vince Weaver <vincent.weaver@maine.edu> Cc: acme@kernel.org Cc: jolsa@kernel.org Cc: kan.liang@intel.com Cc: mark.rutland@arm.com Cc: will.deacon@arm.com Cc: yao.jin@intel.com Link: http://lkml.kernel.org/r/1495706947-3744-1-git-send-email-yao.jin@linux.intel.com Signed-off-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-14cpuset: consider dying css as offlineTejun Heo
commit 41c25707d21716826e3c1f60967f5550610ec1c9 upstream. In most cases, a cgroup controller don't care about the liftimes of cgroups. For the controller, a css becomes online when ->css_online() is called on it and offline when ->css_offline() is called. However, cpuset is special in that the user interface it exposes cares whether certain cgroups exist or not. Combined with the RCU delay between cgroup removal and css offlining, this can lead to user visible behavior oddities where operations which should succeed after cgroup removals fail for some time period. The effects of cgroup removals are delayed when seen from userland. This patch adds css_is_dying() which tests whether offline is pending and updates is_cpuset_online() so that the function returns false also while offline is pending. This gets rid of the userland visible delays. Signed-off-by: Tejun Heo <tj@kernel.org> Reported-by: Daniel Jordan <daniel.m.jordan@oracle.com> Link: http://lkml.kernel.org/r/327ca1f5-7957-fbb9-9e5f-9ba149d40ba2@oracle.com Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-14stackprotector: Increase the per-task stack canary's random range from 32 ↵Daniel Micay
bits to 64 bits on 64-bit platforms commit 5ea30e4e58040cfd6434c2f33dc3ea76e2c15b05 upstream. The stack canary is an 'unsigned long' and should be fully initialized to random data rather than only 32 bits of random data. Signed-off-by: Daniel Micay <danielmicay@gmail.com> Acked-by: Arjan van de Ven <arjan@linux.intel.com> Acked-by: Rik van Riel <riel@redhat.com> Acked-by: Kees Cook <keescook@chromium.org> Cc: Arjan van Ven <arjan@linux.intel.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: kernel-hardening@lists.openwall.com Cc: stable@vger.kernel.org Link: http://lkml.kernel.org/r/20170504133209.3053-1-danielmicay@gmail.com Signed-off-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-14ptrace: Properly initialize ptracer_cred on forkEric W. Biederman
commit c70d9d809fdeecedb96972457ee45c49a232d97f upstream. When I introduced ptracer_cred I failed to consider the weirdness of fork where the task_struct copies the old value by default. This winds up leaving ptracer_cred set even when a process forks and the child process does not wind up being ptraced. Because ptracer_cred is not set on non-ptraced processes whose parents were ptraced this has broken the ability of the enlightenment window manager to start setuid children. Fix this by properly initializing ptracer_cred in ptrace_init_task This must be done with a little bit of care to preserve the current value of ptracer_cred when ptrace carries through fork. Re-reading the ptracer_cred from the ptracing process at this point is inconsistent with how PT_PTRACE_CAP has been maintained all of these years. Tested-by: Takashi Iwai <tiwai@suse.de> Fixes: 64b875f7ac8a ("ptrace: Capture the ptracer's creds not PT_PTRACE_CAP") Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-09Merge "sched: Fix the bug in select_best_cpu() that returns -1 as target_cpu"Linux Build Service Account
2017-06-09sched: avoid migrating when softint on tgt cpu should be shortJohn Dias
The scheduling change (bug 31501544) to avoid putting RT threads on cores that are handling softint's was catching cases where there was no reason to believe the softint would take a long time, resulting in unnecessary migration overhead. This patch reduces the migration to cases where the core has a softint that is actually likely to take a long time, as opposed to the RCU, SCHED, and TIMER softints that are rather quick. Bug: 31752786 Change-Id: Ib4e179f1e15c736b2fdba31070494e357e9fbbe2 Git-commit: ce05770bd37b8065b61ef650108ecef2b97b148b Git-repo: https://android.googlesource.com/kernel/msm [pkondeti@codeaurora.org: resolved minor merge conflicts] Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
2017-06-09sched: avoid scheduling RT threads on cores currently handling softirqsJohn Dias
Bug: 31501544 Change-Id: I99dd7aaa12c11270b28dbabea484bcc8fb8ba0c1 Git-commit: 080ea011fd9f47315e1fc53185872ef813b59d00 Git-repo: https://android.googlesource.com/kernel/msm [pkondeti@codeaurora.org: resolved minor merge conflicts and fixed checkpatch warnings] Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
2017-06-08Merge "Merge branch 'android-4.4@9bc4622' into branch 'msm-4.4'"Linux Build Service Account
2017-06-09sched: Fix the bug in select_best_cpu() that returns -1 as target_cpuPavankumar Kondeti
select_best_cpu() has previous CPU's cluster bias which overrides the best_cpu with best_sibling_cpu when the power cost is same. When the power table is configured incorrectly or static_cpu_pwr_cost/ static_cluster_pwr_cost tunables are set to a large value, the power_cost() for all candidate CPUs can return INT_MAX. So the stats.min_cost is never changed from it's initial value i.e INT_MAX. In the above scenario, we find stats.best_cpu >= 0 && stats.min_cost = stats.best_sibling_cpu_cost = INT_MAX && stats.best_sibling_cpu_cost = -1 and replace best_cpu with best_sibling_cpu i.e -1. Change-Id: I09829e278e41daaaff959428ff50927aba29104c Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>
2017-06-07Merge "drivers: Warning fixes to disable CC_OPTIMIZE_FOR_SIZE"Linux Build Service Account
2017-06-07Merge branch 'android-4.4@9bc4622' into branch 'msm-4.4'Blagovest Kolenichev
* refs/heads/tmp-9bc4622: Linux 4.4.70 drivers: char: mem: Check for address space wraparound with mmap() nfsd: encoders mustn't use unitialized values in error cases drm/edid: Add 10 bpc quirk for LGD 764 panel in HP zBook 17 G2 PCI: Freeze PME scan before suspending devices PCI: Fix pci_mmap_fits() for HAVE_PCI_RESOURCE_TO_USER platforms tracing/kprobes: Enforce kprobes teardown after testing osf_wait4(): fix infoleak genirq: Fix chained interrupt data ordering uwb: fix device quirk on big-endian hosts metag/uaccess: Check access_ok in strncpy_from_user metag/uaccess: Fix access_ok() iommu/vt-d: Flush the IOTLB to get rid of the initial kdump mappings staging: rtl8192e: rtl92e_get_eeprom_size Fix read size of EPROM_CMD. staging: rtl8192e: fix 2 byte alignment of register BSSIDR. mm/huge_memory.c: respect FOLL_FORCE/FOLL_COW for thp xc2028: Fix use-after-free bug properly arm64: documentation: document tagged pointer stack constraints arm64: uaccess: ensure extension of access_ok() addr arm64: xchg: hazard against entire exchange variable ARM: dts: at91: sama5d3_xplained: not all ADC channels are available ARM: dts: at91: sama5d3_xplained: fix ADC vref powerpc/64e: Fix hang when debugging programs with relocated kernel powerpc/pseries: Fix of_node_put() underflow during DLPAR remove powerpc/book3s/mce: Move add_taint() later in virtual mode cx231xx-cards: fix NULL-deref at probe cx231xx-audio: fix NULL-deref at probe cx231xx-audio: fix init error path dvb-frontends/cxd2841er: define symbol_rate_min/max in T/C fe-ops zr364xx: enforce minimum size when reading header dib0700: fix NULL-deref at probe s5p-mfc: Fix unbalanced call to clock management gspca: konica: add missing endpoint sanity check ceph: fix recursion between ceph_set_acl() and __ceph_setattr() iio: proximity: as3935: fix as3935_write ipx: call ipxitf_put() in ioctl error path USB: hub: fix non-SS hub-descriptor handling USB: hub: fix SS hub-descriptor handling USB: serial: io_ti: fix div-by-zero in set_termios USB: serial: mct_u232: fix big-endian baud-rate handling USB: serial: qcserial: add more Lenovo EM74xx device IDs usb: serial: option: add Telit ME910 support USB: iowarrior: fix info ioctl on big-endian hosts usb: musb: tusb6010_omap: Do not reset the other direction's packet size ttusb2: limit messages to buffer size mceusb: fix NULL-deref at probe usbvision: fix NULL-deref at probe net: irda: irda-usb: fix firmware name on big-endian hosts usb: host: xhci-mem: allocate zeroed Scratchpad Buffer xhci: apply PME_STUCK_QUIRK and MISSING_CAS quirk for Denverton usb: host: xhci-plat: propagate return value of platform_get_irq() sched/fair: Initialize throttle_count for new task-groups lazily sched/fair: Do not announce throttled next buddy in dequeue_task_fair() fscrypt: avoid collisions when presenting long encrypted filenames f2fs: check entire encrypted bigname when finding a dentry fscrypt: fix context consistency check when key(s) unavailable net: qmi_wwan: Add SIMCom 7230E ext4 crypto: fix some error handling ext4 crypto: don't let data integrity writebacks fail with ENOMEM USB: serial: ftdi_sio: add Olimex ARM-USB-TINY(H) PIDs USB: serial: ftdi_sio: fix setting latency for unprivileged users pid_ns: Fix race between setns'ed fork() and zap_pid_ns_processes() pid_ns: Sleep in TASK_INTERRUPTIBLE in zap_pid_ns_processes iio: dac: ad7303: fix channel description of: fix sparse warning in of_pci_range_parser_one proc: Fix unbalanced hard link numbers cdc-acm: fix possible invalid access when processing notification drm/nouveau/tmr: handle races with hw when updating the next alarm time drm/nouveau/tmr: avoid processing completed alarms when adding a new one drm/nouveau/tmr: fix corruption of the pending list when rescheduling an alarm drm/nouveau/tmr: ack interrupt before processing alarms drm/nouveau/therm: remove ineffective workarounds for alarm bugs drm/amdgpu: Make display watermark calculations more accurate drm/amdgpu: Avoid overflows/divide-by-zero in latency_watermark calculations. ath9k_htc: fix NULL-deref at probe ath9k_htc: Add support of AirTies 1eda:2315 AR9271 device s390/cputime: fix incorrect system time s390/kdump: Add final note regulator: tps65023: Fix inverted core enable logic. KVM: X86: Fix read out-of-bounds vulnerability in kvm pio emulation KVM: x86: Fix load damaged SSEx MXCSR register ima: accept previously set IMA_NEW_FILE mwifiex: pcie: fix cmd_buf use-after-free in remove/reset rtlwifi: rtl8821ae: setup 8812ae RFE according to device type md: update slab_cache before releasing new stripes when stripes resizing dm space map disk: fix some book keeping in the disk space map dm thin metadata: call precommit before saving the roots dm bufio: make the parameter "retain_bytes" unsigned long dm cache metadata: fail operations if fail_io mode has been established dm bufio: check new buffer allocation watermark every 30 seconds dm bufio: avoid a possible ABBA deadlock dm raid: select the Kconfig option CONFIG_MD_RAID0 dm btree: fix for dm_btree_find_lowest_key() infiniband: call ipv6 route lookup via the stub interface tpm_crb: check for bad response size ARM: tegra: paz00: Mark panel regulator as enabled on boot USB: core: replace %p with %pK char: lp: fix possible integer overflow in lp_setup() watchdog: pcwd_usb: fix NULL-deref at probe USB: ene_usb6250: fix DMA to the stack usb: misc: legousbtower: Fix memory leak usb: misc: legousbtower: Fix buffers on stack ANDROID: uid_sys_stats: defer io stats calulation for dead tasks ANDROID: AVB: Fix linter errors. ANDROID: AVB: Fix invalidate_vbmeta_submit(). ANDROID: sdcardfs: Check for NULL in revalidate Linux 4.4.69 ipmi: Fix kernel panic at ipmi_ssif_thread() wlcore: Add RX_BA_WIN_SIZE_CHANGE_EVENT event wlcore: Pass win_size taken from ieee80211_sta to FW mac80211: RX BA support for sta max_rx_aggregation_subframes mac80211: pass block ack session timeout to to driver mac80211: pass RX aggregation window size to driver Bluetooth: hci_intel: add missing tty-device sanity check Bluetooth: hci_bcm: add missing tty-device sanity check Bluetooth: Fix user channel for 32bit userspace on 64bit kernel tty: pty: Fix ldisc flush after userspace become aware of the data already serial: omap: suspend device on probe errors serial: omap: fix runtime-pm handling on unbind serial: samsung: Use right device for DMA-mapping calls arm64: KVM: Fix decoding of Rt/Rt2 when trapping AArch32 CP accesses padata: free correct variable CIFS: add misssing SFM mapping for doublequote cifs: fix CIFS_IOC_GET_MNT_INFO oops CIFS: fix mapping of SFM_SPACE and SFM_PERIOD SMB3: Work around mount failure when using SMB3 dialect to Macs Set unicode flag on cifs echo request to avoid Mac error fs/block_dev: always invalidate cleancache in invalidate_bdev() ceph: fix memory leak in __ceph_setxattr() fs/xattr.c: zero out memory copied to userspace in getxattr ext4: evict inline data when writing to memory map IB/mlx4: Reduce SRIOV multicast cleanup warning message to debug level IB/mlx4: Fix ib device initialization error flow IB/IPoIB: ibX: failed to create mcg debug file IB/core: Fix sysfs registration error flow vfio/type1: Remove locked page accounting workqueue dm era: save spacemap metadata root after the pre-commit crypto: algif_aead - Require setkey before accept(2) block: fix blk_integrity_register to use template's interval_exp if not 0 KVM: arm/arm64: fix races in kvm_psci_vcpu_on KVM: x86: fix user triggerable warning in kvm_apic_accept_events() um: Fix PTRACE_POKEUSER on x86_64 x86, pmem: Fix cache flushing for iovec write < 8 bytes selftests/x86/ldt_gdt_32: Work around a glibc sigaction() bug x86/boot: Fix BSS corruption/overwrite bug in early x86 kernel startup usb: hub: Do not attempt to autosuspend disconnected devices usb: hub: Fix error loop seen after hub communication errors usb: Make sure usb/phy/of gets built-in usb: misc: add missing continue in switch staging: comedi: jr3_pci: cope with jiffies wraparound staging: comedi: jr3_pci: fix possible null pointer dereference staging: gdm724x: gdm_mux: fix use-after-free on module unload staging: vt6656: use off stack for out buffer USB transfers. staging: vt6656: use off stack for in buffer USB transfers. USB: Proper handling of Race Condition when two USB class drivers try to call init_usb_class simultaneously USB: serial: ftdi_sio: add device ID for Microsemi/Arrow SF2PLUS Dev Kit usb: host: xhci: print correct command ring address iscsi-target: Set session_fall_back_to_erl0 when forcing reinstatement target: Convert ACL change queue_depth se_session reference usage target/fileio: Fix zero-length READ and WRITE handling target: Fix compare_and_write_callback handling for non GOOD status xen: adjust early dom0 p2m handling to xen hypervisor behavior ANDROID: AVB: Only invalidate vbmeta when told to do so. ANDROID: sdcardfs: Move top to its own struct ANDROID: lowmemorykiller: account for unevictable pages ANDROID: usb: gadget: fix NULL pointer issue in mtp_read() ANDROID: usb: f_mtp: return error code if transfer error in receive_file_work function Signed-off-by: Blagovest Kolenichev <bkolenichev@codeaurora.org> Conflicts: drivers/usb/gadget/function/f_mtp.c fs/ext4/page-io.c net/mac80211/agg-rx.c Change-Id: Id65e75bf3bcee4114eb5d00730a9ef2444ad58eb Signed-off-by: Blagovest Kolenichev <bkolenichev@codeaurora.org>
2017-06-06Merge "hrtimer: Don't drop the base lock when migration during isolation"Linux Build Service Account
2017-06-06Merge "sched: hmp: Optimize cycle counter reads"Linux Build Service Account
2017-06-06Merge "sched: Don't active migrate tasks to CPUs in the same cluster"Linux Build Service Account
2017-06-06Merge "sched: Fix load tracking bug to avoid adding phantom task demand"Linux Build Service Account
2017-06-03schedstats/eas: guard properly to avoid breaking non-smp schedstats usersChris Redpath
Add appropriate #ifdef guards to ensure the smp-only easstats structs are not used when smp is not enabled. Arnd got a report from buildbot, analysed it, and pointed out exactly what the issue was. Reported-by: "Arnd Bergmann" <arnd@arndb.de> Suggested-by: "Arnd Bergmann" <arnd@arndb.de> Fixes: 4b85765a3dd9 ("sched/fair: Add eas (& cas) specific rq, sd and task stats") Signed-off-by: Chris Redpath <chris.redpath@arm.com> Change-Id: I60554dea20137f6774db3f59b4afd40a06554cfc
2017-06-02sched/tune: don't use schedtune before it is readyChris Redpath
When EAS is enabled during boot, we have to be careful not to use schedtune from fair.c before it is ready or it will warn us and we'll get a traceback in the console. Change-Id: I1a5cf29b18af626545c636c51219f9ed497c19fa Signed-off-by: Chris Redpath <chris.redpath@arm.com>
2017-06-02sched/fair: use SCHED_CAPACITY_SCALE for energy normalizationPatrick Bellasi
Change-Id: I686d26975f4a7dd830ff8441ff986e35461a7d55 Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com> Signed-off-by: Srinath Sridharan <srinathsr@google.com>