28 Jul, 2020

20 commits

  • Signed-off-by: Al Viro

    Al Viro
     
  • Signed-off-by: Al Viro

    Al Viro
     
  • Signed-off-by: Al Viro

    Al Viro
     
  • Signed-off-by: Al Viro

    Al Viro
     
  • Note: riscv_fpr_get() used to forget to zero-pad at the end.
    Not worth -stable...

    Signed-off-by: Al Viro

    Al Viro
     
  • Signed-off-by: Al Viro

    Al Viro
     
  • Signed-off-by: Al Viro

    Al Viro
     
  • NB: it used to do short store; fix is needed earlier in the series.

    Signed-off-by: Al Viro

    Al Viro
     
  • Signed-off-by: Al Viro

    Al Viro
     
  • NB: there's a direct call of fpregs_get() left in dump_fpu().
    To be taken out once we convert ELF_FDPIC to use of regset.

    Signed-off-by: Al Viro

    Al Viro
     
  • Signed-off-by: Al Viro

    Al Viro
     
  • Signed-off-by: Al Viro

    Al Viro
     
  • Signed-off-by: Al Viro

    Al Viro
     
  • NB: compat NT_S390_LAST_BREAK might be better as compat_long_t
    rather than long. User-visible ABI, again...

    Signed-off-by: Al Viro

    Al Viro
     
  • Note: compat variant of REGSET_TM_CGPR is almost certainly wrong;
    it claims to be 48*64bit, but just as compat REGSET_GPR it stores
    44*32bit of (truncated) registers + 4 32bit zeros... followed by
    48 more 32bit zeroes. Might be too late to change - it's a userland
    ABI, after all ;-/

    Signed-off-by: Al Viro

    Al Viro
     
  • All instances of ->get() in arch/x86 switched; that might or might
    not be worth splitting up. Notes:

    * for xstateregs_get() the amount we want to store is determined at
    the boot time; see init_xstate_size() and update_regset_xstate_info() for
    details. task->thread.fpu.state.xsave ends with a flexible array member and
    the amount of data in it depends upon the FPU features supported/enabled.

    * fpregs_get() writes slightly less than full ->thread.fpu.state.fsave
    (the last word is not copied); we pass the full size of state.fsave and let
    membuf_write() trim to the amount declared by regset - __regset_get() will
    make sure that the space in buffer is no more than that.

    * copy_xstate_to_user() and its helpers are gone now.

    * fpregs_soft_get() was getting user_regset_copyout() arguments
    wrong. Since "x86: x86 user_regset math_emu" back in 2008... I really
    doubt that it's worth splitting out for -stable, though - you need
    a 486SX box for that to trigger...

    [Kevin's braino fix for copy_xstate_to_kernel() essentially duplicated here]

    Signed-off-by: Al Viro

    Al Viro
     
  • ->regset_get() takes task+regset+buffer, returns the amount of free space
    left in the buffer on success and -E... on error.

    buffer is represented as struct membuf - a pair of (kernel) pointer
    and amount of space left

    Primitives for writing to such:
    * membuf_write(buf, data, size)
    * membuf_zero(buf, size)
    * membuf_store(buf, value)

    These are implemented as inlines (in case of membuf_store - a macro).
    All writes are sequential; they become no-ops when there's no space
    left. Return value of all primitives is the amount of space left
    after the operation, so they can be used as return values of ->regset_get().

    Example of use:

    // stores pt_regs of task + 64 bytes worth of zeroes + 32bit PID of task
    int foo_get(struct task_struct *task, const struct regset *regset,
    struct membuf to)
    {
    membuf_write(&to, task_pt_regs(task), sizeof(struct pt_regs));
    membuf_zero(&to, 64);
    return membuf_store(&to, (u32)task_tgid_vnr(task));
    }

    regset_get()/regset_get_alloc() taught to use that thing if present.
    By the end of the series all users of ->get() will be converted;
    then ->get() and ->get_size() can go.

    Note that unlike ->get() this thing always starts at offset 0 and,
    since it only writes to kernel buffer, can't fail on copyout.
    It can, of course, fail for other reasons, but those tend to
    be less numerous.

    The caller guarantees that the buffer size won't be bigger than
    regset->n * regset->size. That simplifies life for quite a few
    instances.

    Signed-off-by: Al Viro

    Al Viro
     
  • Turn copy_regset_to_user() into regset_get_alloc() + copy_to_user().
    Now all ->get() calls have a kernel buffer as destination.

    Note that we'd already eliminated the callers of copy_regset_to_user()
    with non-zero offset; now that argument is simply unused.

    Uninlined, while we are at it.

    Signed-off-by: Al Viro

    Al Viro
     
  • Al Viro
     
  • Two new helpers: given a process and regset, dump into a buffer.
    regset_get() takes a buffer and size, regset_get_alloc() takes size
    and allocates a buffer.

    Return value in both cases is the amount of data actually dumped in
    case of success or -E... on error.

    In both cases the size is capped by regset->n * regset->size, so
    ->get() is called with offset 0 and size no more than what regset
    expects.

    binfmt_elf.c callers of ->get() are switched to using those; the other
    caller (copy_regset_to_user()) will need some preparations to switch.

    Signed-off-by: Al Viro

    Al Viro
     

27 Jul, 2020

2 commits


26 Jun, 2020

13 commits


15 Jun, 2020

4 commits

  • Linus Torvalds
     
  • Pull SafeSetID update from Micah Morton:
    "Add additional LSM hooks for SafeSetID

    SafeSetID is capable of making allow/deny decisions for set*uid calls
    on a system, and we want to add similar functionality for set*gid
    calls.

    The work to do that is not yet complete, so probably won't make it in
    for v5.8, but we are looking to get this simple patch in for v5.8
    since we have it ready.

    We are planning on the rest of the work for extending the SafeSetID
    LSM being merged during the v5.9 merge window"

    * tag 'LSM-add-setgid-hook-5.8-author-fix' of git://github.com/micah-morton/linux:
    security: Add LSM hooks to set*gid syscalls

    Linus Torvalds
     
  • The SafeSetID LSM uses the security_task_fix_setuid hook to filter
    set*uid() syscalls according to its configured security policy. In
    preparation for adding analagous support in the LSM for set*gid()
    syscalls, we add the requisite hook here. Tested by putting print
    statements in the security_task_fix_setgid hook and seeing them get hit
    during kernel boot.

    Signed-off-by: Thomas Cedeno
    Signed-off-by: Micah Morton

    Thomas Cedeno
     
  • Pull btrfs updates from David Sterba:
    "This reverts the direct io port to iomap infrastructure of btrfs
    merged in the first pull request. We found problems in invalidate page
    that don't seem to be fixable as regressions or without changing iomap
    code that would not affect other filesystems.

    There are four reverts in total, but three of them are followup
    cleanups needed to revert a43a67a2d715 cleanly. The result is the
    buffer head based implementation of direct io.

    Reverts are not great, but under current circumstances I don't see
    better options"

    * tag 'for-5.8-part2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
    Revert "btrfs: switch to iomap_dio_rw() for dio"
    Revert "fs: remove dio_end_io()"
    Revert "btrfs: remove BTRFS_INODE_READDIO_NEED_LOCK"
    Revert "btrfs: split btrfs_direct_IO to read and write part"

    Linus Torvalds
     

14 Jun, 2020

1 commit

  • Pull networking fixes from David Miller:

    1) Fix cfg80211 deadlock, from Johannes Berg.

    2) RXRPC fails to send norigications, from David Howells.

    3) MPTCP RM_ADDR parsing has an off by one pointer error, fix from
    Geliang Tang.

    4) Fix crash when using MSG_PEEK with sockmap, from Anny Hu.

    5) The ucc_geth driver needs __netdev_watchdog_up exported, from
    Valentin Longchamp.

    6) Fix hashtable memory leak in dccp, from Wang Hai.

    7) Fix how nexthops are marked as FDB nexthops, from David Ahern.

    8) Fix mptcp races between shutdown and recvmsg, from Paolo Abeni.

    9) Fix crashes in tipc_disc_rcv(), from Tuong Lien.

    10) Fix link speed reporting in iavf driver, from Brett Creeley.

    11) When a channel is used for XSK and then reused again later for XSK,
    we forget to clear out the relevant data structures in mlx5 which
    causes all kinds of problems. Fix from Maxim Mikityanskiy.

    12) Fix memory leak in genetlink, from Cong Wang.

    13) Disallow sockmap attachments to UDP sockets, it simply won't work.
    From Lorenz Bauer.

    * git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (83 commits)
    net: ethernet: ti: ale: fix allmulti for nu type ale
    net: ethernet: ti: am65-cpsw-nuss: fix ale parameters init
    net: atm: Remove the error message according to the atomic context
    bpf: Undo internal BPF_PROBE_MEM in BPF insns dump
    libbpf: Support pre-initializing .bss global variables
    tools/bpftool: Fix skeleton codegen
    bpf: Fix memlock accounting for sock_hash
    bpf: sockmap: Don't attach programs to UDP sockets
    bpf: tcp: Recv() should return 0 when the peer socket is closed
    ibmvnic: Flush existing work items before device removal
    genetlink: clean up family attributes allocations
    net: ipa: header pad field only valid for AP->modem endpoint
    net: ipa: program upper nibbles of sequencer type
    net: ipa: fix modem LAN RX endpoint id
    net: ipa: program metadata mask differently
    ionic: add pcie_print_link_status
    rxrpc: Fix race between incoming ACK parser and retransmitter
    net/mlx5: E-Switch, Fix some error pointer dereferences
    net/mlx5: Don't fail driver on failure to create debugfs
    net/mlx5e: CT: Fix ipv6 nat header rewrite actions
    ...

    Linus Torvalds