20 Aug, 2020

1 commit

  • Add kernel module with user mode driver that populates bpffs with
    BPF iterators.

    $ mount bpffs /my/bpffs/ -t bpf
    $ ls -la /my/bpffs/
    total 4
    drwxrwxrwt 2 root root 0 Jul 2 00:27 .
    drwxr-xr-x 19 root root 4096 Jul 2 00:09 ..
    -rw------- 1 root root 0 Jul 2 00:27 maps.debug
    -rw------- 1 root root 0 Jul 2 00:27 progs.debug

    The user mode driver will load BPF Type Formats, create BPF maps, populate BPF
    maps, load two BPF programs, attach them to BPF iterators, and finally send two
    bpf_link IDs back to the kernel.
    The kernel will pin two bpf_links into newly mounted bpffs instance under
    names "progs.debug" and "maps.debug". These two files become human readable.

    $ cat /my/bpffs/progs.debug
    id name attached
    11 dump_bpf_map bpf_iter_bpf_map
    12 dump_bpf_prog bpf_iter_bpf_prog
    27 test_pkt_access
    32 test_main test_pkt_access test_pkt_access
    33 test_subprog1 test_pkt_access_subprog1 test_pkt_access
    34 test_subprog2 test_pkt_access_subprog2 test_pkt_access
    35 test_subprog3 test_pkt_access_subprog3 test_pkt_access
    36 new_get_skb_len get_skb_len test_pkt_access
    37 new_get_skb_ifindex get_skb_ifindex test_pkt_access
    38 new_get_constant get_constant test_pkt_access

    The BPF program dump_bpf_prog() in iterators.bpf.c is printing this data about
    all BPF programs currently loaded in the system. This information is unstable
    and will change from kernel to kernel as ".debug" suffix conveys.

    Signed-off-by: Alexei Starovoitov
    Signed-off-by: Daniel Borkmann
    Link: https://lore.kernel.org/bpf/20200819042759.51280-4-alexei.starovoitov@gmail.com

    Alexei Starovoitov
     

02 Aug, 2020

1 commit


01 Aug, 2020

1 commit

  • Daniel Borkmann says:

    ====================
    pull-request: bpf 2020-07-31

    The following pull-request contains BPF updates for your *net* tree.

    We've added 5 non-merge commits during the last 21 day(s) which contain
    a total of 5 files changed, 126 insertions(+), 18 deletions(-).

    The main changes are:

    1) Fix a map element leak in HASH_OF_MAPS map type, from Andrii Nakryiko.

    2) Fix a NULL pointer dereference in __btf_resolve_helper_id() when no
    btf_vmlinux is available, from Peilin Ye.

    3) Init pos variable in __bpfilter_process_sockopt(), from Christoph Hellwig.

    4) Fix a cgroup sockopt verifier test by specifying expected attach type,
    from Jean-Philippe Brucker.

    Note that when net gets merged into net-next later on, there is a small
    merge conflict in kernel/bpf/btf.c between commit 5b801dfb7feb ("bpf: Fix
    NULL pointer dereference in __btf_resolve_helper_id()") from the bpf tree
    and commit 138b9a0511c7 ("bpf: Remove btf_id helpers resolving") from the
    net-next tree.

    Resolve as follows: remove the old hunk with the __btf_resolve_helper_id()
    function. Change the btf_resolve_helper_id() so it actually tests for a
    NULL btf_vmlinux and bails out:

    int btf_resolve_helper_id(struct bpf_verifier_log *log,
    const struct bpf_func_proto *fn, int arg)
    {
    int id;

    if (fn->arg_type[arg] != ARG_PTR_TO_BTF_ID || !btf_vmlinux)
    return -EINVAL;
    id = fn->btf_id[arg];
    if (!id || id > btf_vmlinux->nr_types)
    return -EINVAL;
    return id;
    }

    Let me know if you run into any others issues (CC'ing Jiri Olsa so he's in
    the loop with regards to merge conflict resolution).
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     

31 Jul, 2020

1 commit

  • __bpfilter_process_sockopt never initialized the pos variable passed
    to the pipe write. This has been mostly harmless in the past as pipes
    ignore the offset, but the switch to kernel_write now verified the
    position, which can lead to a failure depending on the exact stack
    initialization pattern. Initialize the variable to zero to make
    rw_verify_area happy.

    Fixes: 6955a76fbcd5 ("bpfilter: switch to kernel_write")
    Reported-by: Christian Brauner
    Reported-by: Rodrigo Madera
    Signed-off-by: Christoph Hellwig
    Signed-off-by: Daniel Borkmann
    Tested-by: Rodrigo Madera
    Tested-by: Christian Brauner
    Reviewed-by: Christian Brauner
    Link: https://lore.kernel.org/bpf/20200730160900.187157-1-hch@lst.de

    Christoph Hellwig
     

25 Jul, 2020

4 commits


15 Jul, 2020

3 commits

  • Originally, bpfilter_umh was linked with -static only when
    CONFIG_BPFILTER_UMH=y.

    Commit 8a2cc0505cc4 ("bpfilter: use 'userprogs' syntax to build
    bpfilter_umh") silently, accidentally dropped the CONFIG_BPFILTER_UMH=y
    test in the Makefile. Revive it in order to link it dynamically when
    CONFIG_BPFILTER_UMH=m.

    Since commit b1183b6dca3e ("bpfilter: check if $(CC) can link static
    libc in Kconfig"), the compiler must be capable of static linking to
    enable CONFIG_BPFILTER_UMH, but it requires more than needed.

    To loosen the compiler requirement, I changed the dependency as follows:

    depends on CC_CAN_LINK
    depends on m || CC_CAN_LINK_STATIC

    If CONFIG_CC_CAN_LINK_STATIC in unset, CONFIG_BPFILTER_UMH is restricted
    to 'm' or 'n'.

    In theory, CONFIG_CC_CAN_LINK is not required for CONFIG_BPFILTER_UMH=y,
    but I did not come up with a good way to describe it.

    Fixes: 8a2cc0505cc4 ("bpfilter: use 'userprogs' syntax to build bpfilter_umh")
    Reported-by: Michal Kubecek
    Signed-off-by: Masahiro Yamada
    Signed-off-by: Alexei Starovoitov
    Tested-by: Michal Kubecek
    Link: https://lore.kernel.org/bpf/20200701092644.762234-1-masahiroy@kernel.org

    Masahiro Yamada
     
  • Make sure 'pos' is initialized to zero before calling kernel_write().

    Fixes: d2ba09c17a06 ("net: add skeleton of bpfilter kernel module")
    Signed-off-by: Alexei Starovoitov

    Alexei Starovoitov
     
  • …nel/git/ebiederm/user-namespace into bpf-next

    Alexei Starovoitov
     

08 Jul, 2020

2 commits

  • While pipes don't really need sb_writers projection, __kernel_write is an
    interface better kept private, and the additional rw_verify_area does not
    hurt here.

    Signed-off-by: Christoph Hellwig

    Christoph Hellwig
     
  • Instead of relying on the exit_umh cleanup callback use the fact a
    struct pid can be tested to see if a process still exists, and that
    struct pid has a wait queue that notifies when the process dies.

    v1: https://lkml.kernel.org/r/87h7uydlu9.fsf_-_@x220.int.ebiederm.org
    v2: https://lkml.kernel.org/r/874kqt4owu.fsf_-_@x220.int.ebiederm.org
    Link: https://lkml.kernel.org/r/20200702164140.4468-14-ebiederm@xmission.com
    Reviewed-by: Greg Kroah-Hartman
    Acked-by: Alexei Starovoitov
    Tested-by: Alexei Starovoitov
    Signed-off-by: "Eric W. Biederman"

    Eric W. Biederman
     

04 Jul, 2020

3 commits

  • Use struct pid instead of user space pid values that are prone to wrap
    araound.

    In addition track the entire thread group instead of just the first
    thread that is started by exec. There are no multi-threaded user mode
    drivers today but there is nothing preclucing user drivers from being
    multi-threaded, so it is just a good idea to track the entire process.

    Take a reference count on the tgid's in question to make it possible
    to remove exit_umh in a future change.

    As a struct pid is available directly use kill_pid_info.

    The prior process signalling code was iffy in using a userspace pid
    known to be in the initial pid namespace and then looking up it's task
    in whatever the current pid namespace is. It worked only because
    kernel threads always run in the initial pid namespace.

    As the tgid is now refcounted verify the tgid is NULL at the start of
    fork_usermode_driver to avoid the possibility of silent pid leaks.

    v1: https://lkml.kernel.org/r/87mu4qdlv2.fsf_-_@x220.int.ebiederm.org
    v2: https://lkml.kernel.org/r/a70l4oy8.fsf_-_@x220.int.ebiederm.org
    Link: https://lkml.kernel.org/r/20200702164140.4468-12-ebiederm@xmission.com
    Reviewed-by: Greg Kroah-Hartman
    Acked-by: Alexei Starovoitov
    Tested-by: Alexei Starovoitov
    Signed-off-by: "Eric W. Biederman"

    Eric W. Biederman
     
  • To allow for restarts 61fbf5933d42 ("net: bpfilter: restart
    bpfilter_umh when error occurred") moved the blob holding the
    userspace binary out of the init sections.

    Now that loading the blob into a filesystem is separate from executing
    the blob the blob no longer needs to live .rodata to allow for restarting.
    So move the blob back to .init.rodata.

    v1: https://lkml.kernel.org/r/87sgeidlvq.fsf_-_@x220.int.ebiederm.org
    v2: https://lkml.kernel.org/r/87ftad4ozc.fsf_-_@x220.int.ebiederm.org
    Link: https://lkml.kernel.org/r/20200702164140.4468-11-ebiederm@xmission.com
    Reviewed-by: Greg Kroah-Hartman
    Acked-by: Alexei Starovoitov
    Tested-by: Alexei Starovoitov
    Signed-off-by: "Eric W. Biederman"

    Eric W. Biederman
     
  • Instead of loading a binary blob into a temporary file with
    shmem_kernel_file_setup load a binary blob into a temporary tmpfs
    filesystem. This means that the blob can be stored in an init section
    and discared, and it means the binary blob will have a filename so can
    be executed normally.

    The only tricky thing about this code is that in the helper function
    blob_to_mnt __fput_sync is used. That is because a file can not be
    executed if it is still open for write, and the ordinary delayed close
    for kernel threads does not happen soon enough, which causes the
    following exec to fail. The function umd_load_blob is not called with
    any locks so this should be safe.

    Executing the blob normally winds up correcting several problems with
    the user mode driver code discovered by Tetsuo Handa[1]. By passing
    an ordinary filename into the exec, it is no longer necessary to
    figure out how to turn a O_RDWR file descriptor into a properly
    referende counted O_EXEC file descriptor that forbids all writes. For
    path based LSMs there are no new special cases.

    [1] https://lore.kernel.org/linux-fsdevel/2a8775b4-1dd5-9d5c-aa42-9872445e0942@i-love.sakura.ne.jp/
    v1: https://lkml.kernel.org/r/87d05mf0j9.fsf_-_@x220.int.ebiederm.org
    v2: https://lkml.kernel.org/r/87wo3p4p35.fsf_-_@x220.int.ebiederm.org
    Link: https://lkml.kernel.org/r/20200702164140.4468-8-ebiederm@xmission.com
    Reviewed-by: Greg Kroah-Hartman
    Acked-by: Alexei Starovoitov
    Tested-by: Alexei Starovoitov
    Signed-off-by: "Eric W. Biederman"

    Eric W. Biederman
     

25 May, 2020

1 commit


17 May, 2020

3 commits

  • The user mode helper should be compiled for the same architecture as
    the kernel.

    This Makefile reused the 'hostprogs' syntax by overriding HOSTCC with CC.
    Use the new syntax 'userprogs' to fix the Makefile mess.

    Signed-off-by: Masahiro Yamada
    Acked-by: Sam Ravnborg

    Masahiro Yamada
     
  • On Fedora, linking static glibc requires the glibc-static RPM package,
    which is not part of the glibc-devel package.

    CONFIG_CC_CAN_LINK does not check the capability of static linking,
    so you can enable CONFIG_BPFILTER_UMH, then fail to build:

    HOSTLD net/bpfilter/bpfilter_umh
    /usr/bin/ld: cannot find -lc
    collect2: error: ld returned 1 exit status

    Add CONFIG_CC_CAN_LINK_STATIC, and make CONFIG_BPFILTER_UMH depend
    on it.

    Reported-by: Valdis Kletnieks
    Signed-off-by: Masahiro Yamada
    Acked-by: Alexei Starovoitov

    Masahiro Yamada
     
  • bpfilter_umh is built for the default machine bit of the compiler,
    which may not match to the bit size of the kernel.

    This happens in the scenario below:

    You can use biarch GCC that defaults to 64-bit for building the 32-bit
    kernel. In this case, Kbuild passes -m32 to teach the compiler to
    produce 32-bit kernel space objects. However, it is missing when
    building bpfilter_umh. It is built as a 64-bit ELF, and then embedded
    into the 32-bit kernel.

    The 32-bit kernel and 64-bit umh is a bad combination.

    In theory, we can have 32-bit umh running on 64-bit kernel, but we do
    not have a good reason to support such a usecase.

    The best is to match the bit size between them.

    Pass -m32 or -m64 to the umh build command if it is found in
    $(KBUILD_CFLAGS). Evaluate CC_CAN_LINK against the kernel bit-size.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

04 Apr, 2020

1 commit

  • Pull SPDX updates from Greg KH:
    "Here are three SPDX patches for 5.7-rc1.

    One fixes up the SPDX tag for a single driver, while the other two go
    through the tree and add SPDX tags for all of the .gitignore files as
    needed.

    Nothing too complex, but you will get a merge conflict with your
    current tree, that should be trivial to handle (one file modified by
    two things, one file deleted.)

    All three of these have been in linux-next for a while, with no
    reported issues other than the merge conflict"

    * tag 'spdx-5.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/spdx:
    ASoC: MT6660: make spdxcheck.py happy
    .gitignore: add SPDX License Identifier
    .gitignore: remove too obvious comments

    Linus Torvalds
     

01 Apr, 2020

1 commit

  • A testing message was brought by 13d0f7b814d9 ("net/bpfilter: fix dprintf
    usage for /dev/kmsg") but should've been deleted before patch submission.
    Although it doesn't cause any harm to the code or functionality itself, it's
    totally unpleasant to have it displayed on every loop iteration with no real
    use case. Thus remove it unconditionally.

    Fixes: 13d0f7b814d9 ("net/bpfilter: fix dprintf usage for /dev/kmsg")
    Signed-off-by: Bruno Meneguele
    Signed-off-by: David S. Miller

    Bruno Meneguele
     

25 Mar, 2020

1 commit


15 Mar, 2020

1 commit

  • The bpfilter UMH code was recently changed to log its informative messages to
    /dev/kmsg, however this interface doesn't support SEEK_CUR yet, used by
    dprintf(). As result dprintf() returns -EINVAL and doesn't log anything.

    However there already had some discussions about supporting SEEK_CUR into
    /dev/kmsg interface in the past it wasn't concluded. Since the only user of
    that from userspace perspective inside the kernel is the bpfilter UMH
    (userspace) module it's better to correct it here instead waiting a conclusion
    on the interface.

    Fixes: 36c4357c63f3 ("net: bpfilter: print umh messages to /dev/kmsg")
    Signed-off-by: Bruno Meneguele
    Signed-off-by: David S. Miller

    Bruno Meneguele
     

04 Feb, 2020

1 commit

  • In old days, the "host-progs" syntax was used for specifying host
    programs. It was renamed to the current "hostprogs-y" in 2004.

    It is typically useful in scripts/Makefile because it allows Kbuild to
    selectively compile host programs based on the kernel configuration.

    This commit renames like follows:

    always -> always-y
    hostprogs-y -> hostprogs

    So, scripts/Makefile will look like this:

    always-$(CONFIG_BUILD_BIN2C) += ...
    always-$(CONFIG_KALLSYMS) += ...
    ...
    hostprogs := $(always-y) $(always-m)

    I think this makes more sense because a host program is always a host
    program, irrespective of the kernel configuration. We want to specify
    which ones to compile by CONFIG options, so always-y will be handier.

    The "always", "hostprogs-y", "hostprogs-m" will be kept for backward
    compatibility for a while.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

13 Jul, 2019

1 commit

  • Pull Kbuild updates from Masahiro Yamada:

    - remove headers_{install,check}_all targets

    - remove unreasonable 'depends on !UML' from CONFIG_SAMPLES

    - re-implement 'make headers_install' more cleanly

    - add new header-test-y syntax to compile-test headers

    - compile-test exported headers to ensure they are compilable in
    user-space

    - compile-test headers under include/ to ensure they are self-contained

    - remove -Waggregate-return, -Wno-uninitialized, -Wno-unused-value
    flags

    - add -Werror=unknown-warning-option for Clang

    - add 128-bit built-in types support to genksyms

    - fix missed rebuild of modules.builtin

    - propagate 'No space left on device' error in fixdep to Make

    - allow Clang to use its integrated assembler

    - improve some coccinelle scripts

    - add a new flag KBUILD_ABS_SRCTREE to request Kbuild to use absolute
    path for $(srctree).

    - do not ignore errors when compression utility is missing

    - misc cleanups

    * tag 'kbuild-v5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (49 commits)
    kbuild: use -- separater intead of $(filter-out ...) for cc-cross-prefix
    kbuild: Inform user to pass ARCH= for make mrproper
    kbuild: fix compression errors getting ignored
    kbuild: add a flag to force absolute path for srctree
    kbuild: replace KBUILD_SRCTREE with boolean building_out_of_srctree
    kbuild: remove src and obj from the top Makefile
    scripts/tags.sh: remove unused environment variables from comments
    scripts/tags.sh: drop SUBARCH support for ARM
    kbuild: compile-test kernel headers to ensure they are self-contained
    kheaders: include only headers into kheaders_data.tar.xz
    kheaders: remove meaningless -R option of 'ls'
    kbuild: support header-test-pattern-y
    kbuild: do not create wrappers for header-test-y
    kbuild: compile-test exported headers to ensure they are self-contained
    init/Kconfig: add CONFIG_CC_CAN_LINK
    kallsyms: exclude kasan local symbols on s390
    kbuild: add more hints about SUBDIRS replacement
    coccinelle: api/stream_open: treat all wait_.*() calls as blocking
    coccinelle: put_device: Add a cast to an expression for an assignment
    coccinelle: put_device: Adjust a message construction
    ...

    Linus Torvalds
     

12 Jul, 2019

1 commit

  • Pull networking updates from David Miller:
    "Some highlights from this development cycle:

    1) Big refactoring of ipv6 route and neigh handling to support
    nexthop objects configurable as units from userspace. From David
    Ahern.

    2) Convert explored_states in BPF verifier into a hash table,
    significantly decreased state held for programs with bpf2bpf
    calls, from Alexei Starovoitov.

    3) Implement bpf_send_signal() helper, from Yonghong Song.

    4) Various classifier enhancements to mvpp2 driver, from Maxime
    Chevallier.

    5) Add aRFS support to hns3 driver, from Jian Shen.

    6) Fix use after free in inet frags by allocating fqdirs dynamically
    and reworking how rhashtable dismantle occurs, from Eric Dumazet.

    7) Add act_ctinfo packet classifier action, from Kevin
    Darbyshire-Bryant.

    8) Add TFO key backup infrastructure, from Jason Baron.

    9) Remove several old and unused ISDN drivers, from Arnd Bergmann.

    10) Add devlink notifications for flash update status to mlxsw driver,
    from Jiri Pirko.

    11) Lots of kTLS offload infrastructure fixes, from Jakub Kicinski.

    12) Add support for mv88e6250 DSA chips, from Rasmus Villemoes.

    13) Various enhancements to ipv6 flow label handling, from Eric
    Dumazet and Willem de Bruijn.

    14) Support TLS offload in nfp driver, from Jakub Kicinski, Dirk van
    der Merwe, and others.

    15) Various improvements to axienet driver including converting it to
    phylink, from Robert Hancock.

    16) Add PTP support to sja1105 DSA driver, from Vladimir Oltean.

    17) Add mqprio qdisc offload support to dpaa2-eth, from Ioana
    Radulescu.

    18) Add devlink health reporting to mlx5, from Moshe Shemesh.

    19) Convert stmmac over to phylink, from Jose Abreu.

    20) Add PTP PHC (Physical Hardware Clock) support to mlxsw, from
    Shalom Toledo.

    21) Add nftables SYNPROXY support, from Fernando Fernandez Mancera.

    22) Convert tcp_fastopen over to use SipHash, from Ard Biesheuvel.

    23) Track spill/fill of constants in BPF verifier, from Alexei
    Starovoitov.

    24) Support bounded loops in BPF, from Alexei Starovoitov.

    25) Various page_pool API fixes and improvements, from Jesper Dangaard
    Brouer.

    26) Just like ipv4, support ref-countless ipv6 route handling. From
    Wei Wang.

    27) Support VLAN offloading in aquantia driver, from Igor Russkikh.

    28) Add AF_XDP zero-copy support to mlx5, from Maxim Mikityanskiy.

    29) Add flower GRE encap/decap support to nfp driver, from Pieter
    Jansen van Vuuren.

    30) Protect against stack overflow when using act_mirred, from John
    Hurley.

    31) Allow devmap map lookups from eBPF, from Toke Høiland-Jørgensen.

    32) Use page_pool API in netsec driver, Ilias Apalodimas.

    33) Add Google gve network driver, from Catherine Sullivan.

    34) More indirect call avoidance, from Paolo Abeni.

    35) Add kTLS TX HW offload support to mlx5, from Tariq Toukan.

    36) Add XDP_REDIRECT support to bnxt_en, from Andy Gospodarek.

    37) Add MPLS manipulation actions to TC, from John Hurley.

    38) Add sending a packet to connection tracking from TC actions, and
    then allow flower classifier matching on conntrack state. From
    Paul Blakey.

    39) Netfilter hw offload support, from Pablo Neira Ayuso"

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (2080 commits)
    net/mlx5e: Return in default case statement in tx_post_resync_params
    mlx5: Return -EINVAL when WARN_ON_ONCE triggers in mlx5e_tls_resync().
    net: dsa: add support for BRIDGE_MROUTER attribute
    pkt_sched: Include const.h
    net: netsec: remove static declaration for netsec_set_tx_de()
    net: netsec: remove superfluous if statement
    netfilter: nf_tables: add hardware offload support
    net: flow_offload: rename tc_cls_flower_offload to flow_cls_offload
    net: flow_offload: add flow_block_cb_is_busy() and use it
    net: sched: remove tcf block API
    drivers: net: use flow block API
    net: sched: use flow block API
    net: flow_offload: add flow_block_cb_{priv, incref, decref}()
    net: flow_offload: add list handling functions
    net: flow_offload: add flow_block_cb_alloc() and flow_block_cb_free()
    net: flow_offload: rename TCF_BLOCK_BINDER_TYPE_* to FLOW_BLOCK_BINDER_TYPE_*
    net: flow_offload: rename TC_BLOCK_{UN}BIND to FLOW_BLOCK_{UN}BIND
    net: flow_offload: add flow_block_cb_setup_simple()
    net: hisilicon: Add an tx_desc to adapt HI13X1_GMAC
    net: hisilicon: Add an rx_desc to adapt HI13X1_GMAC
    ...

    Linus Torvalds
     

09 Jul, 2019

1 commit

  • …iederm/user-namespace

    Pull force_sig() argument change from Eric Biederman:
    "A source of error over the years has been that force_sig has taken a
    task parameter when it is only safe to use force_sig with the current
    task.

    The force_sig function is built for delivering synchronous signals
    such as SIGSEGV where the userspace application caused a synchronous
    fault (such as a page fault) and the kernel responded with a signal.

    Because the name force_sig does not make this clear, and because the
    force_sig takes a task parameter the function force_sig has been
    abused for sending other kinds of signals over the years. Slowly those
    have been fixed when the oopses have been tracked down.

    This set of changes fixes the remaining abusers of force_sig and
    carefully rips out the task parameter from force_sig and friends
    making this kind of error almost impossible in the future"

    * 'siginfo-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace: (27 commits)
    signal/x86: Move tsk inside of CONFIG_MEMORY_FAILURE in do_sigbus
    signal: Remove the signal number and task parameters from force_sig_info
    signal: Factor force_sig_info_to_task out of force_sig_info
    signal: Generate the siginfo in force_sig
    signal: Move the computation of force into send_signal and correct it.
    signal: Properly set TRACE_SIGNAL_LOSE_INFO in __send_signal
    signal: Remove the task parameter from force_sig_fault
    signal: Use force_sig_fault_to_task for the two calls that don't deliver to current
    signal: Explicitly call force_sig_fault on current
    signal/unicore32: Remove tsk parameter from __do_user_fault
    signal/arm: Remove tsk parameter from __do_user_fault
    signal/arm: Remove tsk parameter from ptrace_break
    signal/nds32: Remove tsk parameter from send_sigtrap
    signal/riscv: Remove tsk parameter from do_trap
    signal/sh: Remove tsk parameter from force_sig_info_fault
    signal/um: Remove task parameter from send_sigtrap
    signal/x86: Remove task parameter from send_sigtrap
    signal: Remove task parameter from force_sig_mceerr
    signal: Remove task parameter from force_sig
    signal: Remove task parameter from force_sigsegv
    ...

    Linus Torvalds
     

08 Jul, 2019

2 commits

  • bpfilter_umh currently printed all messages to /dev/console and this
    might interfere the user activity(*).

    This commit changes the output device to /dev/kmsg so that the messages
    from bpfilter_umh won't show on the console directly.

    (*) https://bugzilla.suse.com/show_bug.cgi?id=1140221

    Signed-off-by: Gary Lin
    Signed-off-by: David S. Miller

    Gary Lin
     
  • Currently, scripts/cc-can-link.sh is run just for BPFILTER_UMH, but
    defining CC_CAN_LINK will be useful in other places.

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

27 May, 2019

1 commit

  • The locking in force_sig_info is not prepared to deal with
    a task that exits or execs (as sighand may change). As force_sig
    is only built to handle synchronous exceptions.

    Further the function force_sig_info changes the signal state if the
    signal is ignored, or blocked or if SIGNAL_UNKILLABLE will prevent the
    delivery of the signal. The signal SIGKILL can not be ignored and can
    not be blocked and SIGNAL_UNKILLABLE won't prevent it from being
    delivered.

    So using force_sig rather than send_sig for SIGKILL is pointless.

    Because it won't impact the sending of the signal and and because
    using force_sig is wrong, replace force_sig with send_sig.

    Cc: Alexei Starovoitov
    Cc: David S. Miller
    Fixes: d2ba09c17a06 ("net: add skeleton of bpfilter kernel module")
    Signed-off-by: "Eric W. Biederman"

    Eric W. Biederman
     

21 May, 2019

1 commit


18 May, 2019

1 commit

  • Currently, the Kbuild core manipulates header search paths in a crazy
    way [1].

    To fix this mess, I want all Makefiles to add explicit $(srctree)/ to
    the search paths in the srctree. Some Makefiles are already written in
    that way, but not all. The goal of this work is to make the notation
    consistent, and finally get rid of the gross hacks.

    Having whitespaces after -I does not matter since commit 48f6e3cf5bc6
    ("kbuild: do not drop -I without parameter").

    [1]: https://patchwork.kernel.org/patch/9632347/

    Signed-off-by: Masahiro Yamada

    Masahiro Yamada
     

24 Feb, 2019

1 commit

  • I thought header search paths to tools/include(/uapi) were unneeded,
    but it looks like a build error occurs depending on the compiler.

    Commit 303a339f30a9 ("bpfilter: remove extra header search paths for
    bpfilter_umh") reintroduced the build error fixed by commit ae40832e53c3
    ("bpfilter: fix a build err").

    Apology for the breakage, and thanks to Guenter for reporting this.

    Fixes: 303a339f30a9 ("bpfilter: remove extra header search paths for bpfilter_umh")
    Reported-by: Guenter Roeck
    Signed-off-by: Masahiro Yamada
    Tested-by: Guenter Roeck
    Signed-off-by: David S. Miller

    Masahiro Yamada
     

04 Feb, 2019

1 commit


17 Jan, 2019

1 commit

  • The section of bpfilter UMH blob is the ".bpfilter_umh". but this is not
    an explicit section. so linking warning occurred at compile time for the
    powerpc.
    So, this patch makes use of the ".rodata" instead of the ".bpfilter_umh".

    Config condition:

    CONFIG_BPFILTER=y
    CONFIG_BPFILTER_UMH=y

    Result:

    ld: warning: orphan section `.bpfilter_umh' from
    `net/bpfilter/bpfilter_umh_blob.o' being placed in section `.bpfilter_umh'

    Fixes: 61fbf5933d42 ("net: bpfilter: restart bpfilter_umh when error occurred")
    Reported-by: Stephen Rothwell
    Signed-off-by: Taehee Yoo
    Signed-off-by: David S. Miller

    Taehee Yoo
     

12 Jan, 2019

3 commits

  • The bpfilter.ko module can be removed while functions of the bpfilter.ko
    are executing. so panic can occurred. in order to protect that, locks can
    be used. a bpfilter_lock protects routines in the
    __bpfilter_process_sockopt() but it's not enough because __exit routine
    can be executed concurrently.

    Now, the bpfilter_umh can not run in parallel.
    So, the module do not removed while it's being used and it do not
    double-create UMH process.
    The members of the umh_info and the bpfilter_umh_ops are protected by
    the bpfilter_umh_ops.lock.

    test commands:
    while :
    do
    iptables -I FORWARD -m string --string ap --algo kmp &
    modprobe -rv bpfilter &
    done

    splat looks like:
    [ 298.623435] BUG: unable to handle kernel paging request at fffffbfff807440b
    [ 298.628512] #PF error: [normal kernel read fault]
    [ 298.633018] PGD 124327067 P4D 124327067 PUD 11c1a3067 PMD 119eb2067 PTE 0
    [ 298.638859] Oops: 0000 [#1] SMP DEBUG_PAGEALLOC KASAN PTI
    [ 298.638859] CPU: 0 PID: 2997 Comm: iptables Not tainted 4.20.0+ #154
    [ 298.638859] RIP: 0010:__mutex_lock+0x6b9/0x16a0
    [ 298.638859] Code: c0 00 00 e8 89 82 ff ff 80 bd 8f fc ff ff 00 0f 85 d9 05 00 00 48 8b 85 80 fc ff ff 48 bf 00 00 00 00 00 fc ff df 48 c1 e8 03 3c 38 00 0f 85 1d 0e 00 00 48 8b 85 c8 fc ff ff 49 39 47 58 c6
    [ 298.638859] RSP: 0018:ffff88810e7777a0 EFLAGS: 00010202
    [ 298.638859] RAX: 1ffffffff807440b RBX: ffff888111bd4d80 RCX: 0000000000000000
    [ 298.638859] RDX: 1ffff110235ff806 RSI: ffff888111bd5538 RDI: dffffc0000000000
    [ 298.638859] RBP: ffff88810e777b30 R08: 0000000080000002 R09: 0000000000000000
    [ 298.638859] R10: 0000000000000000 R11: 0000000000000000 R12: fffffbfff168a42c
    [ 298.638859] R13: ffff888111bd4d80 R14: ffff8881040e9a05 R15: ffffffffc03a2000
    [ 298.638859] FS: 00007f39e3758700(0000) GS:ffff88811ae00000(0000) knlGS:0000000000000000
    [ 298.638859] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [ 298.638859] CR2: fffffbfff807440b CR3: 000000011243e000 CR4: 00000000001006f0
    [ 298.638859] Call Trace:
    [ 298.638859] ? mutex_lock_io_nested+0x1560/0x1560
    [ 298.638859] ? kasan_kmalloc+0xa0/0xd0
    [ 298.638859] ? kmem_cache_alloc+0x1c2/0x260
    [ 298.638859] ? __alloc_file+0x92/0x3c0
    [ 298.638859] ? alloc_empty_file+0x43/0x120
    [ 298.638859] ? alloc_file_pseudo+0x220/0x330
    [ 298.638859] ? sock_alloc_file+0x39/0x160
    [ 298.638859] ? __sys_socket+0x113/0x1d0
    [ 298.638859] ? __x64_sys_socket+0x6f/0xb0
    [ 298.638859] ? do_syscall_64+0x138/0x560
    [ 298.638859] ? entry_SYSCALL_64_after_hwframe+0x49/0xbe
    [ 298.638859] ? __alloc_file+0x92/0x3c0
    [ 298.638859] ? init_object+0x6b/0x80
    [ 298.638859] ? cyc2ns_read_end+0x10/0x10
    [ 298.638859] ? cyc2ns_read_end+0x10/0x10
    [ 298.638859] ? hlock_class+0x140/0x140
    [ 298.638859] ? sched_clock_local+0xd4/0x140
    [ 298.638859] ? sched_clock_local+0xd4/0x140
    [ 298.638859] ? check_flags.part.37+0x440/0x440
    [ 298.638859] ? __lock_acquire+0x4f90/0x4f90
    [ 298.638859] ? set_rq_offline.part.89+0x140/0x140
    [ ... ]

    Fixes: d2ba09c17a06 ("net: add skeleton of bpfilter kernel module")
    Signed-off-by: Taehee Yoo
    Signed-off-by: David S. Miller

    Taehee Yoo
     
  • The bpfilter_umh will be stopped via __stop_umh() when the bpfilter
    error occurred.
    The bpfilter_umh() couldn't start again because there is no restart
    routine.

    The section of the bpfilter_umh_{start/end} is no longer .init.rodata
    because these area should be reused in the restart routine. hence
    the section name is changed to .bpfilter_umh.

    The bpfilter_ops->start() is restart callback. it will be called when
    bpfilter_umh is stopped.
    The stop bit means bpfilter_umh is stopped. this bit is set by both
    start and stop routine.

    Before this patch,
    Test commands:
    $ iptables -vnL
    $ kill -9
    $ iptables -vnL
    [ 480.045136] bpfilter: write fail -32
    $ iptables -vnL

    All iptables commands will fail.

    After this patch,
    Test commands:
    $ iptables -vnL
    $ kill -9
    $ iptables -vnL
    $ iptables -vnL

    Now, all iptables commands will work.

    Fixes: d2ba09c17a06 ("net: add skeleton of bpfilter kernel module")
    Signed-off-by: Taehee Yoo
    Signed-off-by: David S. Miller

    Taehee Yoo
     
  • Now, UMH process is killed, do_exit() calls the umh_info->cleanup callback
    to release members of the umh_info.
    This patch makes bpfilter_umh's cleanup routine to use the
    umh_info->cleanup callback.

    Signed-off-by: Taehee Yoo
    Signed-off-by: David S. Miller

    Taehee Yoo
     

23 Oct, 2018

1 commit