1. 18 Apr, 2017 1 commit
  2. 22 Oct, 2014 1 commit
  3. 02 Oct, 2014 1 commit
  4. 26 Sep, 2014 2 commits
    • Alexei Starovoitov's avatar
      bpf: mini eBPF library, test stubs and verifier testsuite · 3c731eba
      Alexei Starovoitov authored
      
      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: default avatarAlexei Starovoitov <ast@plumgrid.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3c731eba
    • Michael Ellerman's avatar
      kprobes: update jprobe_example.c for do_fork() change · e8ac6ea8
      Michael Ellerman authored
      In commit e80d6661
      
       "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: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Acked-by: default avatarMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      e8ac6ea8
  5. 01 Jul, 2014 1 commit
  6. 21 Jun, 2014 1 commit
    • Steven Rostedt's avatar
      tracing: Add __field_struct macro for TRACE_EVENT() · 4d4c9cc8
      Steven Rostedt authored
      
      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 <tony.luck@gmail.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      4d4c9cc8
  7. 14 May, 2014 1 commit
  8. 03 Apr, 2014 1 commit
    • Markos Chandras's avatar
      samples/seccomp/Makefile: do not build tests if cross-compiling for MIPS · e9107f88
      Markos Chandras authored
      
      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: default avatarMarkos Chandras <markos.chandras@imgtec.com>
      Reported-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      Cc: Ralf Baechle <ralf@linux-mips.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      e9107f88
  9. 03 Dec, 2013 1 commit
  10. 15 Nov, 2013 1 commit
    • Stefani Seibold's avatar
      kfifo API type safety · 498d319b
      Stefani Seibold authored
      
      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: default avatarStefani Seibold <stefani@seibold.net>
      Cc: Russell King <rmk@arm.linux.org.uk>
      Cc: Hauke Mehrtens <hauke@hauke-m.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      498d319b
  11. 04 Sep, 2013 1 commit
    • David Herrmann's avatar
      HID: uhid: improve uhid example client · f5e4e7fd
      David Herrmann authored
      
      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: default avatarDavid Herrmann <dh.herrmann@gmail.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      f5e4e7fd
  12. 30 Aug, 2013 1 commit
  13. 20 Aug, 2013 1 commit
  14. 27 Mar, 2013 1 commit
  15. 05 Feb, 2013 1 commit
    • Arnd Bergmann's avatar
      samples/seccomp: be less stupid about cross compiling · 275aaa68
      Arnd Bergmann authored
      
      The seccomp filters are currently built for the build host, not for the
      machine that they are going to run on, but they are also built for with
      the -m32 flag if the kernel is built for a 32 bit machine, both of which
      seems rather odd.
      
      It broke allyesconfig on my machine, which is x86-64, but building for
      32 bit ARM, with this error message:
      
        In file included from /usr/include/stdio.h:28:0,
                         from samples/seccomp/bpf-fancy.c:15:
        /usr/include/features.h:324:26: fatal error: bits/predefs.h: No such file or directory
      
      because there are no 32 bit libc headers installed on this machine.  We
      should really be building all the samples for the target machine rather
      than the build host, but since the infrastructure for that appears to be
      missing right now, let's be a little bit smarter and not pass the '-m32'
      flag to the HOSTCC when cross- compiling.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Acked-by: default avatarKees Cook <keescook@chromium.org>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: James Morris <james.l.morris@oracle.com>
      Acked-by: default avatarWill Drewry <wad@chromium.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      275aaa68
  16. 25 Jan, 2013 1 commit
  17. 03 Jan, 2013 1 commit
    • Greg Kroah-Hartman's avatar
      misc: remove __dev* attributes. · 6ae14171
      Greg Kroah-Hartman authored
      
      CONFIG_HOTPLUG is going away as an option.  As a result, the __dev*
      markings need to be removed.
      
      This change removes the last of the __dev* markings from the kernel from
      a variety of different, tiny, places.
      
      Based on patches originally written by Bill Pemberton, but redone by me
      in order to handle some of the coding style issues better, by hand.
      
      Cc: Bill Pemberton <wfp5p@virginia.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6ae14171
  18. 12 Sep, 2012 1 commit
  19. 03 Aug, 2012 1 commit
  20. 28 Jun, 2012 1 commit
  21. 18 Jun, 2012 1 commit
    • David Herrmann's avatar
      HID: uhid: add example program · 5148fa52
      David Herrmann authored
      
      This adds an example user-space program that emulates a 3 button mouse
      with wheel. It detects keyboard presses and moves the mouse accordingly.
      
      It register a fake HID device to feed the raw HID reports into the kernel.
      In this example, you could use uinput to get the same result, but this
      shows how to get the same behavior with uhid so you don't need HID parsers
      in user-space.
      Signed-off-by: default avatarDavid Herrmann <dh.herrmann@googlemail.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      5148fa52
  22. 19 Apr, 2012 1 commit
  23. 14 Apr, 2012 1 commit
    • Will Drewry's avatar
      Documentation: prctl/seccomp_filter · 8ac270d1
      Will Drewry authored
      
      Documents how system call filtering using Berkeley Packet
      Filter programs works and how it may be used.
      Includes an example for x86 and a semi-generic
      example using a macro-based code generator.
      Acked-by: default avatarEric Paris <eparis@redhat.com>
      Signed-off-by: default avatarWill Drewry <wad@chromium.org>
      Acked-by: default avatarKees Cook <keescook@chromium.org>
      
      v18: - added acked by
           - update no new privs numbers
      v17: - remove @compat note and add Pitfalls section for arch checking
             (keescook@chromium.org)
      v16: -
      v15: -
      v14: - rebase/nochanges
      v13: - rebase on to 88ebdda6
      
      
      v12: - comment on the ptrace_event use
           - update arch support comment
           - note the behavior of SECCOMP_RET_DATA when there are multiple filters
             (keescook@chromium.org)
           - lots of samples/ clean up incl 64-bit bpf-direct support
             (markus@chromium.org)
           - rebase to linux-next
      v11: - overhaul return value language, updates (keescook@chromium.org)
           - comment on do_exit(SIGSYS)
      v10: - update for SIGSYS
           - update for new seccomp_data layout
           - update for ptrace option use
      v9: - updated bpf-direct.c for SIGILL
      v8: - add PR_SET_NO_NEW_PRIVS to the samples.
      v7: - updated for all the new stuff in v7: TRAP, TRACE
          - only talk about PR_SET_SECCOMP now
          - fixed bad JLE32 check (coreyb@linux.vnet.ibm.com)
          - adds dropper.c: a simple system call disabler
      v6: - tweak the language to note the requirement of
            PR_SET_NO_NEW_PRIVS being called prior to use. (luto@mit.edu)
      v5: - update sample to use system call arguments
          - adds a "fancy" example using a macro-based generator
          - cleaned up bpf in the sample
          - update docs to mention arguments
          - fix prctl value (eparis@redhat.com)
          - language cleanup (rdunlap@xenotime.net)
      v4: - update for no_new_privs use
          - minor tweaks
      v3: - call out BPF <-> Berkeley Packet Filter (rdunlap@xenotime.net)
          - document use of tentative always-unprivileged
          - guard sample compilation for i386 and x86_64
      v2: - move code to samples (corbet@lwn.net)
      Signed-off-by: default avatarJames Morris <james.l.morris@oracle.com>
      8ac270d1
  24. 08 Feb, 2012 1 commit
    • Ohad Ben-Cohen's avatar
      samples/rpmsg: add an rpmsg driver sample · 779b96d2
      Ohad Ben-Cohen authored
      
      Add an rpmsg driver sample, which demonstrates how to communicate with
      an AMP-configured remote processor over the rpmsg bus.
      
      Note how once probed, the driver can immediately start sending messages
      using the rpmsg_send() API, without having to worry about creating endpoints
      or allocating rpmsg addresses: all that work is done by the rpmsg bus,
      and the required information is already embedded in the rpmsg channel
      that the driver is probed with.
      
      In this sample, the driver simply sends a "Hello World!" message to the remote
      processor repeatedly.
      
      Designed with Brian Swetland <swetland@google.com>.
      Signed-off-by: default avatarOhad Ben-Cohen <ohad@wizery.com>
      Cc: Brian Swetland <swetland@google.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Grant Likely <grant.likely@secretlab.ca>
      Cc: Tony Lindgren <tony@atomide.com>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Greg KH <greg@kroah.com>
      Cc: Stephen Boyd <sboyd@codeaurora.org>
      779b96d2
  25. 31 Oct, 2011 1 commit
  26. 01 Jul, 2011 2 commits
    • Avi Kivity's avatar
      perf: Add context field to perf_event · 4dc0da86
      Avi Kivity authored
      
      The perf_event overflow handler does not receive any caller-derived
      argument, so many callers need to resort to looking up the perf_event
      in their local data structure.  This is ugly and doesn't scale if a
      single callback services many perf_events.
      
      Fix by adding a context parameter to perf_event_create_kernel_counter()
      (and derived hardware breakpoints APIs) and storing it in the perf_event.
      The field can be accessed from the callback as event->overflow_handler_context.
      All callers are updated.
      Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1309362157-6596-2-git-send-email-avi@redhat.com
      
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      4dc0da86
    • Peter Zijlstra's avatar
      perf: Remove the nmi parameter from the swevent and overflow interface · a8b0ca17
      Peter Zijlstra authored
      
      The nmi parameter indicated if we could do wakeups from the current
      context, if not, we would set some state and self-IPI and let the
      resulting interrupt do the wakeup.
      
      For the various event classes:
      
        - hardware: nmi=0; PMI is in fact an NMI or we run irq_work_run from
          the PMI-tail (ARM etc.)
        - tracepoint: nmi=0; since tracepoint could be from NMI context.
        - software: nmi=[0,1]; some, like the schedule thing cannot
          perform wakeups, and hence need 0.
      
      As one can see, there is very little nmi=1 usage, and the down-side of
      not using it is that on some platforms some software events can have a
      jiffy delay in wakeup (when arch_irq_work_raise isn't implemented).
      
      The up-side however is that we can remove the nmi parameter and save a
      bunch of conditionals in fast paths.
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Michael Cree <mcree@orcon.net.nz>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Deng-Cheng Zhu <dengcheng.zhu@gmail.com>
      Cc: Anton Blanchard <anton@samba.org>
      Cc: Eric B Munson <emunson@mgebm.net>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Paul Mundt <lethal@linux-sh.org>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jason Wessel <jason.wessel@windriver.com>
      Cc: Don Zickus <dzickus@redhat.com>
      Link: http://lkml.kernel.org/n/tip-agjev8eu666tvknpb3iaj0fg@git.kernel.org
      
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      a8b0ca17
  27. 21 Apr, 2011 1 commit
    • Randy Dunlap's avatar
      HID: hid-example: fix some build issues · d431b2e3
      Randy Dunlap authored
      
      samples/hid-example.o needs some Kconfig and Makefile additions in order
      to build.  It should use <linux/*.h> headers from the build tree, so use
      HEADERS_CHECK to require that those header files be present.
      
      Change the kconfig symbol from tristate to bool since userspace cannot be
      built as loadable modules.
      
      However, I don't understand why the userspace header files are not present
      as reported in Andrew's build log, since it builds OK on x86_64 without
      any of these changes.
      Signed-off-by: default avatarRandy Dunlap <randy.dunlap@oracle.com>
      Cc: Alan Ott <alan@signal11.us>
      Cc: Jiri Kosina <jkosina@suse.cz>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      d431b2e3
  28. 08 Apr, 2011 1 commit
  29. 31 Mar, 2011 1 commit
  30. 22 Mar, 2011 1 commit
  31. 29 Oct, 2010 1 commit
  32. 15 Oct, 2010 1 commit
    • Arnd Bergmann's avatar
      llseek: automatically add .llseek fop · 6038f373
      Arnd Bergmann authored
      All file_operations should get a .llseek operation so we can make
      nonseekable_open the default for future file operations without a
      .llseek pointer.
      
      The three cases that we can automatically detect are no_llseek, seq_lseek
      and default_llseek. For cases where we can we can automatically prove that
      the file offset is always ignored, we use noop_llseek, which maintains
      the current behavior of not returning an error from a seek.
      
      New drivers should normally not use noop_llseek but instead use no_llseek
      and call nonseekable_open at open time.  Existing drivers can be converted
      to do the same when the maintainer knows for certain that no user code
      relies on calling seek on the device file.
      
      The generated code is often incorrectly indented and right now contains
      comments that clarify for each added line why a specific variant was
      chosen. In the version that gets submitted upstream, the comments will
      be gone and I will manually fix the indentation, because there does not
      see...
      6038f373
  33. 01 Oct, 2010 1 commit
    • Ira W. Snyder's avatar
      kfifo: fix scatterlist usage · 399f1e30
      Ira W. Snyder authored
      
      The kfifo_dma family of functions use sg_mark_end() on the last element in
      their scatterlist.  This forces use of a fresh scatterlist for each DMA
      operation, which makes recycling a single scatterlist impossible.
      
      Change the behavior of the kfifo_dma functions to match the usage of the
      dma_map_sg function.  This means that users must respect the returned
      nents value.  The sample code is updated to reflect the change.
      
      This bug is trivial to cause: call kfifo_dma_in_prepare() such that it
      prepares a scatterlist with a single entry comprising the whole fifo.
      This is the case when you map the entirety of a newly created empty fifo.
      This causes the setup_sgl() function to mark the first scatterlist entry
      as the end of the chain, no matter what comes after it.
      
      Afterwards, add and remove some data from the fifo such that another call
      to kfifo_dma_in_prepare() will create two scatterlist entries.  It returns
      nents=2.  However, due to the previous sg_mark_end() call, sg_is_last()
      will now return true for the first scatterlist element.  This causes the
      sample code to print a single scatterlist element when it should print
      two.
      
      By removing the call to sg_mark_end(), we make the API as similar as
      possible to the DMA mapping API.  All users are required to respect the
      returned nents.
      Signed-off-by: default avatarIra W. Snyder <iws@ovro.caltech.edu>
      Cc: Stefani Seibold <stefani@seibold.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      399f1e30
  34. 20 Aug, 2010 5 commits