15 Apr, 2015

2 commits

  • Pull tracing updates from Steven Rostedt:
    "Some clean ups and small fixes, but the biggest change is the addition
    of the TRACE_DEFINE_ENUM() macro that can be used by tracepoints.

    Tracepoints have helper functions for the TP_printk() called
    __print_symbolic() and __print_flags() that lets a numeric number be
    displayed as a a human comprehensible text. What is placed in the
    TP_printk() is also shown in the tracepoint format file such that user
    space tools like perf and trace-cmd can parse the binary data and
    express the values too. Unfortunately, the way the TRACE_EVENT()
    macro works, anything placed in the TP_printk() will be shown pretty
    much exactly as is. The problem arises when enums are used. That's
    because unlike macros, enums will not be changed into their values by
    the C pre-processor. Thus, the enum string is exported to the format
    file, and this makes it useless for user space tools.

    The TRACE_DEFINE_ENUM() solves this by converting the enum strings in
    the TP_printk() format into their number, and that is what is shown to
    user space. For example, the tracepoint tlb_flush currently has this
    in its format file:

    __print_symbolic(REC->reason,
    { TLB_FLUSH_ON_TASK_SWITCH, "flush on task switch" },
    { TLB_REMOTE_SHOOTDOWN, "remote shootdown" },
    { TLB_LOCAL_SHOOTDOWN, "local shootdown" },
    { TLB_LOCAL_MM_SHOOTDOWN, "local mm shootdown" })

    After adding:

    TRACE_DEFINE_ENUM(TLB_FLUSH_ON_TASK_SWITCH);
    TRACE_DEFINE_ENUM(TLB_REMOTE_SHOOTDOWN);
    TRACE_DEFINE_ENUM(TLB_LOCAL_SHOOTDOWN);
    TRACE_DEFINE_ENUM(TLB_LOCAL_MM_SHOOTDOWN);

    Its format file will contain this:

    __print_symbolic(REC->reason,
    { 0, "flush on task switch" },
    { 1, "remote shootdown" },
    { 2, "local shootdown" },
    { 3, "local mm shootdown" })"

    * tag 'trace-v4.1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: (27 commits)
    tracing: Add enum_map file to show enums that have been mapped
    writeback: Export enums used by tracepoint to user space
    v4l: Export enums used by tracepoints to user space
    SUNRPC: Export enums in tracepoints to user space
    mm: tracing: Export enums in tracepoints to user space
    irq/tracing: Export enums in tracepoints to user space
    f2fs: Export the enums in the tracepoints to userspace
    net/9p/tracing: Export enums in tracepoints to userspace
    x86/tlb/trace: Export enums in used by tlb_flush tracepoint
    tracing/samples: Update the trace-event-sample.h with TRACE_DEFINE_ENUM()
    tracing: Allow for modules to convert their enums to values
    tracing: Add TRACE_DEFINE_ENUM() macro to map enums to their values
    tracing: Update trace-event-sample with TRACE_SYSTEM_VAR documentation
    tracing: Give system name a pointer
    brcmsmac: Move each system tracepoints to their own header
    iwlwifi: Move each system tracepoints to their own header
    mac80211: Move message tracepoints to their own header
    tracing: Add TRACE_SYSTEM_VAR to xhci-hcd
    tracing: Add TRACE_SYSTEM_VAR to kvm-s390
    tracing: Add TRACE_SYSTEM_VAR to intel-sst
    ...

    Linus Torvalds
     
  • Pull HID updates from Jiri Kosina:

    - quite a few firmware fixes for RMI driver by Andrew Duggan

    - huion and uclogic drivers have been substantially overlaping in
    functionality laterly. This redundancy is fixed by hid-huion driver
    being merged into hid-uclogic; work done by Benjamin Tissoires and
    Nikolai Kondrashov

    - i2c-hid now supports ACPI GPIO interrupts; patch from Mika Westerberg

    - Some of the quirks, that got separated into individual drivers, have
    historically had EXPERT dependency. As HID subsystem matured (as
    well as the individual drivers), this made less and less sense. This
    dependency is now being removed by patch from Jean Delvare

    - Logitech lg4ff driver received a couple of improvements for mode
    switching, by Michal Malý

    - multitouch driver now supports clickpads, patches by Benjamin
    Tissoires and Seth Forshee

    - hid-sensor framework received a substantial update; namely support
    for Custom and Generic pages is being added; work done by Srinivas
    Pandruvada

    - wacom driver received substantial update; it now supports
    i2c-conntected devices (Mika Westerberg), Bamboo PADs are now
    properly supported (Benjamin Tissoires), much improved battery
    reporting (Jason Gerecke) and pen proximity cleanups (Ping Cheng)

    - small assorted fixes and device ID additions

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: (68 commits)
    HID: sensor: Update document for custom sensor
    HID: sensor: Custom and Generic sensor support
    HID: debug: fix error handling in hid_debug_events_read()
    Input - mt: Fix input_mt_get_slot_by_key
    HID: logitech-hidpp: fix error return code
    HID: wacom: Add support for Cintiq 13HD Touch
    HID: logitech-hidpp: add a module parameter to keep firmware gestures
    HID: usbhid: yet another mouse with ALWAYS_POLL
    HID: usbhid: more mice with ALWAYS_POLL
    HID: wacom: set stylus_in_proximity before checking touch_down
    HID: wacom: use wacom_wac_finger_count_touches to set touch_down
    HID: wacom: remove hardcoded WACOM_QUIRK_MULTI_INPUT
    HID: pidff: effect can't be NULL
    HID: add quirk for PIXART OEM mouse used by HP
    HID: add HP OEM mouse to quirk ALWAYS_POLL
    HID: wacom: ask for a in-prox report when it was missed
    HID: hid-sensor-hub: Fix sparse warning
    HID: hid-sensor-hub: fix attribute read for logical usage id
    HID: plantronics: fix Kconfig default
    HID: pidff: support more than one concurrent effect
    ...

    Linus Torvalds
     

14 Apr, 2015

1 commit


08 Apr, 2015

2 commits

  • Document the use of TRACE_DEFINE_ENUM() by adding enums to the
    trace-event-sample.h and using this macro to convert them in the format
    files.

    Also update the comments and sho the use of __print_symbolic() and
    __print_flags() as well as adding comments abount __print_array().

    Link: http://lkml.kernel.org/r/20150403013802.220157513@goodmis.org

    Reviewed-by: Masami Hiramatsu
    Tested-by: Masami Hiramatsu
    Signed-off-by: Steven Rostedt

    Steven Rostedt (Red Hat)
     
  • Add documentation about TRACE_SYSTEM needing to be alpha-numeric or with
    underscores, and that if it is not, then the use of TRACE_SYSTEM_VAR is
    required to make something that is.

    An example of this is shown in samples/trace_events/trace-events-sample.h

    Link: http://lkml.kernel.org/r/20150403013802.220157513@goodmis.org

    Reviewed-by: Masami Hiramatsu
    Tested-by: Masami Hiramatsu
    Signed-off-by: Steven Rostedt

    Steven Rostedt (Red Hat)
     

25 Mar, 2015

2 commits


15 Mar, 2015

1 commit


18 Feb, 2015

1 commit

  • Fixes a potential corruption with uninitialized stack memory in the
    seccomp BPF sample program.

    [akpm@linux-foundation.org: coding-style fixlet]
    Signed-off-by: Kees Cook
    Reported-by: Robert Swiecki
    Tested-by: Robert Swiecki
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kees Cook
     

13 Feb, 2015

1 commit

  • Pull tracing updates from Steven Rostedt:
    "The updates included in this pull request for ftrace are:

    o Several clean ups to the code

    One such clean up was to convert to 64 bit time keeping, in the
    ring buffer benchmark code.

    o Adding of __print_array() helper macro for TRACE_EVENT()

    o Updating the sample/trace_events/ to add samples of different ways
    to make trace events. Lots of features have been added since the
    sample code was made, and these features are mostly unknown.
    Developers have been making their own hacks to do things that are
    already available.

    o Performance improvements. Most notably, I found a performance bug
    where a waiter that is waiting for a full page from the ring buffer
    will see that a full page is not available, and go to sleep. The
    sched event caused by it going to sleep would cause it to wake up
    again. It would see that there was still not a full page, and go
    back to sleep again, and that would wake it up again, until finally
    it would see a full page. This change has been marked for stable.

    Other improvements include removing global locks from fast paths"

    * tag 'trace-v3.20' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
    ring-buffer: Do not wake up a splice waiter when page is not full
    tracing: Fix unmapping loop in tracing_mark_write
    tracing: Add samples of DECLARE_EVENT_CLASS() and DEFINE_EVENT()
    tracing: Add TRACE_EVENT_FN example
    tracing: Add TRACE_EVENT_CONDITION sample
    tracing: Update the TRACE_EVENT fields available in the sample code
    tracing: Separate out initializing top level dir from instances
    tracing: Make tracing_init_dentry_tr() static
    trace: Use 64-bit timekeeping
    tracing: Add array printing helper
    tracing: Remove newline from trace_printk warning banner
    tracing: Use IS_ERR() check for return value of tracing_init_dentry()
    tracing: Remove unneeded includes of debugfs.h and fs.h
    tracing: Remove taking of trace_types_lock in pipe files
    tracing: Add ref count to tracer for when they are being read by pipe

    Linus Torvalds
     

11 Feb, 2015

1 commit

  • Pull live patching infrastructure from Jiri Kosina:
    "Let me provide a bit of history first, before describing what is in
    this pile.

    Originally, there was kSplice as a standalone project that implemented
    stop_machine()-based patching for the linux kernel. This project got
    later acquired, and the current owner is providing live patching as a
    proprietary service, without any intentions to have their
    implementation merged.

    Then, due to rising user/customer demand, both Red Hat and SUSE
    started working on their own implementation (not knowing about each
    other), and announced first versions roughly at the same time [1] [2].

    The principle difference between the two solutions is how they are
    making sure that the patching is performed in a consistent way when it
    comes to different execution threads with respect to the semantic
    nature of the change that is being introduced.

    In a nutshell, kPatch is issuing stop_machine(), then looking at
    stacks of all existing processess, and if it decides that the system
    is in a state that can be patched safely, it proceeds insterting code
    redirection machinery to the patched functions.

    On the other hand, kGraft provides a per-thread consistency during one
    single pass of a process through the kernel and performs a lazy
    contignuous migration of threads from "unpatched" universe to the
    "patched" one at safe checkpoints.

    If interested in a more detailed discussion about the consistency
    models and its possible combinations, please see the thread that
    evolved around [3].

    It pretty quickly became obvious to the interested parties that it's
    absolutely impractical in this case to have several isolated solutions
    for one task to co-exist in the kernel. During a dedicated Live
    Kernel Patching track at LPC in Dusseldorf, all the interested parties
    sat together and came up with a joint aproach that would work for both
    distro vendors. Steven Rostedt took notes [4] from this meeting.

    And the foundation for that aproach is what's present in this pull
    request.

    It provides a basic infrastructure for function "live patching" (i.e.
    code redirection), including API for kernel modules containing the
    actual patches, and API/ABI for userspace to be able to operate on the
    patches (look up what patches are applied, enable/disable them, etc).

    It's relatively simple and minimalistic, as it's making use of
    existing kernel infrastructure (namely ftrace) as much as possible.
    It's also self-contained, in a sense that it doesn't hook itself in
    any other kernel subsystem (it doesn't even touch any other code).
    It's now implemented for x86 only as a reference architecture, but
    support for powerpc, s390 and arm is already in the works (adding
    arch-specific support basically boils down to teaching ftrace about
    regs-saving).

    Once this common infrastructure gets merged, both Red Hat and SUSE
    have agreed to immediately start porting their current solutions on
    top of this, abandoning their out-of-tree code. The plan basically is
    that each patch will be marked by flag(s) that would indicate which
    consistency model it is willing to use (again, the details have been
    sketched out already in the thread at [3]).

    Before this happens, the current codebase can be used to patch a large
    group of secruity/stability problems the patches for which are not too
    complex (in a sense that they don't introduce non-trivial change of
    function's return value semantics, they don't change layout of data
    structures, etc) -- this corresponds to LEAVE_FUNCTION &&
    SWITCH_FUNCTION semantics described at [3].

    This tree has been in linux-next since December.

    [1] https://lkml.org/lkml/2014/4/30/477
    [2] https://lkml.org/lkml/2014/7/14/857
    [3] https://lkml.org/lkml/2014/11/7/354
    [4] http://linuxplumbersconf.org/2014/wp-content/uploads/2014/10/LPC2014_LivePatching.txt

    [ The core code is introduced by the three commits authored by Seth
    Jennings, which got a lot of changes incorporated during numerous
    respins and reviews of the initial implementation. All the followup
    commits have materialized only after public tree has been created,
    so they were not folded into initial three commits so that the
    public tree doesn't get rebased ]"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/livepatching:
    livepatch: add missing newline to error message
    livepatch: rename config to CONFIG_LIVEPATCH
    livepatch: fix uninitialized return value
    livepatch: support for repatching a function
    livepatch: enforce patch stacking semantics
    livepatch: change ARCH_HAVE_LIVE_PATCHING to HAVE_LIVE_PATCHING
    livepatch: fix deferred module patching order
    livepatch: handle ancient compilers with more grace
    livepatch: kconfig: use bool instead of boolean
    livepatch: samples: fix usage example comments
    livepatch: MAINTAINERS: add git tree location
    livepatch: use FTRACE_OPS_FL_IPMODIFY
    livepatch: move x86 specific ftrace handler code to arch/x86
    livepatch: samples: add sample live patching module
    livepatch: kernel: add support for live patching
    livepatch: kernel: add TAINT_LIVEPATCH

    Linus Torvalds
     

10 Feb, 2015

4 commits


04 Feb, 2015

1 commit


27 Jan, 2015

1 commit

  • hash map is unordered, so get_next_key() iterator shouldn't
    rely on particular order of elements. So relax this test.

    Fixes: ffb65f27a155 ("bpf: add a testsuite for eBPF maps")
    Reported-by: Michael Holzheu
    Signed-off-by: Alexei Starovoitov
    Acked-by: Daniel Borkmann
    Signed-off-by: David S. Miller

    Alexei Starovoitov
     

24 Dec, 2014

1 commit


22 Dec, 2014

1 commit


06 Dec, 2014

4 commits

  • sockex2_kern.c is purposefully large eBPF program in C.
    llvm compiles ~200 lines of C code into ~300 eBPF instructions.

    It's similar to __skb_flow_dissect() to demonstrate that complex packet parsing
    can be done by eBPF.
    Then it uses (struct flow_keys)->dst IP address (or hash of ipv6 dst) to keep
    stats of number of packets per IP.
    User space loads eBPF program, attaches it to loopback interface and prints
    dest_ip->#packets stats every second.

    Usage:
    $sudo samples/bpf/sockex2
    ip 127.0.0.1 count 19
    ip 127.0.0.1 count 178115
    ip 127.0.0.1 count 369437
    ip 127.0.0.1 count 559841
    ip 127.0.0.1 count 750539

    Signed-off-by: Alexei Starovoitov
    Signed-off-by: David S. Miller

    Alexei Starovoitov
     
  • this example does the same task as previous socket example
    in assembler, but this one does it in C.

    eBPF program in kernel does:
    /* assume that packet is IPv4, load one byte of IP->proto */
    int index = load_byte(skb, ETH_HLEN + offsetof(struct iphdr, protocol));
    long *value;

    value = bpf_map_lookup_elem(&my_map, &index);
    if (value)
    __sync_fetch_and_add(value, 1);

    Corresponding user space reads map[tcp], map[udp], map[icmp]
    and prints protocol stats every second

    Signed-off-by: Alexei Starovoitov
    Signed-off-by: David S. Miller

    Alexei Starovoitov
     
  • simple .o parser and loader using BPF syscall.
    .o is a standard ELF generated by LLVM backend

    It parses elf file compiled by llvm .c->.o
    - parses 'maps' section and creates maps via BPF syscall
    - parses 'license' section and passes it to syscall
    - parses elf relocations for BPF maps and adjusts BPF_LD_IMM64 insns
    by storing map_fd into insn->imm and marking such insns as BPF_PSEUDO_MAP_FD
    - loads eBPF programs via BPF syscall

    One ELF file can contain multiple BPF programs.

    int load_bpf_file(char *path);
    populates prog_fd[] and map_fd[] with FDs received from bpf syscall

    bpf_helpers.h - helper functions available to eBPF programs written in C

    Signed-off-by: Alexei Starovoitov
    Signed-off-by: David S. Miller

    Alexei Starovoitov
     
  • this socket filter example does:
    - creates arraymap in kernel with key 4 bytes and value 8 bytes

    - loads eBPF program which assumes that packet is IPv4 and loads one byte of
    IP->proto from the packet and uses it as a key in a map

    r0 = skb->data[ETH_HLEN + offsetof(struct iphdr, protocol)];
    *(u32*)(fp - 4) = r0;
    value = bpf_map_lookup_elem(map_fd, fp - 4);
    if (value)
    (*(u64*)value) += 1;

    - attaches this program to raw socket

    - every second user space reads map[IPPROTO_TCP], map[IPPROTO_UDP], map[IPPROTO_ICMP]
    to see how many packets of given protocol were seen on loopback interface

    Usage:
    $sudo samples/bpf/sock_example
    TCP 0 UDP 0 ICMP 0 packets
    TCP 187600 UDP 0 ICMP 4 packets
    TCP 376504 UDP 0 ICMP 8 packets
    TCP 563116 UDP 0 ICMP 12 packets
    TCP 753144 UDP 0 ICMP 16 packets

    Signed-off-by: Alexei Starovoitov
    Signed-off-by: David S. Miller

    Alexei Starovoitov
     

19 Nov, 2014

2 commits


31 Oct, 2014

1 commit

  • - add a test specifically targeting verifier state pruning.
    It checks state propagation between registers, storing that
    state into stack and state pruning algorithm recognizing
    equivalent stack and register states.

    - add summary line to spot failures easier

    Signed-off-by: Alexei Starovoitov
    Signed-off-by: David S. Miller

    Alexei Starovoitov
     

22 Oct, 2014

1 commit

  • while comparing for verifier state equivalency the comparison
    was missing a check for uninitialized register.
    Make sure it does so and add a testcase.

    Fixes: f1bca824dabb ("bpf: add search pruning optimization to verifier")
    Cc: Hannes Frederic Sowa
    Signed-off-by: Alexei Starovoitov
    Acked-by: Hannes Frederic Sowa
    Signed-off-by: David S. Miller

    Alexei Starovoitov
     

09 Oct, 2014

1 commit

  • Pull networking updates from David Miller:
    "Most notable changes in here:

    1) By far the biggest accomplishment, thanks to a large range of
    contributors, is the addition of multi-send for transmit. This is
    the result of discussions back in Chicago, and the hard work of
    several individuals.

    Now, when the ->ndo_start_xmit() method of a driver sees
    skb->xmit_more as true, it can choose to defer the doorbell
    telling the driver to start processing the new TX queue entires.

    skb->xmit_more means that the generic networking is guaranteed to
    call the driver immediately with another SKB to send.

    There is logic added to the qdisc layer to dequeue multiple
    packets at a time, and the handling mis-predicted offloads in
    software is now done with no locks held.

    Finally, pktgen is extended to have a "burst" parameter that can
    be used to test a multi-send implementation.

    Several drivers have xmit_more support: i40e, igb, ixgbe, mlx4,
    virtio_net

    Adding support is almost trivial, so export more drivers to
    support this optimization soon.

    I want to thank, in no particular or implied order, Jesper
    Dangaard Brouer, Eric Dumazet, Alexander Duyck, Tom Herbert, Jamal
    Hadi Salim, John Fastabend, Florian Westphal, Daniel Borkmann,
    David Tat, Hannes Frederic Sowa, and Rusty Russell.

    2) PTP and timestamping support in bnx2x, from Michal Kalderon.

    3) Allow adjusting the rx_copybreak threshold for a driver via
    ethtool, and add rx_copybreak support to enic driver. From
    Govindarajulu Varadarajan.

    4) Significant enhancements to the generic PHY layer and the bcm7xxx
    driver in particular (EEE support, auto power down, etc.) from
    Florian Fainelli.

    5) Allow raw buffers to be used for flow dissection, allowing drivers
    to determine the optimal "linear pull" size for devices that DMA
    into pools of pages. The objective is to get exactly the
    necessary amount of headers into the linear SKB area pre-pulled,
    but no more. The new interface drivers use is eth_get_headlen().
    From WANG Cong, with driver conversions (several had their own
    by-hand duplicated implementations) by Alexander Duyck and Eric
    Dumazet.

    6) Support checksumming more smoothly and efficiently for
    encapsulations, and add "foo over UDP" facility. From Tom
    Herbert.

    7) Add Broadcom SF2 switch driver to DSA layer, from Florian
    Fainelli.

    8) eBPF now can load programs via a system call and has an extensive
    testsuite. Alexei Starovoitov and Daniel Borkmann.

    9) Major overhaul of the packet scheduler to use RCU in several major
    areas such as the classifiers and rate estimators. From John
    Fastabend.

    10) Add driver for Intel FM10000 Ethernet Switch, from Alexander
    Duyck.

    11) Rearrange TCP_SKB_CB() to reduce cache line misses, from Eric
    Dumazet.

    12) Add Datacenter TCP congestion control algorithm support, From
    Florian Westphal.

    13) Reorganize sk_buff so that __copy_skb_header() is significantly
    faster. From Eric Dumazet"

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1558 commits)
    netlabel: directly return netlbl_unlabel_genl_init()
    net: add netdev_txq_bql_{enqueue, complete}_prefetchw() helpers
    net: description of dma_cookie cause make xmldocs warning
    cxgb4: clean up a type issue
    cxgb4: potential shift wrapping bug
    i40e: skb->xmit_more support
    net: fs_enet: Add NAPI TX
    net: fs_enet: Remove non NAPI RX
    r8169:add support for RTL8168EP
    net_sched: copy exts->type in tcf_exts_change()
    wimax: convert printk to pr_foo()
    af_unix: remove 0 assignment on static
    ipv6: Do not warn for informational ICMP messages, regardless of type.
    Update Intel Ethernet Driver maintainers list
    bridge: Save frag_max_size between PRE_ROUTING and POST_ROUTING
    tipc: fix bug in multicast congestion handling
    net: better IFF_XMIT_DST_RELEASE support
    net/mlx4_en: remove NETDEV_TX_BUSY
    3c59x: fix bad split of cpu_to_le32(pci_map_single())
    net: bcmgenet: fix Tx ring priority programming
    ...

    Linus Torvalds
     

02 Oct, 2014

1 commit


27 Sep, 2014

1 commit

  • 1.
    the library includes a trivial set of BPF syscall wrappers:
    int bpf_create_map(int key_size, int value_size, int max_entries);
    int bpf_update_elem(int fd, void *key, void *value);
    int bpf_lookup_elem(int fd, void *key, void *value);
    int bpf_delete_elem(int fd, void *key);
    int bpf_get_next_key(int fd, void *key, void *next_key);
    int bpf_prog_load(enum bpf_prog_type prog_type,
    const struct sock_filter_int *insns, int insn_len,
    const char *license);
    bpf_prog_load() stores verifier log into global bpf_log_buf[] array

    and BPF_*() macros to build instructions

    2.
    test stubs configure eBPF infra with 'unspec' map and program types.
    These are fake types used by user space testsuite only.

    3.
    verifier tests valid and invalid programs and expects predefined
    error log messages from kernel.
    40 tests so far.

    $ sudo ./test_verifier
    #0 add+sub+mul OK
    #1 unreachable OK
    #2 unreachable2 OK
    #3 out of range jump OK
    #4 out of range jump2 OK
    #5 test1 ld_imm64 OK
    ...

    Signed-off-by: Alexei Starovoitov
    Signed-off-by: David S. Miller

    Alexei Starovoitov
     

26 Sep, 2014

1 commit

  • In commit e80d666 "flagday: kill pt_regs argument of do_fork()", the
    arguments to do_fork() changed.

    The example code in jprobe_example.c was not updated to match, so the
    arguments inside the jprobe handler do not match reality.

    Fix it by updating the arguments to match do_fork(). While we're at it
    use pr_info() for brevity, and print stack_start as well for interest.

    Signed-off-by: Michael Ellerman
    Acked-by: Masami Hiramatsu
    Signed-off-by: Jiri Kosina

    Michael Ellerman
     

01 Jul, 2014

1 commit

  • Strings should be copied with strlcpy instead of strncpy when they will
    later be printed via %s. This guarantees that they terminate with a
    NUL '\0' character and do not run pass the end of the allocated string.

    This is only for sample code, but it should stil represent a good
    role model.

    Link: http://lkml.kernel.org/p/51C2E204.1080501@huawei.com

    Signed-off-by: Zhao Hongjiang
    Signed-off-by: Steven Rostedt

    Zhao Hongjiang
     

21 Jun, 2014

1 commit

  • Currently the __field() macro in TRACE_EVENT is only good for primitive
    values, such as integers and pointers, but it fails on complex data types
    such as structures or unions. This is because the __field() macro
    determines if the variable is signed or not with the test of:

    (((type)(-1)) < (type)1)

    Unfortunately, that fails when type is a structure.

    Since trace events should support structures as fields a new macro
    is created for such a case called __field_struct() which acts exactly
    the same as __field() does but it does not do the signed type check
    and just uses a constant false for that answer.

    Cc: Tony Luck
    Signed-off-by: Steven Rostedt

    Steven Rostedt
     

14 May, 2014

1 commit


04 Apr, 2014

1 commit

  • The Makefile is designed to use the host toolchain so it may be unsafe
    to build the tests if the kernel has been configured and built for
    another architecture. This fixes a build problem when the kernel has
    been configured and built for the MIPS architecture but the host is not
    MIPS (cross-compiled). The MIPS syscalls are only defined if one of the
    following is true:

    1) _MIPS_SIM == _MIPS_SIM_ABI64
    2) _MIPS_SIM == _MIPS_SIM_ABI32
    3) _MIPS_SIM == _MIPS_SIM_NABI32

    Of course, none of these make sense on a non-MIPS toolchain and the
    following build problem occurs when building on a non-MIPS host.

    linux/usr/include/linux/kexec.h:50: userspace cannot reference function or variable defined in the kernel
    samples/seccomp/bpf-direct.c: In function `emulator':
    samples/seccomp/bpf-direct.c:76:17: error: `__NR_write' undeclared (first use in this function)

    Signed-off-by: Markos Chandras
    Reported-by: Paul Gortmaker
    Cc: Ralf Baechle
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Markos Chandras
     

04 Dec, 2013

1 commit


15 Nov, 2013

1 commit

  • This patch enhances the type safety for the kfifo API. It is now safe
    to put const data into a non const FIFO and the API will now generate a
    compiler warning when reading from the fifo where the destination
    address is pointing to a const variable.

    As a side effect the kfifo_put() does now expect the value of an element
    instead a pointer to the element. This was suggested Russell King. It
    make the handling of the kfifo_put easier since there is no need to
    create a helper variable for getting the address of a pointer or to pass
    integers of different sizes.

    IMHO the API break is okay, since there are currently only six users of
    kfifo_put().

    The code is also cleaner by kicking out the "if (0)" expressions.

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: Stefani Seibold
    Cc: Russell King
    Cc: Hauke Mehrtens
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Stefani Seibold
     

07 Sep, 2013

1 commit

  • Pull Tile arch updates from Chris Metcalf:
    "These changes bring in a bunch of new functionality that has been
    maintained internally at Tilera over the last year, plus other stray
    bits of work that I've taken into the tile tree from other folks.

    The changes include some PCI root complex work, interrupt-driven
    console support, support for performing fast-path unaligned data
    fixups by kernel-based JIT code generation, CONFIG_PREEMPT support,
    vDSO support for gettimeofday(), a serial driver for the tilegx
    on-chip UART, KGDB support, more optimized string routines, support
    for ftrace and kprobes, improved ASLR, and many bug fixes.

    We also remove support for the old TILE64 chip, which is no longer
    buildable"

    * git://git.kernel.org/pub/scm/linux/kernel/git/cmetcalf/linux-tile: (85 commits)
    tile: refresh tile defconfig files
    tile: rework
    tile PCI RC: make default consistent DMA mask 32-bit
    tile: add null check for kzalloc in tile/kernel/setup.c
    tile: make __write_once a synonym for __read_mostly
    tile: remove support for TILE64
    tile: use asm-generic/bitops/builtin-*.h
    tile: eliminate no-op "noatomichash" boot argument
    tile: use standard tile_bundle_bits type in traps.c
    tile: simplify code referencing hypervisor API addresses
    tile: change to in comments
    tile: mark pcibios_init() as __init
    tile: check for correct compiler earlier in asm-offsets.c
    tile: use standard 'generic-y' model for
    tile: use asm-generic version of
    tile PCI RC: add comment about "PCI hole" problem
    tile: remove DEBUG_EXTRA_FLAGS kernel config option
    tile: add virt_to_kpte() API and clean up and document behavior
    tile: support FRAME_POINTER
    tile: support reporting Tilera hypervisor statistics
    ...

    Linus Torvalds
     

06 Sep, 2013

1 commit


04 Sep, 2013

1 commit

  • This extends the uhid example client. It properly documents the built-in
    report-descriptor an adds explicit report-numbers.

    Furthermore, LED output reports are added to utilize the new UHID output
    reports of the kernel. Support for 3 basic LEDs is added and a small
    report-parser to print debug messages if output reports were received.

    To test this, simply write the EV_LED+LED_CAPSL+1 event to the evdev
    device-node of the uhid-device and the kernel will forward it to your uhid
    client.

    Signed-off-by: David Herrmann
    Signed-off-by: Jiri Kosina

    David Herrmann