1. 06 Jan, 2021 13 commits
    • Al Viro's avatar
      get rid of COMPAT_ELF_EXEC_PAGESIZE · e565d89e
      Al Viro authored
      not defined by any architecture (and never had been)
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      e565d89e
    • Al Viro's avatar
      compat_binfmt_elf: don't bother with undef of ELF_ARCH · 492ed381
      Al Viro authored
      It's not used anywhere downstream (and never had been, AFAICS).
      Theoretically, fs/binfmt_elf.c does use it, but only in the
      non-regset coredump handling and all biarch architectures
      end up with that ifdefed out.
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      492ed381
    • Al Viro's avatar
      Kconfig: regularize selection of CONFIG_BINFMT_ELF · 41026c34
      Al Viro authored
      with mips converted to use of fs/config_binfmt_elf.c, there's no
      need to keep selects of that thing all over arch/* - we can simply
      turn into def_bool y if COMPAT && BINFMT_ELF (in fs/Kconfig.binfmt)
      and get rid of all selects.
      
      Several architectures got those selects wrong (e.g. you could
      end up with sparc64 sans BINFMT_ELF, with select violating
      dependencies, etc.)
      
      Randy Dunlap has spotted some of those; IMO this is simpler than
      his fix, but it depends upon the stuff that would need to be
      backported, so we might end up using his variant for -stable.
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      41026c34
    • Al Viro's avatar
      mips compat: switch to compat_binfmt_elf.c · 0bb87f05
      Al Viro authored
      Like amd64, mips has two 32bit ABIs - o32 and n32.  Unlike amd64,
      it does not use compat_binfmt_elf.c for either of those; each
      of those ABIs has a binfmt handler of its own, both very similar
      to fs/compat_binfmt_elf.c.  And the same technics as we use on
      amd64 can be used to make fs/compat_binfmt_elf.c handle both.
      	* merge elfo32_check_arch() with elfn32_check_arch(),
      make that serve as compat_elf_check_arch().  Note that
      SET_PERSONALITY2() is already the same for all ABI variants -
      it looks at the elf header to choose the flags to set.
      	* add asm/elfcore-compat.h, using the bigger (n32) variant
      of elf32_prstatus as compat_elf_prstatus there.
      	* make PRSTATUS_SIZE() and SET_PR_FPVALID() choose the
      right layout, same as done for amd64.  test_thread_flag(TIF_32BIT_REGS)
      is used as the predicate.
      
      Voila - we are rid of binfmt_elf{n,o}32.c; fs/compat_binfmt_elf.c is
      used, same as for all other ELF-supporting 64bit architectures that
      need 32bit compat.
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      0bb87f05
    • Al Viro's avatar
      mips: don't bother with ELF_CORE_EFLAGS · 2fb33bec
      Al Viro authored
      mips coredumps are regset-based, so ELF_CORE_EFLAGS is not used at all -
      user_..._view.e_flags is.
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      2fb33bec
    • Al Viro's avatar
      mips compat: don't bother with ELF_ET_DYN_BASE · 056f280f
      Al Viro authored
      normal mips one is just fine - it's only used after we'd done
      SET_PERSONALITY2() and by that point TASK_SIZE will yield the
      right value
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      056f280f
    • Al Viro's avatar
      mips: KVM_GUEST makes no sense for 64bit builds... · fd624c71
      Al Viro authored
      it's always been about MIPS32
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      fd624c71
    • Al Viro's avatar
      mips: kill unused definitions in binfmt_elf[on]32.c · c3cd7564
      Al Viro authored
      elf_caddr_t: unused since 2002
      jiffies_to_timeval: unused since 2015
      TASK_SIZE: used only downstream of SET_PERSONALITY2(), and after that
      point the normal definition results in TASK_SIZE32 just fine.
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      c3cd7564
    • Al Viro's avatar
      mips binfmt_elf*32.c: use elfcore-compat.h · 6835501e
      Al Viro authored
      ... rather than duplicating declarations from it.
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      6835501e
    • Al Viro's avatar
      Merge remote-tracking branch 'mips/mips-fixes' into work.elf-compat · 14cfba2e
      Al Viro authored
      backmerge of mips compat coredump fix
      14cfba2e
    • Al Viro's avatar
      x32: make X32, !IA32_EMULATION setups able to execute x32 binaries · 85f2ada7
      Al Viro authored
      It's really trivial - the only wrinkle is making sure that
      compiler knows that ia32-related side of COMPAT_ARCH_DLINFO
      is dead code on such configs (we don't get there without
      having passed compat_elf_check_arch(), and on such configs
      that'll fail for ia32 binary).
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      85f2ada7
    • Al Viro's avatar
      [amd64] clean PRSTATUS_SIZE/SET_PR_FPVALID up properly · 7facdc42
      Al Viro authored
      To get rid of hardcoded size/offset in those macros we need to have
      a definition of i386 variant of struct elf_prstatus.  However, we can't
      do that in asm/compat.h - the types needed for that are not there and
      adding an include of asm/user32.h into asm/compat.h would cause a lot
      of mess.
      
      That could be conveniently done in elfcore-compat.h, but currently there
      is nowhere to put arch-dependent parts of it - no asm/elfcore-compat.h.
      So we introduce a new file (asm/elfcore-compat.h, present on architectures
      that have CONFIG_ARCH_HAS_ELFCORE_COMPAT set, currently only on x86),
      have it pulled by linux/elfcore-compat.h and move the definitions there.
      
      As a side benefit, we don't need to worry about accidental inclusion of
      that file into binfmt_elf.c itself, so we don't need the dance with
      COMPAT_PRSTATUS_SIZE, etc. - only fs/compat_binfmt_elf.c will see
      that header.
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      7facdc42
    • Al Viro's avatar
      elf_prstatus: collect the common part (everything before pr_reg) into a struct · f2485a2d
      Al Viro authored
      Preparations to doing i386 compat elf_prstatus sanely - rather than duplicating
      the beginning of compat_elf_prstatus, take these fields into a separate
      structure (compat_elf_prstatus_common), so that it could be reused.  Due to
      the incestous relationship between binfmt_elf.c and compat_binfmt_elf.c we
      need the same shape change done to native struct elf_prstatus, gathering the
      fields prior to pr_reg into a new structure (struct elf_prstatus_common).
      
      Fortunately, offset of pr_reg is always a multiple of 16 with no padding
      right before it, so it's possible to turn all the stuff prior to it into
      a single member without disturbing the layout.
      
      [build fix from Geert Uytterhoeven folded in]
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      f2485a2d
  2. 04 Jan, 2021 1 commit
    • Al Viro's avatar
      binfmt_elf: partially sanitize PRSTATUS_SIZE and SET_PR_FPVALID · 8a00dd00
      Al Viro authored
      On 64bit architectures that support 32bit processes there are
      two possible layouts for NT_PRSTATUS note in ELF coredumps.
      For one thing, several fields are 64bit for native processes
      and 32bit for compat ones (pr_sigpend, etc.).  For another,
      the register dump is obviously different - the size and number
      of registers are not going to be the same for 32bit and 64bit
      variants of processor.
      
      Usually that's handled by having two structures - elf_prstatus
      for native layout and compat_elf_prstatus for 32bit one.
      32bit processes are handled by fs/compat_binfmt_elf.c, which
      defines a macro called 'elf_prstatus' that expands to compat_elf_prstatus.
      Then it includes fs/binfmt_elf.c, which makes all references to
      struct elf_prstatus to be textually replaced with struct
      compat_elf_prstatus.  Ugly and somewhat brittle, but it works.
      
      However, amd64 is worse - there are _three_ possible layouts.
      One for native 64bit processes, another for i386 (32bit) processes
      and yet another for x32 (32bit address space with full 64bit
      registers).
      
      Both i386 and x32 processes are handled by fs/compat_binfmt_elf.c,
      with usual compat_binfmt_elf.c trickery.  However, the layouts
      for i386 and x32 are not identical - they have the common beginning,
      but the register dump part (pr_reg) is bigger on x32.  Worse, pr_reg
      is not the last field - it's followed by int pr_fpvalid, so that
      field ends up at different offsets for i386 and x32 layouts.
      
      Fortunately, there's not much code that cares about any of that -
      it's all encapsulated in fill_thread_core_info().  Since x32
      variant is bigger, we define compat_elf_prstatus to match that
      layout.  That way i386 processes have enough space to fit
      their layout into.
      
      Moreover, since these layouts are identical prior to pr_reg,
      we don't need to distinguish x32 and i386 cases when we are
      setting the fields prior to pr_reg.
      
      Filling pr_reg itself is done by calling ->get() method of
      appropriate regset, and that method knows what layout (and size)
      to use.
      
      We do need to distinguish x32 and i386 cases only for two
      things: setting ->pr_fpvalid (offset differs for x32 and
      i386) and choosing the right size for our note.
      
      The way it's done is Not Nice, for the lack of more accurate
      printable description.  There are two macros (PRSTATUS_SIZE and
      SET_PR_FPVALID), that default essentially to sizeof(struct elf_prstatus)
      and (S)->pr_fpvalid = 1.  On x86 asm/compat.h provides its own
      variants.
      
      Unfortunately, quite a few things go wrong there:
      	* PRSTATUS_SIZE doesn't use the normal test for process
      being an x32 one; it compares the size reported by regset with
      the size of pr_reg.
      	* it hardcodes the sizes of x32 and i386 variants (296 and 144
      resp.), so if some change in includes leads to asm/compat.h pulled
      in by fs/binfmt_elf.c we are in trouble - it will end up using
      the size of x32 variant for 64bit processes.
      	* it's in the wrong place; asm/compat.h couldn't define
      the structure for i386 layout, since it lacks quite a few types
      needed for it.  Hardcoded sizes are largely due to that.
      
      The proper fix would be to have an explicitly defined i386 variant
      of structure and have PRSTATUS_SIZE/SET_PR_FPVALID check for
      TIF_X32 to choose the variant that should be used.  Unfortunately,
      that requires some manipulations of headers; we'll do that later
      in the series, but for now let's go with the minimal variant -
      rename PRSTATUS_SIZE in asm/compat.h to COMPAT_PRSTATUS_SIZE,
      have fs/compat_binfmt_elf.c define PRSTATUS_SIZE to COMPAT_PRSTATUS_SIZE
      and use the normal TIF_X32 check in that macro.  The size of i386 variant
      is kept hardcoded for now.  Similar story for SET_PR_FPVALID.
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      8a00dd00
  3. 28 Dec, 2020 2 commits
  4. 27 Dec, 2020 8 commits
  5. 26 Dec, 2020 5 commits
  6. 25 Dec, 2020 5 commits
    • Linus Torvalds's avatar
      drm/amd/display: avoid uninitialized variable warning · 61d79136
      Linus Torvalds authored
      clang (quite rightly) complains fairly loudly about the newly added
      mpc1_get_mpc_out_mux() function returning an uninitialized value if the
      'opp_id' checks don't pass.
      
      This may not happen in practice, but the code really shouldn't return
      garbage if the sanity checks don't pass.
      
      So just initialize 'val' to zero to avoid the issue.
      
      Fixes: 110b055b ("drm/amd/display: add getter routine to retrieve mpcc mux")
      Cc: Josip Pavic <Josip.Pavic@amd.com>
      Cc: Bindu Ramamurthy <bindu.r@amd.com>
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      61d79136
    • Linus Torvalds's avatar
      Merge tag 'perf-tools-2020-12-24' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux · 5814bc2d
      Linus Torvalds authored
      Pull more perf tools updates from Arnaldo Carvalho de Melo:
      
       - Refactor 'perf stat' per CPU/socket/die/thread aggregation fixing use
         cases in ARM machines.
      
       - Fix memory leak when synthesizing SDT probes in 'perf probe'.
      
       - Update kernel header copies related to KVM, epol_pwait. msr-index and
         powerpc and s390 syscall tables.
      
      * tag 'perf-tools-2020-12-24' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux: (24 commits)
        perf probe: Fix memory leak when synthesizing SDT probes
        perf stat aggregation: Add separate thread member
        perf stat aggregation: Add separate core member
        perf stat aggregation: Add separate die member
        perf stat aggregation: Add separate socket member
        perf stat aggregation: Add separate node member
        perf stat aggregation: Start using cpu_aggr_id in map
        perf cpumap: Drop in cpu_aggr_map struct
        perf cpumap: Add new map type for aggregation
        perf stat: Replace aggregation ID with a struct
        perf cpumap: Add new struct for cpu aggregation
        perf cpumap: Use existing allocator to avoid using malloc
        perf tests: Improve topology test to check all aggregation types
        perf tools: Update s390's syscall.tbl copy from the kernel sources
        perf tools: Update powerpc's syscall.tbl copy from the kernel sources
        perf s390: Move syscall.tbl check into check-headers.sh
        perf powerpc: Move syscall.tbl check to check-headers.sh
        tools headers UAPI: Synch KVM's svm.h header with the kernel
        tools kvm headers: Update KVM headers from the kernel sources
        tools headers UAPI: Sync KVM's vmx.h header with the kernel sources
        ...
      5814bc2d
    • Linus Torvalds's avatar
      Merge branch 'for-5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/jlawall/linux · 42dc45e8
      Linus Torvalds authored
      Pull coccinelle updates from Julia Lawall.
      
      * 'for-5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/jlawall/linux:
        scripts: coccicheck: Correct usage of make coccicheck
        coccinelle: update expiring email addresses
        coccinnelle: Remove ptr_ret script
        kbuild: do not use scripts/ld-version.sh for checking spatch version
        remove boolinit.cocci
      42dc45e8
    • Michael Ellerman's avatar
      genirq: Fix export of irq_to_desc() for powerpc KVM · 11cc92eb
      Michael Ellerman authored
      Commit 64a1b95b ("genirq: Restrict export of irq_to_desc()") removed
      the export of irq_to_desc() unless powerpc KVM is being built, because
      there is still a use of irq_to_desc() in modular code there.
      
      However it used:
      
        #ifdef CONFIG_KVM_BOOK3S_64_HV
      
      Which doesn't work when that symbol is =m, leading to a build failure:
      
        ERROR: modpost: "irq_to_desc" [arch/powerpc/kvm/kvm-hv.ko] undefined!
      
      Fix it by checking for the definedness of the correct symbol which is
      CONFIG_KVM_BOOK3S_64_HV_MODULE.
      
      Fixes: 64a1b95b ("genirq: Restrict export of irq_to_desc()")
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      11cc92eb
    • Linus Torvalds's avatar
      Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs · 7bb5226c
      Linus Torvalds authored
      Pull misc vfs updates from Al Viro:
       "Assorted patches from previous cycle(s)..."
      
      * 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
        fix hostfs_open() use of ->f_path.dentry
        Make sure that make_create_in_sticky() never sees uninitialized value of dir_mode
        fs: Kill DCACHE_DONTCACHE dentry even if DCACHE_REFERENCED is set
        fs: Handle I_DONTCACHE in iput_final() instead of generic_drop_inode()
        fs/namespace.c: WARN if mnt_count has become negative
      7bb5226c
  7. 24 Dec, 2020 6 commits
    • Linus Torvalds's avatar
      Merge tag 'docs-5.11-2' of git://git.lwn.net/linux · 71c5f031
      Linus Torvalds authored
      Pull documentation fixes from Jonathan Corbet:
       "A small set of late-arriving, small documentation fixes"
      
      * tag 'docs-5.11-2' of git://git.lwn.net/linux:
        docs: admin-guide: Fix default value of max_map_count in sysctl/vm.rst
        Documentation/submitting-patches: Document the SoB chain
        Documentation: process: Correct numbering
        docs: submitting-patches: Trivial - fix grammatical error
      71c5f031
    • Linus Torvalds's avatar
      Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4 · 555a6e8c
      Linus Torvalds authored
      Pull ext4 updates from Ted Ts'o:
       "Various bug fixes and cleanups for ext4; no new features this cycle"
      
      * tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: (29 commits)
        ext4: remove unnecessary wbc parameter from ext4_bio_write_page
        ext4: avoid s_mb_prefetch to be zero in individual scenarios
        ext4: defer saving error info from atomic context
        ext4: simplify ext4 error translation
        ext4: move functions in super.c
        ext4: make ext4_abort() use __ext4_error()
        ext4: standardize error message in ext4_protect_reserved_inode()
        ext4: remove redundant sb checksum recomputation
        ext4: don't remount read-only with errors=continue on reboot
        ext4: fix deadlock with fs freezing and EA inodes
        jbd2: add a helper to find out number of fast commit blocks
        ext4: make fast_commit.h byte identical with e2fsprogs/fast_commit.h
        ext4: fix fall-through warnings for Clang
        ext4: add docs about fast commit idempotence
        ext4: remove the unused EXT4_CURRENT_REV macro
        ext4: fix an IS_ERR() vs NULL check
        ext4: check for invalid block size early when mounting a file system
        ext4: fix a memory leak of ext4_free_data
        ext4: delete nonsensical (commented-out) code inside ext4_xattr_block_set()
        ext4: update ext4_data_block_valid related comments
        ...
      555a6e8c
    • Linus Torvalds's avatar
      Merge tag 'Smack-for-5.11-io_uring-fix' of git://github.com/cschaufler/smack-next · 2f2fce3d
      Linus Torvalds authored
      Pull smack fix from Casey Schaufler:
       "Provide a fix for the incorrect handling of privilege in the face of
        io_uring's use of kernel threads. That invalidated an long standing
        assumption regarding the privilege of kernel threads.
      
        The fix is simple and safe. It was provided by Jens Axboe and has been
        tested"
      
      * tag 'Smack-for-5.11-io_uring-fix' of git://github.com/cschaufler/smack-next:
        Smack: Handle io_uring kernel thread privileges
      2f2fce3d
    • Linus Torvalds's avatar
      Merge tag 'riscv-for-linus-5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux · 7a2fde8d
      Linus Torvalds authored
      Pull RISC-V fix from Palmer Dabbelt
       "Avoid trying to initialize memory regions outside the usable range"
      
      * tag 'riscv-for-linus-5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
        RISC-V: Fix usage of memblock_enforce_memory_limit
      7a2fde8d
    • Linus Torvalds's avatar
      Merge tag 'powerpc-5.11-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux · 9b3f7f1b
      Linus Torvalds authored
      Pull powerpc fixes from Michael Ellerman:
      
       - Four commits fixing various things in the new C VDSO code
      
       - One fix for a 32-bit VMAP stack bug
      
       - Two minor build fixes
      
      Thanks to Cédric Le Goater, Christophe Leroy, and Will Springer.
      
      * tag 'powerpc-5.11-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
        powerpc/32: Fix vmap stack - Properly set r1 before activating MMU on syscall too
        powerpc/vdso: Fix DOTSYM for 32-bit LE VDSO
        powerpc/vdso: Don't pass 64-bit ABI cflags to 32-bit VDSO
        powerpc/vdso: Block R_PPC_REL24 relocations
        powerpc/smp: Add __init to init_big_cores()
        powerpc/time: Force inlining of get_tb()
        powerpc/boot: Fix build of dts/fsl
      9b3f7f1b
    • Linus Torvalds's avatar
      Merge tag 'irq-core-2020-12-23' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 3913d00a
      Linus Torvalds authored
      Pull irq updates from Thomas Gleixner:
       "This is the second attempt after the first one failed miserably and
        got zapped to unblock the rest of the interrupt related patches.
      
        A treewide cleanup of interrupt descriptor (ab)use with all sorts of
        racy accesses, inefficient and disfunctional code. The goal is to
        remove the export of irq_to_desc() to prevent these things from
        creeping up again"
      
      * tag 'irq-core-2020-12-23' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (30 commits)
        genirq: Restrict export of irq_to_desc()
        xen/events: Implement irq distribution
        xen/events: Reduce irq_info:: Spurious_cnt storage size
        xen/events: Only force affinity mask for percpu interrupts
        xen/events: Use immediate affinity setting
        xen/events: Remove disfunct affinity spreading
        xen/events: Remove unused bind_evtchn_to_irq_lateeoi()
        net/mlx5: Use effective interrupt affinity
        net/mlx5: Replace irq_to_desc() abuse
        net/mlx4: Use effective interrupt affinity
        net/mlx4: Replace irq_to_desc() abuse
        PCI: mobiveil: Use irq_data_get_irq_chip_data()
        PCI: xilinx-nwl: Use irq_data_get_irq_chip_data()
        NTB/msi: Use irq_has_action()
        mfd: ab8500-debugfs: Remove the racy fiddling with irq_desc
        pinctrl: nomadik: Use irq_has_action()
        drm/i915/pmu: Replace open coded kstat_irqs() copy
        drm/i915/lpe_audio: Remove pointless irq_to_desc() usage
        s390/irq: Use irq_desc_kstat_cpu() in show_msi_interrupt()
        parisc/irq: Use irq_desc_kstat_cpu() in show_interrupts()
        ...
      3913d00a