Skip to content
  1. Jan 22, 2020
  2. Jan 21, 2020
    • Masami Ichikawa's avatar
      tracing: Do not set trace clock if tracefs lockdown is in effect · bf24daac
      Masami Ichikawa authored
      When trace_clock option is not set and unstable clcok detected,
      tracing_set_default_clock() sets trace_clock(ThinkPad A285 is one of
      case). In that case, if lockdown is in effect, null pointer
      dereference error happens in ring_buffer_set_clock().
      
      Link: http://lkml.kernel.org/r/20200116131236.3866925-1-masami256@gmail.com
      
      Cc: stable@vger.kernel.org
      Fixes: 17911ff3 ("tracing: Add locked_down checks to the open calls of files created for tracefs")
      Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1788488
      
      
      Signed-off-by: default avatarMasami Ichikawa <masami256@gmail.com>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      bf24daac
    • Steven Rostedt (VMware)'s avatar
      tracing: Fix histogram code when expression has same var as value · 8bcebc77
      Steven Rostedt (VMware) authored
      While working on a tool to convert SQL syntex into the histogram language of
      the kernel, I discovered the following bug:
      
       # echo 'first u64 start_time u64 end_time pid_t pid u64 delta' >> synthetic_events
       # echo 'hist:keys=pid:start=common_timestamp' > events/sched/sched_waking/trigger
       # echo 'hist:keys=next_pid:delta=common_timestamp-$start,start2=$start:onmatch(sched.sched_waking).trace(first,$start2,common_timestamp,next_pid,$delta)' > events/sched/sched_switch/trigger
      
      Would not display any histograms in the sched_switch histogram side.
      
      But if I were to swap the location of
      
        "delta=common_timestamp-$start" with "start2=$start"
      
      Such that the last line had:
      
       # echo 'hist:keys=next_pid:start2=$start,delta=common_timestamp-$start:onmatch(sched.sched_waking).trace(first,$start2,common_timestamp,next_pid,$delta)' > events/sched/sched_switch/trigger
      
      The histogram works as expected.
      
      What I found out is that the expressions clear out the value once it is
      resolved. As the variables are resolved in the order listed, when
      processing:
      
        delta=common_timestamp-$start
      
      The $start is cleared. When it gets to "start2=$start", it errors out with
      "unresolved symbol" (which is silent as this happens at the location of the
      trace), and the histogram is dropped.
      
      When processing the histogram for variable references, instead of adding a
      new reference for a variable used twice, use the same reference. That way,
      not only is it more efficient, but the order will no longer matter in
      processing of the variables.
      
      From Tom Zanussi:
      
       "Just to clarify some more about what the problem was is that without
        your patch, we would have two separate references to the same variable,
        and during resolve_var_refs(), they'd both want to be resolved
        separately, so in this case, since the first reference to start wasn't
        part of an expression, it wouldn't get the read-once flag set, so would
        be read normally, and then the second reference would do the read-once
        read and also be read but using read-once.  So everything worked and
        you didn't see a problem:
      
         from: start2=$start,delta=common_timestamp-$start
      
        In the second case, when you switched them around, the first reference
        would be resolved by doing the read-once, and following that the second
        reference would try to resolve and see that the variable had already
        been read, so failed as unset, which caused it to short-circuit out and
        not do the trigger action to generate the synthetic event:
      
         to: delta=common_timestamp-$start,start2=$start
      
        With your patch, we only have the single resolution which happens
        correctly the one time it's resolved, so this can't happen."
      
      Link: https://lore.kernel.org/r/20200116154216.58ca08eb@gandalf.local.home
      
      Cc: stable@vger.kernel.org
      Fixes: 067fe038
      
       ("tracing: Add variable reference handling to hist triggers")
      Reviewed-by: default avatarTom Zanuss <zanussi@kernel.org>
      Tested-by: default avatarTom Zanussi <zanussi@kernel.org>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      8bcebc77
  3. Jan 15, 2020
    • Masami Hiramatsu's avatar
      tracing: trigger: Replace unneeded RCU-list traversals · aeed8aa3
      Masami Hiramatsu authored
      With CONFIG_PROVE_RCU_LIST, I had many suspicious RCU warnings
      when I ran ftracetest trigger testcases.
      
      -----
        # dmesg -c > /dev/null
        # ./ftracetest test.d/trigger
        ...
        # dmesg | grep "RCU-list traversed" | cut -f 2 -d ] | cut -f 2 -d " "
        kernel/trace/trace_events_hist.c:6070
        kernel/trace/trace_events_hist.c:1760
        kernel/trace/trace_events_hist.c:5911
        kernel/trace/trace_events_trigger.c:504
        kernel/trace/trace_events_hist.c:1810
        kernel/trace/trace_events_hist.c:3158
        kernel/trace/trace_events_hist.c:3105
        kernel/trace/trace_events_hist.c:5518
        kernel/trace/trace_events_hist.c:5998
        kernel/trace/trace_events_hist.c:6019
        kernel/trace/trace_events_hist.c:6044
        kernel/trace/trace_events_trigger.c:1500
        kernel/trace/trace_events_trigger.c:1540
        kernel/trace/trace_events_trigger.c:539
        kernel/trace/trace_events_trigger.c:584
      -----
      
      I investigated those warnings and found that the RCU-list
      traversals in event trigger and hist didn't need to use
      RCU version because those were called only under event_mutex.
      
      I also checked other RCU-list traversals related to event
      trigger list, and found that most of them were called from
      event_hist_trigger_func() or hist_unregister_trigger() or
      register/unregister functions except for a few cases.
      
      Replace these unneeded RCU-list traversals with normal list
      traversal macro and lockdep_assert_held() to check the
      event_mutex is held.
      
      Link: http://lkml.kernel.org/r/157680910305.11685.15110237954275915782.stgit@devnote2
      
      Cc: stable@vger.kernel.org
      Fixes: 30350d65
      
       ("tracing: Add variable support to hist triggers")
      Reviewed-by: default avatarTom Zanussi <zanussi@kernel.org>
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      aeed8aa3
    • Masami Hiramatsu's avatar
      tracing/uprobe: Fix double perf_event linking on multiprobe uprobe · 99c9a923
      Masami Hiramatsu authored
      Fix double perf_event linking to trace_uprobe_filter on
      multiple uprobe event by moving trace_uprobe_filter under
      trace_probe_event.
      
      In uprobe perf event, trace_uprobe_filter data structure is
      managing target mm filters (in perf_event) related to each
      uprobe event.
      
      Since commit 60d53e2c ("tracing/probe: Split trace_event
      related data from trace_probe") left the trace_uprobe_filter
      data structure in trace_uprobe, if a trace_probe_event has
      multiple trace_uprobe (multi-probe event), a perf_event is
      added to different trace_uprobe_filter on each trace_uprobe.
      This leads a linked list corruption.
      
      To fix this issue, move trace_uprobe_filter to trace_probe_event
      and link it once on each event instead of each probe.
      
      Link: http://lkml.kernel.org/r/157862073931.1800.3800576241181489174.stgit@devnote2
      
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: "Naveen N . Rao" <naveen.n.rao@linux.ibm.com>
      Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
      Cc: "David S . Miller" <davem@davemloft.net>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: =?utf-8?q?Toke_H=C3=B8iland-J?= =?utf-8?b?w7hyZ2Vuc2Vu?= <thoiland@redhat.com>
      Cc: Jean-Tsung Hsiao <jhsiao@redhat.com>
      Cc: Jesper Dangaard Brouer <brouer@redhat.com>
      Cc: stable@vger.kernel.org
      Fixes: 60d53e2c ("tracing/probe: Split trace_event related data from trace_probe")
      Link: https://lkml.kernel.org/r/20200108171611.GA8472@kernel.org
      
      
      Reported-by: default avatarArnaldo Carvalho de Melo <acme@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@kernel.org>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      99c9a923
    • Changbin Du's avatar
      tracing: xen: Ordered comparison of function pointers · d0695e23
      Changbin Du authored
      Just as commit 0566e40c ("tracing: initcall: Ordered comparison of
      function pointers"), this patch fixes another remaining one in xen.h
      found by clang-9.
      
      In file included from arch/x86/xen/trace.c:21:
      In file included from ./include/trace/events/xen.h:475:
      In file included from ./include/trace/define_trace.h:102:
      In file included from ./include/trace/trace_events.h:473:
      ./include/trace/events/xen.h:69:7: warning: ordered comparison of function \
      pointers ('xen_mc_callback_fn_t' (aka 'void (*)(void *)') and 'xen_mc_callback_fn_t') [-Wordered-compare-function-pointers]
                          __field(xen_mc_callback_fn_t, fn)
                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      ./include/trace/trace_events.h:421:29: note: expanded from macro '__field'
                                      ^
      ./include/trace/trace_events.h:407:6: note: expanded from macro '__field_ext'
                                       is_signed_type(type), filter_type);    \
                                       ^
      ./include/linux/trace_events.h:554:44: note: expanded from macro 'is_signed_type'
                                                    ^
      
      Fixes: c796f213
      
       ("xen/trace: add multicall tracing")
      Signed-off-by: default avatarChangbin Du <changbin.du@gmail.com>
      Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
      d0695e23
  4. Jan 13, 2020
  5. Jan 12, 2020
    • Linus Torvalds's avatar
      Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux · 6327edce
      Linus Torvalds authored
      Pull i2c fixes from Wolfram Sang:
       "Two driver bugfixes, a documentation fix, and a removal of a spec
        violation for the bus recovery algorithm in the core"
      
      * 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
        i2c: fix bus recovery stop mode timing
        i2c: bcm2835: Store pointer to bus clock
        dt-bindings: i2c: at91: fix i2c-sda-hold-time-ns documentation for sam9x60
        i2c: at91: fix clk_offset for sam9x60
      6327edce
    • Linus Torvalds's avatar
      Merge tag 'clone3-tls-v5.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux · 606e9ad2
      Linus Torvalds authored
      Pull thread fixes from Christian Brauner:
       "This contains a series of patches to fix CLONE_SETTLS when used with
        clone3().
      
        The clone3() syscall passes the tls argument through struct clone_args
        instead of a register. This means, all architectures that do not
        implement copy_thread_tls() but still support CLONE_SETTLS via
        copy_thread() expecting the tls to be located in a register argument
        based on clone() are currently unfortunately broken. Their tls value
        will be garbage.
      
        The patch series fixes this on all architectures that currently define
        __ARCH_WANT_SYS_CLONE3. It also adds a compile-time check to ensure
        that any architecture that enables clone3() in the future is forced to
        also implement copy_thread_tls().
      
        My ultimate goal is to get rid of the copy_thread()/copy_thread_tls()
        split and just have copy_thread_tls() at some point in the not too
        distant future (Maybe even renaming copy_thread_tls() back to simply
        copy_thread() once the old function is ripped from all arches). This
        is dependent now on all arches supporting clone3().
      
        While all relevant arches do that now there are still four missing:
        ia64, m68k, sh and sparc. They have the system call reserved, but not
        implemented. Once they all implement clone3() we can get rid of
        ARCH_WANT_SYS_CLONE3 and HAVE_COPY_THREAD_TLS.
      
        This series also includes a minor fix for the arm64 uapi headers which
        caused __NR_clone3 to be missing from the exported user headers.
      
        Unfortunately the series came in a little late especially given that
        it touches a range of architectures. Due to the holidays not all arch
        maintainers responded in time probably due to their backlog. Will and
        Arnd have thankfully acked the arm specific changes.
      
        Given that the changes are straightforward and rather minimal combined
        with the fact the that clone3() with CLONE_SETTLS is broken I decided
        to send them post rc3 nonetheless"
      
      * tag 'clone3-tls-v5.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner/linux:
        um: Implement copy_thread_tls
        clone3: ensure copy_thread_tls is implemented
        xtensa: Implement copy_thread_tls
        riscv: Implement copy_thread_tls
        parisc: Implement copy_thread_tls
        arm: Implement copy_thread_tls
        arm64: Implement copy_thread_tls
        arm64: Move __ARCH_WANT_SYS_CLONE3 definition to uapi headers
      606e9ad2
  6. Jan 11, 2020
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid · ac61145a
      Linus Torvalds authored
      Pull HID fix from Jiri Kosina:
       "A regression fix for EPOLLOUT handling in hidraw and uhid"
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid:
        HID: hidraw, uhid: Always report EPOLLOUT
      ac61145a
    • Linus Torvalds's avatar
      Merge tag 'usb-5.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · 213356fe
      Linus Torvalds authored
      Pull USB/PHY fixes from Greg KH:
       "Here are a number of USB and PHY driver fixes for 5.5-rc6
      
        Nothing all that unusual, just the a bunch of small fixes for a lot of
        different reported issues. The PHY driver fixes are in here as they
        interacted with the usb drivers.
      
        Full details of the patches are in the shortlog, and all of these have
        been in linux-next with no reported issues"
      
      * tag 'usb-5.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (24 commits)
        usb: missing parentheses in USE_NEW_SCHEME
        usb: ohci-da8xx: ensure error return on variable error is set
        usb: musb: Disable pullup at init
        usb: musb: fix idling for suspend after disconnect interrupt
        usb: typec: ucsi: Fix the notification bit offsets
        USB: Fix: Don't skip endpoint descriptors with maxpacket=0
        USB-PD tcpm: bad warning+size, PPS adapters
        phy/rockchip: inno-hdmi: round clock rate down to closest 1000 Hz
        usb: chipidea: host: Disable port power only if previously enabled
        usb: cdns3: should not use the same dev_id for shared interrupt handler
        usb: dwc3: gadget: Fix request complete check
        usb: musb: dma: Correct parameter passed to IRQ handler
        usb: musb: jz4740: Silence error if code is -EPROBE_DEFER
        usb: udc: tegra: select USB_ROLE_SWITCH
        USB: core: fix check for duplicate endpoints
        phy: cpcap-usb: Drop extra write to usb2 register
        phy: cpcap-usb: Improve host vs docked mode detection
        phy: cpcap-usb: Prevent USB line glitches from waking up modem
        phy: mapphone-mdm6600: Fix uninitialized status value regression
        phy: cpcap-usb: Fix flakey host idling and enumerating of devices
        ...
      213356fe
    • Linus Torvalds's avatar
      Merge tag 'char-misc-5.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc · 9fb7007d
      Linus Torvalds authored
      Pull char/misc fix from Greg KH:
       "Here is a single fix, for the chrdev core, for 5.5-rc6
      
        There's been a long-standing race condition triggered by syzbot, and
        occasionally real people, in the chrdev open() path. Will finally took
        the time to track it down and fix it for real before the holidays.
      
        Here's that one patch, it's been in linux-next for a while with no
        reported issues and it does fix the reported problem"
      
      * tag 'char-misc-5.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
        chardev: Avoid potential use-after-free in 'chrdev_open()'
      9fb7007d
    • Linus Torvalds's avatar
      Merge tag 'staging-5.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging · 7da37cd0
      Linus Torvalds authored
      Pull staging fixes from Greg KH:
       "Here are some small staging driver fixes for 5.5-rc6.
      
        Nothing major here, just some small fixes for a comedi driver, the
        vt6656 driver, and a new device id for the rtl8188eu driver.
      
        All of these have been in linux-next for a while with no reported
        issues"
      
      * tag 'staging-5.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
        staging: rtl8188eu: Add device code for TP-Link TL-WN727N v5.21
        staging: comedi: adv_pci1710: fix AI channels 16-31 for PCI-1713
        staging: vt6656: set usb_set_intfdata on driver fail.
        staging: vt6656: remove bool from vnt_radio_power_on ret
        staging: vt6656: limit reg output to block size
        staging: vt6656: correct return of vnt_init_registers.
        staging: vt6656: Fix non zero logical return of, usb_control_msg
      7da37cd0
    • Linus Torvalds's avatar
      Merge tag 'tty-5.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty · 5a96c0bb
      Linus Torvalds authored
      Pull tty/serial fixes from Greg KH:
       "Here are two tty/serial driver fixes for 5.5-rc6.
      
        The first fixes a much much reported issue with a previous tty port
        link patch that is in your tree, and the second fixes a problem where
        the serdev driver would claim ACPI devices that it shouldn't be
        claiming.
      
        Both have been in linux-next for a while with no reported issues"
      
      * tag 'tty-5.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
        serdev: Don't claim unsupported ACPI serial devices
        tty: always relink the port
      5a96c0bb
    • Linus Torvalds's avatar
      Merge tag 'block-5.5-2020-01-10' of git://git.kernel.dk/linux-block · 4e4cd21c
      Linus Torvalds authored
      Pull block fixes from Jens Axboe:
       "A few fixes that should go into this round.
      
        This pull request contains two NVMe fixes via Keith, removal of a dead
        function, and a fix for the bio op for read truncates (Ming)"
      
      * tag 'block-5.5-2020-01-10' of git://git.kernel.dk/linux-block:
        nvmet: fix per feat data len for get_feature
        nvme: Translate more status codes to blk_status_t
        fs: move guard_bio_eod() after bio_set_op_attrs
        block: remove unused mp_bvec_last_segment
      4e4cd21c
    • Linus Torvalds's avatar
      Merge tag 'io_uring-5.5-2020-01-10' of git://git.kernel.dk/linux-block · 30b6487d
      Linus Torvalds authored
      Pull io_uring fix from Jens Axboe:
       "Single fix for this series, fixing a regression with the short read
        handling.
      
        This just removes it, as it cannot safely be done for all cases"
      
      * tag 'io_uring-5.5-2020-01-10' of git://git.kernel.dk/linux-block:
        io_uring: remove punt of short reads to async context
      30b6487d
    • Linus Torvalds's avatar
      Merge tag 'mtd/fixes-for-5.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux · 4936ce17
      Linus Torvalds authored
      Pull MTD fixes from Miquel Raynal:
       "MTD:
         - sm_ftl: Fix NULL pointer warning.
      
        Raw NAND:
         - Cadence: fix compile testing.
         - STM32: Avoid locking.
      
        Onenand:
         - Fix several sparse/build warnings.
      
        SPI-NOR:
         - Add a flag to fix interaction with Micron parts"
      
      * tag 'mtd/fixes-for-5.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux:
        mtd: spi-nor: Fix the writing of the Status Register on micron flashes
        mtd: sm_ftl: fix NULL pointer warning
        mtd: onenand: omap2: Pass correct flags for prep_dma_memcpy
        mtd: onenand: samsung: Fix iomem access with regular memcpy
        mtd: onenand: omap2: Fix errors in style
        mtd: cadence: Fix cast to pointer from integer of different size warning
        mtd: rawnand: stm32_fmc2: avoid to lock the CPU bus
      4936ce17
    • Linus Torvalds's avatar
      Merge tag 'sound-5.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · b1d198c0
      Linus Torvalds authored
      Pull sound fixes from Takashi Iwai:
       "A few piled ASoC fixes and usual HD-audio and USB-audio fixups. Some
        of them are for ASoC core error-handling"
      
      * tag 'sound-5.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
        ALSA: hda: enable regmap internal locking
        ALSA: hda/realtek - Add quirk for the bass speaker on Lenovo Yoga X1 7th gen
        ALSA: hda/realtek - Set EAPD control to default for ALC222
        ALSA: usb-audio: Apply the sample rate quirk for Bose Companion 5
        ALSA: hda/realtek - Add new codec supported for ALCS1200A
        ASoC: Intel: boards: Fix compile-testing RT1011/RT5682
        ASoC: SOF: imx8: Fix dsp_box offset
        ASoC: topology: Prevent use-after-free in snd_soc_get_pcm_runtime()
        ASoC: fsl_audmix: add missed pm_runtime_disable
        ASoC: stm32: spdifrx: fix input pin state management
        ASoC: stm32: spdifrx: fix race condition in irq handler
        ASoC: stm32: spdifrx: fix inconsistent lock state
        ASoC: core: Fix access to uninitialized list heads
        ASoC: soc-core: Set dpcm_playback / dpcm_capture
        ASoC: SOF: imx8: fix memory allocation failure check on priv->pd_dev
        ASoC: SOF: Intel: hda: hda-dai: fix oops on hda_link .hw_free
        ASoC: SOF: fix fault at driver unload after failed probe
      b1d198c0
    • Linus Torvalds's avatar
      Merge tag 'thermal-v5.5-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux · 658e1af5
      Linus Torvalds authored
      Pull thermal fix from Daniel Lezcano:
       "Fix backward compatibility with old DTBs on QCOM tsens (Amit
        Kucheria)"
      
      * tag 'thermal-v5.5-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux:
        drivers: thermal: tsens: Work with old DTBs
      658e1af5
    • Linus Torvalds's avatar
      Merge tag 'pm-5.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · c23e744b
      Linus Torvalds authored
      Pull power management fixes from Rafael Wysocki:
       "Prevent the cpufreq-dt driver from probing Tegra20/30 (Dmitry
        Osipenko) and prevent the Intel RAPL power capping driver from
        crashing during CPU initialization due to a NULL pointer dereference
        if the processor model in use is not known to it (Harry Pan)"
      
      * tag 'pm-5.5-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        powercap: intel_rapl: add NULL pointer check to rapl_mmio_cpu_online()
        cpufreq: dt-platdev: Blacklist NVIDIA Tegra20 and Tegra30 SoCs
      c23e744b
  7. Jan 10, 2020