1. 16 Apr, 2020 3 commits
  2. 14 Apr, 2020 28 commits
    • Linus Torvalds's avatar
      Merge tag 'hyperv-fixes-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux · 8632e9b5
      Linus Torvalds authored
      Pull hyperv fixes from Wei Liu:
      
       - a series from Tianyu Lan to fix crash reporting on Hyper-V
      
       - three miscellaneous cleanup patches
      
      * tag 'hyperv-fixes-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/hyperv/linux:
        x86/Hyper-V: Report crash data in die() when panic_on_oops is set
        x86/Hyper-V: Report crash register data when sysctl_record_panic_msg is not set
        x86/Hyper-V: Report crash register data or kmsg before running crash kernel
        x86/Hyper-V: Trigger crash enlightenment only once during system crash.
        x86/Hyper-V: Free hv_panic_page when fail to register kmsg dump
        x86/Hyper-V: Unload vmbus channel in hv panic callback
        x86: hyperv: report value of misc_features
        hv_debugfs: Make hv_debug_root static
        hv: hyperv_vmbus.h: Replace zero-length array with flexible-array member
      8632e9b5
    • Linus Torvalds's avatar
      Merge tag 'for-5.7-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux · 6cc9306b
      Linus Torvalds authored
      Pull btrfs fixes from David Sterba:
       "We have a few regressions and one fix for stable:
      
         - revert fsync optimization
      
         - fix lost i_size update
      
         - fix a space accounting leak
      
         - build fix, add back definition of a deprecated ioctl flag
      
         - fix search condition for old roots in relocation"
      
      * tag 'for-5.7-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
        btrfs: re-instantiate the removed BTRFS_SUBVOL_CREATE_ASYNC definition
        btrfs: fix reclaim counter leak of space_info objects
        btrfs: make full fsyncs always operate on the entire file again
        btrfs: fix lost i_size update after cloning inline extent
        btrfs: check commit root generation in should_ignore_root
      6cc9306b
    • Linus Torvalds's avatar
      Merge tag 'afs-fixes-20200413' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs · f4cd6668
      Linus Torvalds authored
      Pull AFS fixes from David Howells:
      
       - Fix the decoding of fetched file status records so that the xdr
         pointer is advanced under all circumstances.
      
       - Fix the decoding of a fetched file status record that indicates an
         inline abort (ie. an error) so that it sets the flag saying the
         decoder stored the abort code.
      
       - Fix the decoding of the result of the rename operation so that it
         doesn't skip the decoding of the second fetched file status (ie. that
         of the dest dir) in the case that the source and dest dirs were the
         same as this causes the xdr pointer not to be advanced, leading to
         incorrect decoding of subsequent parts of the reply.
      
       - Fix the dump of a bad YFSFetchStatus record to dump the full length.
      
       - Fix a race between local editing of directory contents and accessing
         the dir for reading or d_revalidate by using the same lock in both.
      
       - Fix afs_d_revalidate() to not accidentally reverse the version on a
         dentry when it's meant to be bringing it forward.
      
      * tag 'afs-fixes-20200413' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs:
        afs: Fix afs_d_validate() to set the right directory version
        afs: Fix race between post-modification dir edit and readdir/d_revalidate
        afs: Fix length of dump of bad YFSFetchStatus record
        afs: Fix rename operation status delivery
        afs: Fix decoding of inline abort codes from version 1 status records
        afs: Fix missing XDR advance in xdr_decode_{AFS,YFS}FSFetchStatus()
      f4cd6668
    • Arnaldo Carvalho de Melo's avatar
      tools headers: Synchronize linux/bits.h with the kernel sources · e3698b23
      Arnaldo Carvalho de Melo authored
      To pick up the changes in these csets:
      
        295bcca8 ("linux/bits.h: add compile time sanity check of GENMASK inputs")
        3945ff37 ("linux/bits.h: Extract common header for vDSO")
      
      To address this tools/perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/linux/bits.h' differs from latest version at 'include/linux/bits.h'
        diff -u tools/include/linux/bits.h include/linux/bits.h
      
      This clashes with usage of userspace's static_assert(), that, at least
      on glibc, is guarded by a ifnded/endif pair, do the same to our copy of
      build_bug.h and avoid that diff in check_headers.sh so that we continue
      checking for drifts with the kernel sources master copy.
      
      This will all be tested with the set of build containers that includes
      uCLibc, musl libc, lots of glibc versions in lots of distros and cross
      build environments.
      
      The tools/objtool, tools/bpf, etc were tested as well.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Rikard Falkeborn <rikard.falkeborn@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e3698b23
    • Arnaldo Carvalho de Melo's avatar
      tools headers: Adopt verbatim copy of compiletime_assert() from kernel sources · 5b992add
      Arnaldo Carvalho de Melo authored
      Will be needed when syncing the linux/bits.h header, in the next cset.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5b992add
    • Arnaldo Carvalho de Melo's avatar
      tools headers: Update x86's syscall_64.tbl with the kernel sources · d8ed4d7a
      Arnaldo Carvalho de Melo authored
      To pick the changes from:
      
        d3b1b776 ("x86/entry/64: Remove ptregs qualifier from syscall table")
        cab56d34 ("x86/entry: Remove ABI prefixes from functions in syscall tables")
        27dd84fa ("x86/entry/64: Use syscall wrappers for x32_rt_sigreturn")
      
      Addressing this tools/perf build warning:
      
        Warning: Kernel ABI header at 'tools/perf/arch/x86/entry/syscalls/syscall_64.tbl' differs from latest version at 'arch/x86/entry/syscalls/syscall_64.tbl'
        diff -u tools/perf/arch/x86/entry/syscalls/syscall_64.tbl arch/x86/entry/syscalls/syscall_64.tbl
      
      That didn't result in any tooling changes, as what is extracted are just
      the first two columns, and these patches touched only the third.
      
        $ cp /tmp/build/perf/arch/x86/include/generated/asm/syscalls_64.c /tmp
        $ cp arch/x86/entry/syscalls/syscall_64.tbl tools/perf/arch/x86/entry/syscalls/syscall_64.tbl
        $ make -C tools/perf O=/tmp/build/perf install-bin
        make: Entering directory '/home/acme/git/perf/tools/perf'
          BUILD:   Doing 'make -j12' parallel build
          DESCEND  plugins
          CC       /tmp/build/perf/util/syscalltbl.o
          INSTALL  trace_plugins
          LD       /tmp/build/perf/util/perf-in.o
          LD       /tmp/build/perf/perf-in.o
          LINK     /tmp/build/perf/perf
        $ diff -u /tmp/build/perf/arch/x86/include/generated/asm/syscalls_64.c /tmp/syscalls_64.c
        $
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d8ed4d7a
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Sync drm/i915_drm.h with the kernel sources · 54a58ebc
      Arnaldo Carvalho de Melo authored
      To pick the change in:
      
        88be76cd ("drm/i915: Allow userspace to specify ringsize on construction")
      
      That don't result in any changes in tooling, just silences this perf
      build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/drm/i915_drm.h' differs from latest version at 'include/uapi/drm/i915_drm.h'
        diff -u tools/include/uapi/drm/i915_drm.h include/uapi/drm/i915_drm.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Chris Wilson <chris@chris-wilson.co.uk>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      54a58ebc
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Update tools's copy of drm.h headers · 0719bdf4
      Arnaldo Carvalho de Melo authored
      Picking the changes from:
      
        455e00f1 ("drm: Add getfb2 ioctl")
      
      Silencing these perf build warnings:
      
        Warning: Kernel ABI header at 'tools/include/uapi/drm/drm.h' differs from latest version at 'include/uapi/drm/drm.h'
        diff -u tools/include/uapi/drm/drm.h include/uapi/drm/drm.h
      
      Now 'perf trace' and other code that might use the
      tools/perf/trace/beauty autogenerated tables will be able to translate
      this new ioctl code into a string:
      
        $ tools/perf/trace/beauty/drm_ioctl.sh > before
        $ cp include/uapi/drm/drm.h tools/include/uapi/drm/drm.h
        $ tools/perf/trace/beauty/drm_ioctl.sh > after
        $ diff -u before after
        --- before	2020-04-14 09:28:45.461821077 -0300
        +++ after	2020-04-14 09:28:53.594782685 -0300
        @@ -107,6 +107,7 @@
         	[0xCB] = "SYNCOBJ_QUERY",
         	[0xCC] = "SYNCOBJ_TRANSFER",
         	[0xCD] = "SYNCOBJ_TIMELINE_SIGNAL",
        +	[0xCE] = "MODE_GETFB2",
         	[DRM_COMMAND_BASE + 0x00] = "I915_INIT",
         	[DRM_COMMAND_BASE + 0x01] = "I915_FLUSH",
         	[DRM_COMMAND_BASE + 0x02] = "I915_FLIP",
        $
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Daniel Stone <daniels@collabora.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Lyude Paul <lyude@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0719bdf4
    • Arnaldo Carvalho de Melo's avatar
      tools headers kvm: Sync linux/kvm.h with the kernel sources · b8fc2280
      Arnaldo Carvalho de Melo authored
      To pick up the changes from:
      
        9a5788c6 ("KVM: PPC: Book3S HV: Add a capability for enabling secure guests")
        3c9bd400 ("KVM: x86: enable dirty log gradually in small chunks")
        13da9ae1 ("KVM: s390: protvirt: introduce and enable KVM_CAP_S390_PROTECTED")
        e0d2773d ("KVM: s390: protvirt: UV calls in support of diag308 0, 1")
        19e12277 ("KVM: S390: protvirt: Introduce instruction data area bounce buffer")
        29b40f10 ("KVM: s390: protvirt: Add initial vm and cpu lifecycle handling")
      
      So far we're ignoring those arch specific ioctls, we need to revisit
      this at some time to have arch specific tables, etc:
      
        $ grep S390 tools/perf/trace/beauty/kvm_ioctl.sh
            egrep -v " ((ARM|PPC|S390)_|[GS]ET_(DEBUGREGS|PIT2|XSAVE|TSC_KHZ)|CREATE_SPAPR_TCE_64)" | \
        $
      
      This addresses these tools/perf build warnings:
      
        Warning: Kernel ABI header at 'tools/arch/arm/include/uapi/asm/kvm.h' differs from latest version at 'arch/arm/include/uapi/asm/kvm.h'
        diff -u tools/arch/arm/include/uapi/asm/kvm.h arch/arm/include/uapi/asm/kvm.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: Janosch Frank <frankja@linux.ibm.com>
      Cc: Jay Zhou <jianjay.zhou@huawei.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Paul Mackerras <paulus@ozlabs.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b8fc2280
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Sync linux/fscrypt.h with the kernel sources · 1abcb9d9
      Arnaldo Carvalho de Melo authored
      To pick the changes from:
      
        e98ad464 ("fscrypt: add FS_IOC_GET_ENCRYPTION_NONCE ioctl")
      
      That don't trigger any changes in tooling.
      
      This silences this perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/fscrypt.h' differs from latest version at 'include/uapi/linux/fscrypt.h'
        diff -u tools/include/uapi/linux/fscrypt.h include/uapi/linux/fscrypt.h
      
      In time we should come up with something like:
      
        $ tools/perf/trace/beauty/fsconfig.sh
        static const char *fsconfig_cmds[] = {
        	[0] = "SET_FLAG",
        	[1] = "SET_STRING",
        	[2] = "SET_BINARY",
        	[3] = "SET_PATH",
        	[4] = "SET_PATH_EMPTY",
        	[5] = "SET_FD",
        	[6] = "CMD_CREATE",
        	[7] = "CMD_RECONFIGURE",
        };
        $
      
      And:
      
        $ tools/perf/trace/beauty/drm_ioctl.sh | head
        #ifndef DRM_COMMAND_BASE
        #define DRM_COMMAND_BASE                0x40
        #endif
        static const char *drm_ioctl_cmds[] = {
        	[0x00] = "VERSION",
        	[0x01] = "GET_UNIQUE",
        	[0x02] = "GET_MAGIC",
        	[0x03] = "IRQ_BUSID",
        	[0x04] = "GET_MAP",
        	[0x05] = "GET_CLIENT",
        $
      
      For fscrypt's ioctls.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Eric Biggers <ebiggers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1abcb9d9
    • Arnaldo Carvalho de Melo's avatar
      tools include UAPI: Sync linux/vhost.h with the kernel sources · 3df4d4bf
      Arnaldo Carvalho de Melo authored
      To get the changes in:
      
        4c8cf318 ("vhost: introduce vDPA-based backend")
      
      Silencing this perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/vhost.h' differs from latest version at 'include/uapi/linux/vhost.h'
        diff -u tools/include/uapi/linux/vhost.h include/uapi/linux/vhost.h
      
      This automatically picks these new ioctls, making tools such as 'perf
      trace' aware of them and possibly allowing to use the strings in
      filters, etc:
      
        $ tools/perf/trace/beauty/vhost_virtio_ioctl.sh > before
        $ cp include/uapi/linux/vhost.h tools/include/uapi/linux/vhost.h
        $ tools/perf/trace/beauty/vhost_virtio_ioctl.sh > after
        $ diff -u before after
        --- before	2020-04-14 09:12:28.559748968 -0300
        +++ after	2020-04-14 09:12:38.781696242 -0300
        @@ -24,9 +24,16 @@
         	[0x44] = "SCSI_GET_EVENTS_MISSED",
         	[0x60] = "VSOCK_SET_GUEST_CID",
         	[0x61] = "VSOCK_SET_RUNNING",
        +	[0x72] = "VDPA_SET_STATUS",
        +	[0x74] = "VDPA_SET_CONFIG",
        +	[0x75] = "VDPA_SET_VRING_ENABLE",
         };
         static const char *vhost_virtio_ioctl_read_cmds[] = {
         	[0x00] = "GET_FEATURES",
         	[0x12] = "GET_VRING_BASE",
         	[0x26] = "GET_BACKEND_FEATURES",
        +	[0x70] = "VDPA_GET_DEVICE_ID",
        +	[0x71] = "VDPA_GET_STATUS",
        +	[0x73] = "VDPA_GET_CONFIG",
        +	[0x76] = "VDPA_GET_VRING_NUM",
         };
        $
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Tiwei Bie <tiwei.bie@intel.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      3df4d4bf
    • Arnaldo Carvalho de Melo's avatar
      tools arch x86: Sync asm/cpufeatures.h with the kernel sources · e00a2d90
      Arnaldo Carvalho de Melo authored
      To pick up the changes from:
      
        077168e2 ("x86/mce/amd: Add PPIN support for AMD MCE")
        753039ef ("x86/cpu/amd: Call init_amd_zn() om Family 19h processors too")
        6650cdd9 ("x86/split_lock: Enable split lock detection by kernel")
      
      These don't cause any changes in tooling, just silences this perf build
      warning:
      
        Warning: Kernel ABI header at 'tools/arch/x86/include/asm/cpufeatures.h' differs from latest version at 'arch/x86/include/asm/cpufeatures.h'
        diff -u tools/arch/x86/include/asm/cpufeatures.h arch/x86/include/asm/cpufeatures.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Kim Phillips <kim.phillips@amd.com>
      Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Wei Huang <wei.huang2@amd.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e00a2d90
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Sync linux/mman.h with the kernel · f60b3878
      Arnaldo Carvalho de Melo authored
      To get the changes in:
      
        e346b381 ("mm/mremap: add MREMAP_DONTUNMAP to mremap()")
      
      Add that to 'perf trace's mremap 'flags' decoder.
      
      This silences this perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/mman.h' differs from latest version at 'include/uapi/linux/mman.h'
        diff -u tools/include/uapi/linux/mman.h include/uapi/linux/mman.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Brian Geffon <bgeffon@google.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f60b3878
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Sync sched.h with the kernel · 027fa8fb
      Arnaldo Carvalho de Melo authored
      To get the changes in:
      
        ef2c41cf ("clone3: allow spawning processes into cgroups")
      
      Add that to 'perf trace's clone 'flags' decoder.
      
      This silences this perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/sched.h' differs from latest version at 'include/uapi/linux/sched.h'
        diff -u tools/include/uapi/linux/sched.h include/uapi/linux/sched.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Christian Brauner <christian.brauner@ubuntu.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Tejun Heo <tj@kernel.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      027fa8fb
    • Arnaldo Carvalho de Melo's avatar
      tools headers: Update linux/vdso.h and grab a copy of vdso/const.h · ca64d84e
      Arnaldo Carvalho de Melo authored
      To get in line with:
      
        8165b57b ("linux/const.h: Extract common header for vDSO")
      
      And silence this tools/perf/ build warning:
      
        Warning: Kernel ABI header at 'tools/include/linux/const.h' differs from latest version at 'include/linux/const.h'
        diff -u tools/include/linux/const.h include/linux/const.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ca64d84e
    • Jin Yao's avatar
      perf stat: Fix no metric header if --per-socket and --metric-only set · 8358f698
      Jin Yao authored
      We received a report that was no metric header displayed if --per-socket
      and --metric-only were both set.
      
      It's hard for script to parse the perf-stat output. This patch fixes this
      issue.
      
      Before:
      
        root@kbl-ppc:~# perf stat -a -M CPI --metric-only --per-socket
        ^C
         Performance counter stats for 'system wide':
      
        S0        8                  2.6
      
               2.215270071 seconds time elapsed
      
        root@kbl-ppc:~# perf stat -a -M CPI --metric-only --per-socket -I1000
        #           time socket cpus
             1.000411692 S0        8                  2.2
             2.001547952 S0        8                  3.4
             3.002446511 S0        8                  3.4
             4.003346157 S0        8                  4.0
             5.004245736 S0        8                  0.3
      
      After:
      
        root@kbl-ppc:~# perf stat -a -M CPI --metric-only --per-socket
        ^C
         Performance counter stats for 'system wide':
      
                                     CPI
        S0        8                  2.1
      
               1.813579830 seconds time elapsed
      
        root@kbl-ppc:~# perf stat -a -M CPI --metric-only --per-socket -I1000
        #           time socket cpus                  CPI
             1.000415122 S0        8                  3.2
             2.001630051 S0        8                  2.9
             3.002612278 S0        8                  4.3
             4.003523594 S0        8                  3.0
             5.004504256 S0        8                  3.7
      Signed-off-by: default avatarJin Yao <yao.jin@linux.intel.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Kan Liang <kan.liang@linux.intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lore.kernel.org/lkml/20200331180226.25915-1-yao.jin@linux.intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8358f698
    • Arnaldo Carvalho de Melo's avatar
      perf python: Check if clang supports -fno-semantic-interposition · 9a00df31
      Arnaldo Carvalho de Melo authored
      The set of C compiler options used by distros to build python bindings
      may include options that are unknown to clang, we check for a variety of
      such options, add -fno-semantic-interposition to that mix:
      
      This fixes the build on, among others, Manjaro Linux:
      
          GEN      /tmp/build/perf/python/perf.so
        clang-9: error: unknown argument: '-fno-semantic-interposition'
        error: command 'clang' failed with exit status 1
        make: Leaving directory '/git/perf/tools/perf'
      
        [perfbuilder@602aed1c266d ~]$ gcc -v
        Using built-in specs.
        COLLECT_GCC=gcc
        COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/lto-wrapper
        Target: x86_64-pc-linux-gnu
        Configured with: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-pkgversion='Arch Linux 9.3.0-1' --with-bugurl=https://bugs.archlinux.org/ --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++,d --enable-shared --enable-threads=posix --with-system-zlib --with-isl --enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty --with-linker-hash-style=gnu --enable-gnu-indirect-function --enable-multilib --disable-werror --enable-checking=release --enable-default-pie --enable-default-ssp --enable-cet=auto gdc_include_dir=/usr/include/dlang/gdc
        Thread model: posix
        gcc version 9.3.0 (Arch Linux 9.3.0-1)
        [perfbuilder@602aed1c266d ~]$
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      9a00df31
    • Arnaldo Carvalho de Melo's avatar
      tools arch x86: Sync the msr-index.h copy with the kernel sources · bab1a501
      Arnaldo Carvalho de Melo authored
      To pick up the changes in:
      
        6650cdd9 ("x86/split_lock: Enable split lock detection by kernel")
      
        Warning: Kernel ABI header at 'tools/arch/x86/include/asm/msr-index.h' differs from latest version at 'arch/x86/include/asm/msr-index.h'
        diff -u tools/arch/x86/include/asm/msr-index.h arch/x86/include/asm/msr-index.h
      
      Which causes these changes in tooling:
      
        $ tools/perf/trace/beauty/tracepoints/x86_msr.sh > before
        $ cp arch/x86/include/asm/msr-index.h tools/arch/x86/include/asm/msr-index.h
        $ tools/perf/trace/beauty/tracepoints/x86_msr.sh > after
        $ diff -u before after
        --- before	2020-04-01 12:11:14.789344795 -0300
        +++ after	2020-04-01 12:11:56.907798879 -0300
        @@ -10,6 +10,7 @@
         	[0x00000029] = "KNC_EVNTSEL1",
         	[0x0000002a] = "IA32_EBL_CR_POWERON",
         	[0x0000002c] = "EBC_FREQUENCY_ID",
        +	[0x00000033] = "TEST_CTRL",
         	[0x00000034] = "SMI_COUNT",
         	[0x0000003a] = "IA32_FEAT_CTL",
         	[0x0000003b] = "IA32_TSC_ADJUST",
        @@ -27,6 +28,7 @@
         	[0x000000c2] = "IA32_PERFCTR1",
         	[0x000000cd] = "FSB_FREQ",
         	[0x000000ce] = "PLATFORM_INFO",
        +	[0x000000cf] = "IA32_CORE_CAPS",
         	[0x000000e2] = "PKG_CST_CONFIG_CONTROL",
         	[0x000000e7] = "IA32_MPERF",
         	[0x000000e8] = "IA32_APERF",
        $
      
        $ make -C tools/perf O=/tmp/build/perf install-bin
        <SNIP>
          CC       /tmp/build/perf/trace/beauty/tracepoints/x86_msr.o
          LD       /tmp/build/perf/trace/beauty/tracepoints/perf-in.o
          LD       /tmp/build/perf/trace/beauty/perf-in.o
          LD       /tmp/build/perf/perf-in.o
          LINK     /tmp/build/perf/perf
        <SNIP>
      
      Now one can do:
      
      	perf trace -e msr:* --filter=msr==IA32_CORE_CAPS
      
      or:
      
      	perf trace -e msr:* --filter='msr==IA32_CORE_CAPS || msr==TEST_CTRL'
      
      And see only those MSRs being accessed via:
      
        # perf trace -v -e msr:* --filter='msr==IA32_CORE_CAPS || msr==TEST_CTRL'
        New filter for msr:read_msr: (msr==0xcf || msr==0x33) && (common_pid != 8263 && common_pid != 23250)
        New filter for msr:write_msr: (msr==0xcf || msr==0x33) && (common_pid != 8263 && common_pid != 23250)
        New filter for msr:rdpmc: (msr==0xcf || msr==0x33) && (common_pid != 8263 && common_pid != 23250)
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lore.kernel.org/lkml/20200401153325.GC12534@kernel.org/Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      bab1a501
    • Ard Biesheuvel's avatar
      efi/x86: Revert struct layout change to fix kexec boot regression · a088b858
      Ard Biesheuvel authored
      Commit
      
        0a67361d ("efi/x86: Remove runtime table address from kexec EFI setup data")
      
      removed the code that retrieves the non-remapped UEFI runtime services
      pointer from the data structure provided by kexec, as it was never really
      needed on the kexec boot path: mapping the runtime services table at its
      non-remapped address is only needed when calling SetVirtualAddressMap(),
      which never happens during a kexec boot in the first place.
      
      However, dropping the 'runtime' member from struct efi_setup_data was a
      mistake. That struct is shared ABI between the kernel and the kexec tooling
      for x86, and so we cannot simply change its layout. So let's put back the
      removed field, but call it 'unused' to reflect the fact that we never look
      at its contents. While at it, add a comment to remind our future selves
      that the layout is external ABI.
      
      Fixes: 0a67361d ("efi/x86: Remove runtime table address from kexec EFI setup data")
      Reported-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Tested-by: default avatarTheodore Ts'o <tytso@mit.edu>
      Reviewed-by: default avatarDave Young <dyoung@redhat.com>
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      a088b858
    • Ard Biesheuvel's avatar
      efi/x86: Don't remap text<->rodata gap read-only for mixed mode · f6103162
      Ard Biesheuvel authored
      Commit
      
        d9e3d2c4 ("efi/x86: Don't map the entire kernel text RW for mixed mode")
      
      updated the code that creates the 1:1 memory mapping to use read-only
      attributes for the 1:1 alias of the kernel's text and rodata sections, to
      protect it from inadvertent modification. However, it failed to take into
      account that the unused gap between text and rodata is given to the page
      allocator for general use.
      
      If the vmap'ed stack happens to be allocated from this region, any by-ref
      output arguments passed to EFI runtime services that are allocated on the
      stack (such as the 'datasize' argument taken by GetVariable() when invoked
      from efivar_entry_size()) will be referenced via a read-only mapping,
      resulting in a page fault if the EFI code tries to write to it:
      
        BUG: unable to handle page fault for address: 00000000386aae88
        #PF: supervisor write access in kernel mode
        #PF: error_code(0x0003) - permissions violation
        PGD fd61063 P4D fd61063 PUD fd62063 PMD 386000e1
        Oops: 0003 [#1] SMP PTI
        CPU: 2 PID: 255 Comm: systemd-sysv-ge Not tainted 5.6.0-rc4-default+ #22
        Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015
        RIP: 0008:0x3eaeed95
        Code: ...  <89> 03 be 05 00 00 80 a1 74 63 b1 3e 83 c0 48 e8 44 d2 ff ff eb 05
        RSP: 0018:000000000fd73fa0 EFLAGS: 00010002
        RAX: 0000000000000001 RBX: 00000000386aae88 RCX: 000000003e9f1120
        RDX: 0000000000000001 RSI: 0000000000000000 RDI: 0000000000000001
        RBP: 000000000fd73fd8 R08: 00000000386aae88 R09: 0000000000000000
        R10: 0000000000000002 R11: 0000000000000000 R12: 0000000000000000
        R13: ffffc0f040220000 R14: 0000000000000000 R15: 0000000000000000
        FS:  00007f21160ac940(0000) GS:ffff9cf23d500000(0000) knlGS:0000000000000000
        CS:  0008 DS: 0018 ES: 0018 CR0: 0000000080050033
        CR2: 00000000386aae88 CR3: 000000000fd6c004 CR4: 00000000003606e0
        DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
        DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
        Call Trace:
        Modules linked in:
        CR2: 00000000386aae88
        ---[ end trace a8bfbd202e712834 ]---
      
      Let's fix this by remapping text and rodata individually, and leave the
      gaps mapped read-write.
      
      Fixes: d9e3d2c4 ("efi/x86: Don't map the entire kernel text RW for mixed mode")
      Reported-by: default avatarJiri Slaby <jslaby@suse.cz>
      Tested-by: default avatarJiri Slaby <jslaby@suse.cz>
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Link: https://lore.kernel.org/r/20200409130434.6736-10-ardb@kernel.org
      f6103162
    • Gary Lin's avatar
      efi/x86: Fix the deletion of variables in mixed mode · a4b81ccf
      Gary Lin authored
      efi_thunk_set_variable() treated the NULL "data" pointer as an invalid
      parameter, and this broke the deletion of variables in mixed mode.
      This commit fixes the check of data so that the userspace program can
      delete a variable in mixed mode.
      
      Fixes: 8319e9d5 ("efi/x86: Handle by-ref arguments covering multiple pages in mixed mode")
      Signed-off-by: default avatarGary Lin <glin@suse.com>
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Link: https://lore.kernel.org/r/20200408081606.1504-1-glin@suse.com
      Link: https://lore.kernel.org/r/20200409130434.6736-9-ardb@kernel.org
      a4b81ccf
    • Ard Biesheuvel's avatar
      efi/libstub/file: Merge file name buffers to reduce stack usage · 464fb126
      Ard Biesheuvel authored
      Arnd reports that commit
      
        9302c1bb ("efi/libstub: Rewrite file I/O routine")
      
      reworks the file I/O routines in a way that triggers the following
      warning:
      
        drivers/firmware/efi/libstub/file.c:240:1: warning: the frame size
                  of 1200 bytes is larger than 1024 bytes [-Wframe-larger-than=]
      
      We can work around this issue dropping an instance of efi_char16_t[256]
      from the stack frame, and reusing the 'filename' field of the file info
      struct that we use to obtain file information from EFI (which contains
      the file name even though we already know it since we used it to open
      the file in the first place)
      Reported-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Link: https://lore.kernel.org/r/20200409130434.6736-8-ardb@kernel.org
      464fb126
    • Ard Biesheuvel's avatar
      Documentation/x86, efi/x86: Clarify EFI handover protocol and its requirements · 8b84769a
      Ard Biesheuvel authored
      The EFI handover protocol was introduced on x86 to permit the boot
      loader to pass a populated boot_params structure as an additional
      function argument to the entry point. This allows the bootloader to
      pass the base and size of a initrd image, which is more flexible
      than relying on the EFI stub's file I/O routines, which can only
      access the file system from which the kernel image itself was loaded
      from firmware.
      
      This approach requires a fair amount of internal knowledge regarding
      the layout of the boot_params structure on the part of the boot loader,
      as well as knowledge regarding the allowed placement of the initrd in
      memory, and so it has been deprecated in favour of a new initrd loading
      method that is based on existing UEFI protocols and best practices.
      
      So update the x86 boot protocol documentation to clarify that the EFI
      handover protocol has been deprecated, and while at it, add a note that
      invoking the EFI handover protocol still requires the PE/COFF image to
      be loaded properly (as opposed to simply being copied into memory).
      Also, drop the code32_start header field from the list of values that
      need to be provided, as this is no longer required.
      Reviewed-by: default avatarBorislav Petkov <bp@suse.de>
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Link: https://lore.kernel.org/r/20200409130434.6736-7-ardb@kernel.org
      8b84769a
    • Ard Biesheuvel's avatar
      efi/arm: Deal with ADR going out of range in efi_enter_kernel() · a9469168
      Ard Biesheuvel authored
      Commit
      
        0698fac4 ("efi/arm: Clean EFI stub exit code from cache instead of avoiding it")
      
      introduced a PC-relative reference to 'call_cache_fn' into
      efi_enter_kernel(), which lives way at the end of head.S. In some cases,
      the ARM version of the ADR instruction does not have sufficient range,
      resulting in a build error:
      
        arch/arm/boot/compressed/head.S:1453: Error: invalid constant (fffffffffffffbe4) after fixup
      
      ARM defines an alternative with a wider range, called ADRL, but this does
      not exist for Thumb-2. At the same time, the ADR instruction in Thumb-2
      has a wider range, and so it does not suffer from the same issue.
      
      So let's switch to ADRL for ARM builds, and keep the ADR for Thumb-2 builds.
      Reported-by: default avatarArnd Bergmann <arnd@arndb.de>
      Tested-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Link: https://lore.kernel.org/r/20200409130434.6736-6-ardb@kernel.org
      a9469168
    • Arvind Sankar's avatar
      efi/x86: Always relocate the kernel for EFI handover entry · 21cb9b41
      Arvind Sankar authored
      Commit
      
        d5cdf4cf ("efi/x86: Don't relocate the kernel unless necessary")
      
      tries to avoid relocating the kernel in the EFI stub as far as possible.
      
      However, when systemd-boot is used to boot a unified kernel image [1],
      the image is constructed by embedding the bzImage as a .linux section in
      a PE executable that contains a small stub loader from systemd that will
      call the EFI stub handover entry, together with additional sections and
      potentially an initrd. When this image is constructed, by for example
      dracut, the initrd is placed after the bzImage without ensuring that at
      least init_size bytes are available for the bzImage. If the kernel is
      not relocated by the EFI stub, this could result in the compressed
      kernel's startup code in head_{32,64}.S overwriting the initrd.
      
      To prevent this, unconditionally relocate the kernel if the EFI stub was
      entered via the handover entry point.
      
      [1] https://systemd.io/BOOT_LOADER_SPECIFICATION/#type-2-efi-unified-kernel-images
      
      Fixes: d5cdf4cf ("efi/x86: Don't relocate the kernel unless necessary")
      Reported-by: default avatarSergey Shatunov <me@prok.pw>
      Signed-off-by: default avatarArvind Sankar <nivedita@alum.mit.edu>
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Link: https://lore.kernel.org/r/20200406180614.429454-2-nivedita@alum.mit.edu
      Link: https://lore.kernel.org/r/20200409130434.6736-5-ardb@kernel.org
      21cb9b41
    • Arvind Sankar's avatar
      efi/x86: Move efi stub globals from .bss to .data · 105cb954
      Arvind Sankar authored
      Commit
      
        3ee372cc ("x86/boot/compressed/64: Remove .bss/.pgtable from bzImage")
      
      removed the .bss section from the bzImage.
      
      However, while a PE loader is required to zero-initialize the .bss
      section before calling the PE entry point, the EFI handover protocol
      does not currently document any requirement that .bss be initialized by
      the bootloader prior to calling the handover entry.
      
      When systemd-boot is used to boot a unified kernel image [1], the image
      is constructed by embedding the bzImage as a .linux section in a PE
      executable that contains a small stub loader from systemd together with
      additional sections and potentially an initrd. As the .bss section
      within the bzImage is no longer explicitly present as part of the file,
      it is not initialized before calling the EFI handover entry.
      Furthermore, as the size of the embedded .linux section is only the size
      of the bzImage file itself, the .bss section's memory may not even have
      been allocated.
      
      In particular, this can result in efi_disable_pci_dma being true even
      when it was not specified via the command line or configuration option,
      which in turn causes crashes while booting on some systems.
      
      To avoid issues, place all EFI stub global variables into the .data
      section instead of .bss. As of this writing, only boolean flags for a
      few command line arguments and the sys_table pointer were in .bss and
      will now move into the .data section.
      
      [1] https://systemd.io/BOOT_LOADER_SPECIFICATION/#type-2-efi-unified-kernel-images
      
      Fixes: 3ee372cc ("x86/boot/compressed/64: Remove .bss/.pgtable from bzImage")
      Reported-by: default avatarSergey Shatunov <me@prok.pw>
      Signed-off-by: default avatarArvind Sankar <nivedita@alum.mit.edu>
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Link: https://lore.kernel.org/r/20200406180614.429454-1-nivedita@alum.mit.edu
      Link: https://lore.kernel.org/r/20200409130434.6736-4-ardb@kernel.org
      105cb954
    • Colin Ian King's avatar
      efi/libstub/x86: Remove redundant assignment to pointer hdr · 05a08796
      Colin Ian King authored
      The pointer hdr is being assigned a value that is never read and
      it is being updated later with a new value. The assignment is
      redundant and can be removed.
      
      Addresses-Coverity: ("Unused value")
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Link: https://lore.kernel.org/r/20200402102537.503103-1-colin.king@canonical.com
      Link: https://lore.kernel.org/r/20200409130434.6736-3-ardb@kernel.org
      05a08796
    • Takashi Iwai's avatar
      efi/cper: Use scnprintf() for avoiding potential buffer overflow · b450b30b
      Takashi Iwai authored
      Since snprintf() returns the would-be-output size instead of the
      actual output size, the succeeding calls may go beyond the given
      buffer limit.  Fix it by replacing with scnprintf().
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarArd Biesheuvel <ardb@kernel.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Link: https://lore.kernel.org/r/20200311072145.5001-1-tiwai@suse.de
      Link: https://lore.kernel.org/r/20200409130434.6736-2-ardb@kernel.org
      b450b30b
  3. 13 Apr, 2020 7 commits
    • Geert Uytterhoeven's avatar
      m68k: Drop redundant generic-y += hardirq.h · ac4075bc
      Geert Uytterhoeven authored
      The cleanup in commit 630f289b ("asm-generic: make more
      kernel-space headers mandatory") did not take into account the recently
      added line for hardirq.h in commit acc45648 ("m68k: Switch to
      asm-generic/hardirq.h"), leading to the following message during the
      build:
      
          scripts/Makefile.asm-generic:25: redundant generic-y found in arch/m68k/include/asm/Kbuild: hardirq.h
      
      Fix this by dropping the now redundant line.
      
      Fixes: 630f289b ("asm-generic: make more kernel-space headers mandatory")
      Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Reviewed-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ac4075bc
    • David Howells's avatar
      afs: Fix afs_d_validate() to set the right directory version · 40fc8102
      David Howells authored
      If a dentry's version is somewhere between invalid_before and the current
      directory version, we should be setting it forward to the current version,
      not backwards to the invalid_before version.  Note that we're only doing
      this at all because dentry::d_fsdata isn't large enough on a 32-bit system.
      
      Fix this by using a separate variable for invalid_before so that we don't
      accidentally clobber the current dir version.
      
      Fixes: a4ff7401 ("afs: Keep track of invalid-before version for dentry coherency")
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      40fc8102
    • David Howells's avatar
      afs: Fix race between post-modification dir edit and readdir/d_revalidate · 2105c282
      David Howells authored
      AFS directories are retained locally as a structured file, with lookup
      being effected by a local search of the file contents.  When a modification
      (such as mkdir) happens, the dir file content is modified locally rather
      than redownloading the directory.
      
      The directory contents are accessed in a number of ways, with a number of
      different locks schemes:
      
       (1) Download of contents - dvnode->validate_lock/write in afs_read_dir().
      
       (2) Lookup and readdir - dvnode->validate_lock/read in afs_dir_iterate(),
           downgrading from (1) if necessary.
      
       (3) d_revalidate of child dentry - dvnode->validate_lock/read in
           afs_do_lookup_one() downgrading from (1) if necessary.
      
       (4) Edit of dir after modification - page locks on individual dir pages.
      
      Unfortunately, because (4) uses different locking scheme to (1) - (3),
      nothing protects against the page being scanned whilst the edit is
      underway.  Even download is not safe as it doesn't lock the pages - relying
      instead on the validate_lock to serialise as a whole (the theory being that
      directory contents are treated as a block and always downloaded as a
      block).
      
      Fix this by write-locking dvnode->validate_lock around the edits.  Care
      must be taken in the rename case as there may be two different dirs - but
      they need not be locked at the same time.  In any case, once the lock is
      taken, the directory version must be rechecked, and the edit skipped if a
      later version has been downloaded by revalidation (there can't have been
      any local changes because the VFS holds the inode lock, but there can have
      been remote changes).
      
      Fixes: 63a4681f ("afs: Locally edit directory data for mkdir/create/unlink/...")
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      2105c282
    • David Howells's avatar
      afs: Fix length of dump of bad YFSFetchStatus record · 3efe55b0
      David Howells authored
      Fix the length of the dump of a bad YFSFetchStatus record.  The function
      was copied from the AFS version, but the YFS variant contains bigger fields
      and extra information, so expand the dump to match.
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      3efe55b0
    • David Howells's avatar
      afs: Fix rename operation status delivery · b98f0ec9
      David Howells authored
      The afs_deliver_fs_rename() and yfs_deliver_fs_rename() functions both only
      decode the second file status returned unless the parent directories are
      different - unfortunately, this means that the xdr pointer isn't advanced
      and the volsync record will be read incorrectly in such an instance.
      
      Fix this by always decoding the second status into the second
      status/callback block which wasn't being used if the dirs were the same.
      
      The afs_update_dentry_version() calls that update the directory data
      version numbers on the dentries can then unconditionally use the second
      status record as this will always reflect the state of the destination dir
      (the two records will be identical if the destination dir is the same as
      the source dir)
      
      Fixes: 260a9803 ("[AFS]: Add "directory write" support.")
      Fixes: 30062bd1 ("afs: Implement YFS support in the fs client")
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      b98f0ec9
    • David Howells's avatar
      afs: Fix decoding of inline abort codes from version 1 status records · 3e0d9892
      David Howells authored
      If we're decoding an AFSFetchStatus record and we see that the version is 1
      and the abort code is set and we're expecting inline errors, then we store
      the abort code and ignore the remaining status record (which is correct),
      but we don't set the flag to say we got a valid abort code.
      
      This can affect operation of YFS.RemoveFile2 when removing a file and the
      operation of {,Y}FS.InlineBulkStatus when prospectively constructing or
      updating of a set of inodes during a lookup.
      
      Fix this to indicate the reception of a valid abort code.
      
      Fixes: a38a7558 ("afs: Fix unlink to handle YFS.RemoveFile2 better")
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      3e0d9892
    • David Howells's avatar
      afs: Fix missing XDR advance in xdr_decode_{AFS,YFS}FSFetchStatus() · c72057b5
      David Howells authored
      If we receive a status record that has VNOVNODE set in the abort field,
      xdr_decode_AFSFetchStatus() and xdr_decode_YFSFetchStatus() don't advance
      the XDR pointer, thereby corrupting anything subsequent decodes from the
      same block of data.
      
      This has the potential to affect AFS.InlineBulkStatus and
      YFS.InlineBulkStatus operation, but probably doesn't since the status
      records are extracted as individual blocks of data and the buffer pointer
      is reset between blocks.
      
      It does affect YFS.RemoveFile2 operation, corrupting the volsync record -
      though that is not currently used.
      
      Other operations abort the entire operation rather than returning an error
      inline, in which case there is no decoding to be done.
      
      Fix this by unconditionally advancing the xdr pointer.
      
      Fixes: 684b0f68 ("afs: Fix AFSFetchStatus decoder to provide OpenAFS compatibility")
      Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
      c72057b5
  4. 12 Apr, 2020 2 commits