1. 25 Oct, 2022 15 commits
    • Arnaldo Carvalho de Melo's avatar
      tools include UAPI: Sync sound/asound.h copy with the kernel sources · 82c50d89
      Arnaldo Carvalho de Melo authored
      Picking the changes from:
      
        69ab6f5b ("ALSA: Remove some left-over license text in include/uapi/sound/")
      
      Which entails no changes in the tooling side as it doesn't introduce new
      SNDRV_PCM_IOCTL_ ioctls.
      
      To silence this perf tools build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/sound/asound.h' differs from latest version at 'include/uapi/sound/asound.h'
        diff -u tools/include/uapi/sound/asound.h include/uapi/sound/asound.h
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      82c50d89
    • Arnaldo Carvalho de Melo's avatar
      tools headers uapi: Update linux/in.h copy · 036b8f5b
      Arnaldo Carvalho de Melo authored
      To get the changes in:
      
        65b32f80 ("uapi: move IPPROTO_L2TP to in.h")
        5854a09b ("net/ipv4: Use __DECLARE_FLEX_ARRAY() helper")
      
      That ends up automatically adding the new IPPROTO_L2TP to the socket
      args beautifiers:
      
        $ tools/perf/trace/beauty/socket.sh > before
        $ cp include/uapi/linux/in.h tools/include/uapi/linux/in.h
        $ tools/perf/trace/beauty/socket.sh > after
        $ diff -u before after
        --- before	2022-10-25 12:17:02.577892416 -0300
        +++ after	2022-10-25 12:17:10.806113033 -0300
        @@ -20,6 +20,7 @@
         	[98] = "ENCAP",
         	[103] = "PIM",
         	[108] = "COMP",
        +	[115] = "L2TP",
         	[132] = "SCTP",
         	[136] = "UDPLITE",
         	[137] = "MPLS",
        $
      
      Now 'perf trace' will decode that 115 into "L2TP" and it will also be
      possible to use it in tracepoint filter expressions.
      
      Addresses this tools/perf build warning:
      
        Warning: Kernel ABI header at 'tools/include/uapi/linux/in.h' differs from latest version at 'include/uapi/linux/in.h'
        diff -u tools/include/uapi/linux/in.h include/uapi/linux/in.h
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paolo Abeni <pabeni@redhat.com>
      Cc: Wojciech Drewek <wojciech.drewek@intel.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Gustavo A. R. Silva <gustavoars@kernel.org>
      Link: https://lore.kernel.org/lkml/Y1f%2FGe6vjQrGjYiK@kernel.org/Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      036b8f5b
    • Arnaldo Carvalho de Melo's avatar
      tools headers: Update the copy of x86's memcpy_64.S used in 'perf bench' · 4402e360
      Arnaldo Carvalho de Melo authored
      We also need to add SYM_TYPED_FUNC_START() to util/include/linux/linkage.h
      and update tools/perf/check_headers.sh to ignore the include cfi_types.h
      line when checking if the kernel original files drifted from the copies
      we carry.
      
      This is to get the changes from:
      
        ccace936 ("x86: Add types to indirectly called assembly functions")
      
      Addressing these tools/perf build warnings:
      
        Warning: Kernel ABI header at 'tools/arch/x86/lib/memcpy_64.S' differs from latest version at 'arch/x86/lib/memcpy_64.S'
        diff -u tools/arch/x86/lib/memcpy_64.S arch/x86/lib/memcpy_64.S
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Sami Tolvanen <samitolvanen@google.com>
      Link: https://lore.kernel.org/lkml/Y1f3VRIec9EBgX6F@kernel.org/Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4402e360
    • Arnaldo Carvalho de Melo's avatar
      tools headers arm64: Sync arm64's cputype.h with the kernel sources · ffc1df3d
      Arnaldo Carvalho de Melo authored
      To get the changes in:
      
        0e5d5ae8 ("arm64: Add AMPERE1 to the Spectre-BHB affected list")
      
      That addresses this perf build warning:
      
        Warning: Kernel ABI header at 'tools/arch/arm64/include/asm/cputype.h' differs from latest version at 'arch/arm64/include/asm/cputype.h'
        diff -u tools/arch/arm64/include/asm/cputype.h arch/arm64/include/asm/cputype.h
      
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: D Scott Phillips <scott@os.amperecomputing.com>
      https://lore.kernel.org/lkml/Y1fy5GD7ZYvkeufv@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ffc1df3d
    • Namhyung Kim's avatar
      perf test: Do not fail Intel-PT misc test w/o libpython · 246122a8
      Namhyung Kim authored
      The virtual LBR test uses a python script to check the max size of
      branch stack in the Intel-PT generated LBR.  But it didn't check whether
      python scripting is available (as it's optional).
      
      Let's skip the test if the python support is not available.
      
      Fixes: f77811a0 ("perf test: test_intel_pt.sh: Add 9 tests")
      Reviewed-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarIan Rogers <irogers@google.com>
      Cc: Ammy Yi <ammy.yi@intel.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20221021181055.60183-1-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      246122a8
    • Thomas Richter's avatar
      perf list: Fix PMU name pai_crypto in perf list on s390 · 5a6c184a
      Thomas Richter authored
      Commit e0b23af8 ("perf list: Add PMU pai_crypto event
      description for IBM z16") introduced the "Processor Activity
      Instrumentation" for cryptographic counters for z16. The PMU device
      driver exports the counters via sysfs files listed in directory
      /sys/devices/pai_crypto.
      
      To specify an event from that PMU, use 'perf stat -e pai_crypto/XXX/'.
      
      However the JSON file mentioned in above commit exports the counter
      decriptions in file pmu-events/arch/s390/cf_z16/pai.json.  Rename this
      file to pmu-events/arch/s390/cf_z16/pai_crypto.json to make the naming
      consistent.
      
      Now 'perf list' shows the counter names under pai_crypto section:
      
        pai_crypto:
      
          CRYPTO_ALL
               [CRYPTO ALL. Unit: pai_crypto]
          ...
      
      Output before was
      
        pai:
          CRYPTO_ALL
               [CRYPTO ALL. Unit: pai_crypto]
          ...
      
      Fixes: e0b23af8 ("perf list: Add PMU pai_crypto event description for IBM z16")
      Signed-off-by: default avatarThomas Richter <tmricht@linux.ibm.com>
      Acked-by: default avatarSumanth Korikkar <sumanthk@linux.ibm.com>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Sven Schnelle <svens@linux.ibm.com>
      Cc: Thomas Richter <tmricht@linux.ibm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Link: https://lore.kernel.org/r/20221021082557.2695382-1-tmricht@linux.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5a6c184a
    • Ian Rogers's avatar
      perf record: Fix event fd races · 304f0a2f
      Ian Rogers authored
      The write call may set errno which is problematic if occurring in a
      function also setting errno. Save and restore errno around the write
      call.
      
      done_fd may be used after close, clear it as part of the close and check
      its validity in the signal handler.
      
      Suggested-by: <gthelen@google.com>
      Reviewed-by: default avatarLeo Yan <leo.yan@linaro.org>
      Signed-off-by: default avatarIan Rogers <irogers@google.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Anand K Mistry <amistry@google.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: https://lore.kernel.org/r/20221024011024.462518-1-irogers@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      304f0a2f
    • Arnaldo Carvalho de Melo's avatar
      perf bpf: Fix build with libbpf 0.7.0 by checking if bpf_program__set_insns() is available · f1bdebbb
      Arnaldo Carvalho de Melo authored
      During the transition to libbpf 1.0 some functions that perf used were
      deprecated and finally removed from libbpf, so bpf_program__set_insns()
      was introduced for perf to continue to use its bpf loader.
      
      But when build with LIBBPF_DYNAMIC=1 we now need to check if that
      function is available so that perf can build with older libbpf versions,
      even if the end result is emitting a warning to the user that the use
      of the perf BPF loader requires a newer libbpf, since bpf_program__set_insns()
      touches libbpf objects internal state.
      
      This affects only 'perf trace' when using bpf C code or pre-compiled
      bytecode as an event.
      
      Noticed on RHEL9, that has libbpf 0.7.0, where bpf_program__set_insns()
      isn't available.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f1bdebbb
    • Arnaldo Carvalho de Melo's avatar
      perf bpf: Fix build with libbpf 0.7.0 by adding prototype for bpf_load_program() · 409fb6bd
      Arnaldo Carvalho de Melo authored
      The bpf_load_program() prototype appeared in tools/lib/bpf/bpf.h as
      deprecated, but nowadays its completely removed, so add it back for
      building with the system libbpf when using 'make LIBBPF_DYNAMIC=1'.
      
      This is a stop gap hack till we do like tools/bpf does with bpftool,
      i.e. bootstrap the libbpf build and install it in the perf build
      directory when not using 'make LIBBPF_DYNAMIC=1'.
      
      That has to be done to all libraries in tools/lib/, so tha we can
      remove -Itools/lib/ from the tools/perf CFLAGS.
      
      Noticed when building with LIBBPF_DYNAMIC=1 and libbpf 0.7.0 on RHEL9.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      409fb6bd
    • Kajol Jain's avatar
      perf vendor events power10: Fix hv-24x7 metric events · b92dd117
      Kajol Jain authored
      Testcase stat_all_metrics.sh fails in powerpc:
      
        90: perf all metrics test : FAILED!
      
      The testcase "stat_all_metrics.sh" verifies perf stat result for all the
      metric events present in perf list.  It runs perf metric events with
      various commands and expects non-empty metric result.
      
      Incase of powerpc:hv-24x7 events, some of the event count can be 0 based
      on system configuration. And if that event used as denominator in divide
      equation, it can cause divide by 0 error. The current nest_metric.json
      file creating divide by 0 issue for some of the metric events, which
      results in failure of the "stat_all_metrics.sh" test case.
      
      Most of the metrics events have cycles or an event which expect to have
      a larger value as denominator, so adding 1 to the denominator of the
      metric expression as a fix.
      
      Result in powerpc box after this patch changes:
      
        90: perf all metrics test : Ok
      
      Fixes: a3cbcadf ("perf vendor events power10: Adds 24x7 nest metric events for power10 platform")
      Signed-off-by: default avatarKajol Jain <kjain@linux.ibm.com>
      Reviewed-by: default avatarMadhavan Srinivasan <maddy@linux.vnet.ibm.com>
      Cc: Athira Jajeev <atrajeev@linux.vnet.ibm.com>
      Cc: Disha Goel <disgoel@linux.vnet.ibm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kajol Jain <kjain@linux.ibm.com>
      Cc: linuxppc-dev@lists.ozlabs.org
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Nageswara R Sastry <rnsastry@linux.ibm.com>
      Link: https://lore.kernel.org/r/20221014140220.122251-1-kjain@linux.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b92dd117
    • Adrian Hunter's avatar
      perf docs: Fix man page build wrt perf-arm-coresight.txt · 231e61bc
      Adrian Hunter authored
      perf build assumes documentation files starting with "perf-" are man
      pages but perf-arm-coresight.txt is not a man page:
      
        asciidoc: ERROR: perf-arm-coresight.txt: line 2: malformed manpage title
        asciidoc: ERROR: perf-arm-coresight.txt: line 3: name section expected
        asciidoc: FAILED: perf-arm-coresight.txt: line 3: section title expected
        make[3]: *** [Makefile:266: perf-arm-coresight.xml] Error 1
        make[3]: *** Waiting for unfinished jobs....
        make[2]: *** [Makefile.perf:895: man] Error 2
      
      Fix by renaming it.
      
      Fixes: dc2e0fb0 ("perf test coresight: Add relevant documentation about ARM64 CoreSight testing")
      Reported-by: default avatarChristian Borntraeger <borntraeger@linux.ibm.com>
      Reported-by: default avatarSven Schnelle <svens@linux.ibm.com>
      Reviewed-by: default avatarLeo Yan <leo.yan@linaro.org>
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Carsten Haitzler <carsten.haitzler@arm.com>
      Cc: coresight@lists.linaro.org
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: James Clark <james.clark@arm.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Mike Leach <mike.leach@linaro.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Suzuki Poulouse <suzuki.poulose@arm.com>
      Link: https://lore.kernel.org/r/a176a3e1-6ddc-bb63-e41c-15cda8c2d5d2@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      231e61bc
    • Arnaldo Carvalho de Melo's avatar
      tools headers UAPI: Sync powerpc syscall tables with the kernel sources · 88864611
      Arnaldo Carvalho de Melo authored
      To pick the changes in these csets:
      
        e2375062 ("powerpc/32: fix syscall wrappers with 64-bit arguments of unaligned register-pairs")
      
      That doesn't cause any changes in the perf tools.
      
      As a reminder, this table is used in tools perf to allow features such as:
      
        [root@five ~]# perf trace -e set_mempolicy_home_node
        ^C[root@five ~]#
        [root@five ~]# perf trace -v -e set_mempolicy_home_node
        Using CPUID AuthenticAMD-25-21-0
        event qualifier tracepoint filter: (common_pid != 253729 && common_pid != 3585) && (id == 450)
        mmap size 528384B
        ^C[root@five ~]
        [root@five ~]# perf trace -v -e set*  --max-events 5
        Using CPUID AuthenticAMD-25-21-0
        event qualifier tracepoint filter: (common_pid != 253734 && common_pid != 3585) && (id == 38 || id == 54 || id == 105 || id == 106 || id == 109 || id == 112 || id == 113 || id == 114 || id == 116 || id == 117 || id == 119 || id == 122 || id == 123 || id == 141 || id == 160 || id == 164 || id == 170 || id == 171 || id == 188 || id == 205 || id == 218 || id == 238 || id == 273 || id == 308 || id == 450)
        mmap size 528384B
             0.000 ( 0.008 ms): bash/253735 setpgid(pid: 253735 (bash), pgid: 253735 (bash))      = 0
          6849.011 ( 0.008 ms): bash/16046 setpgid(pid: 253736 (bash), pgid: 253736 (bash))       = 0
          6849.080 ( 0.005 ms): bash/253736 setpgid(pid: 253736 (bash), pgid: 253736 (bash))      = 0
          7437.718 ( 0.009 ms): gnome-shell/253737 set_robust_list(head: 0x7f34b527e920, len: 24) = 0
         13445.986 ( 0.010 ms): bash/16046 setpgid(pid: 253738 (bash), pgid: 253738 (bash))       = 0
        [root@five ~]#
      
      That is the filter expression attached to the raw_syscalls:sys_{enter,exit}
      tracepoints.
      
        $ find tools/perf/arch/ -name "syscall*tbl" | xargs grep -w set_mempolicy_home_node
        tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl:450	common	set_mempolicy_home_node		sys_set_mempolicy_home_node
        tools/perf/arch/powerpc/entry/syscalls/syscall.tbl:450 	nospu	set_mempolicy_home_node		sys_set_mempolicy_home_node
        tools/perf/arch/s390/entry/syscalls/syscall.tbl:450  common	set_mempolicy_home_node	sys_set_mempolicy_home_node	sys_set_mempolicy_home_node
        tools/perf/arch/x86/entry/syscalls/syscall_64.tbl:450	common	set_mempolicy_home_node	sys_set_mempolicy_home_node
        $
      
        $ grep -w set_mempolicy_home_node /tmp/build/perf/arch/x86/include/generated/asm/syscalls_64.c
      	[450] = "set_mempolicy_home_node",
        $
      
      This addresses these perf build warnings:
      
        Warning: Kernel ABI header at 'tools/include/uapi/asm-generic/unistd.h' differs from latest version at 'include/uapi/asm-generic/unistd.h'
        diff -u tools/include/uapi/asm-generic/unistd.h include/uapi/asm-generic/unistd.h
        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
        Warning: Kernel ABI header at 'tools/perf/arch/powerpc/entry/syscalls/syscall.tbl' differs from latest version at 'arch/powerpc/kernel/syscalls/syscall.tbl'
        diff -u tools/perf/arch/powerpc/entry/syscalls/syscall.tbl arch/powerpc/kernel/syscalls/syscall.tbl
        Warning: Kernel ABI header at 'tools/perf/arch/s390/entry/syscalls/syscall.tbl' differs from latest version at 'arch/s390/kernel/syscalls/syscall.tbl'
        diff -u tools/perf/arch/s390/entry/syscalls/syscall.tbl arch/s390/kernel/syscalls/syscall.tbl
        Warning: Kernel ABI header at 'tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl' differs from latest version at 'arch/mips/kernel/syscalls/syscall_n64.tbl'
        diff -u tools/perf/arch/mips/entry/syscalls/syscall_n64.tbl arch/mips/kernel/syscalls/syscall_n64.tbl
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Nicholas Piggin <npiggin@gmail.com>
      Link: https://lore.kernel.org/lkml/Y01HN2DGkWz8tC%2FJ@kernel.org/Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      88864611
    • Linus Torvalds's avatar
      Merge tag 'platform-drivers-x86-v6.1-2' of... · 4dc12f37
      Linus Torvalds authored
      Merge tag 'platform-drivers-x86-v6.1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86
      
      Pull x86 platform driver fixes from Hans de Goede:
       "The only thing which stands out is a fix for a backlight regression on
        Chromebooks (under drivers/acpi, with ack from Rafael).
      
        Other then that nothing special to report just various small fixes and
        hardware-id additions"
      
      * tag 'platform-drivers-x86-v6.1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86:
        ACPI: video: Fix missing native backlight on Chromebooks
        platform/x86/intel: pmc/core: Add Raptor Lake support to pmc core driver
        leds: simatic-ipc-leds-gpio: fix incorrect LED to GPIO mapping
        platform/x86/amd: pmc: Read SMU version during suspend on Cezanne systems
        platform/x86: thinkpad_acpi: Fix reporting a non present second fan on some models
        platform/x86: asus-wmi: Add support for ROG X16 tablet mode
      4dc12f37
    • Sreekanth Reddy's avatar
      scsi: mpt3sas: re-do lost mpt3sas DMA mask fix · 1a2dcbdd
      Sreekanth Reddy authored
      This is a re-do of commit e0e0747d ("scsi: mpt3sas: Fix return value
      check of dma_get_required_mask()"), which I ended up undoing in a
      mis-merge in commit 62e6e594 ("Merge tag 'scsi-misc' of
      git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi").
      
      The original commit message was
      
        scsi: mpt3sas: Fix return value check of dma_get_required_mask()
      
        Fix the incorrect return value check of dma_get_required_mask().  Due to
        this incorrect check, the driver was always setting the DMA mask to 63 bit.
      
        Link: https://lore.kernel.org/r/20220913120538.18759-2-sreekanth.reddy@broadcom.com
        Fixes: ba27c5cf ("scsi: mpt3sas: Don't change the DMA coherent mask after allocations")
      Signed-off-by: default avatarSreekanth Reddy <sreekanth.reddy@broadcom.com>
      Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
      
      and this fix was lost when I mis-merged the conflict with commit
      9df65096 ("scsi: mpt3sas: Don't change DMA mask while reallocating
      pools").
      Reported-by: default avatarJuergen Gross <jgross@suse.com>
      Fixes: 62e6e594 ("Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi")
      Link: https://lore.kernel.org/all/CAHk-=wjaK-TxrNaGtFDpL9qNHL1MVkWXO1TT6vObD5tXMSC4Zg@mail.gmail.comSigned-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1a2dcbdd
    • Steven Rostedt (Google)'s avatar
      x86/mm: Do not verify W^X at boot up · a970174d
      Steven Rostedt (Google) authored
      Adding on the kernel command line "ftrace=function" triggered:
      
        CPA detected W^X violation: 8000000000000063 -> 0000000000000063 range: 0xffffffffc0013000 - 0xffffffffc0013fff PFN 10031b
        WARNING: CPU: 0 PID: 0 at arch/x86/mm/pat/set_memory.c:609
        verify_rwx+0x61/0x6d
        Call Trace:
           __change_page_attr_set_clr+0x146/0x8a6
           change_page_attr_set_clr+0x135/0x268
           change_page_attr_clear.constprop.0+0x16/0x1c
           set_memory_x+0x2c/0x32
           arch_ftrace_update_trampoline+0x218/0x2db
           ftrace_update_trampoline+0x16/0xa1
           __register_ftrace_function+0x93/0xb2
           ftrace_startup+0x21/0xf0
           register_ftrace_function_nolock+0x26/0x40
           register_ftrace_function+0x4e/0x143
           function_trace_init+0x7d/0xc3
           tracer_init+0x23/0x2c
           tracing_set_tracer+0x1d5/0x206
           register_tracer+0x1c0/0x1e4
           init_function_trace+0x90/0x96
           early_trace_init+0x25c/0x352
           start_kernel+0x424/0x6e4
           x86_64_start_reservations+0x24/0x2a
           x86_64_start_kernel+0x8c/0x95
           secondary_startup_64_no_verify+0xe0/0xeb
      
      This is because at boot up, kernel text is writable, and there's no
      reason to do tricks to updated it.  But the verifier does not
      distinguish updates at boot up and at run time, and causes a warning at
      time of boot.
      
      Add a check for system_state == SYSTEM_BOOTING and allow it if that is
      the case.
      
      [ These SYSTEM_BOOTING special cases are all pretty horrid, but the x86
        text_poke() code does some odd things at bootup, forcing this for now
          - Linus ]
      
      Link: https://lore.kernel.org/r/20221024112730.180916b3@gandalf.local.home
      Fixes: 652c5bf3 ("x86/mm: Refuse W^X violations")
      Signed-off-by: default avatarSteven Rostedt (Google) <rostedt@goodmis.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a970174d
  2. 24 Oct, 2022 24 commits
    • Linus Torvalds's avatar
      Merge tag 'net-6.1-rc3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · 337a0a0b
      Linus Torvalds authored
      Pull networking fixes from Jakub Kicinski:
       "Including fixes from bpf.
      
        The net-memcg fix stands out, the rest is very run-off-the-mill. Maybe
        I'm biased.
      
        Current release - regressions:
      
         - eth: fman: re-expose location of the MAC address to userspace,
           apparently some udev scripts depended on the exact value
      
        Current release - new code bugs:
      
         - bpf:
             - wait for busy refill_work when destroying bpf memory allocator
             - allow bpf_user_ringbuf_drain() callbacks to return 1
             - fix dispatcher patchable function entry to 5 bytes nop
      
        Previous releases - regressions:
      
         - net-memcg: avoid stalls when under memory pressure
      
         - tcp: fix indefinite deferral of RTO with SACK reneging
      
         - tipc: fix a null-ptr-deref in tipc_topsrv_accept
      
         - eth: macb: specify PHY PM management done by MAC
      
         - tcp: fix a signed-integer-overflow bug in tcp_add_backlog()
      
        Previous releases - always broken:
      
         - eth: amd-xgbe: SFP fixes and compatibility improvements
      
        Misc:
      
         - docs: netdev: offer performance feedback to contributors"
      
      * tag 'net-6.1-rc3-1' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (37 commits)
        net-memcg: avoid stalls when under memory pressure
        tcp: fix indefinite deferral of RTO with SACK reneging
        tcp: fix a signed-integer-overflow bug in tcp_add_backlog()
        net: lantiq_etop: don't free skb when returning NETDEV_TX_BUSY
        net: fix UAF issue in nfqnl_nf_hook_drop() when ops_init() failed
        docs: netdev: offer performance feedback to contributors
        kcm: annotate data-races around kcm->rx_wait
        kcm: annotate data-races around kcm->rx_psock
        net: fman: Use physical address for userspace interfaces
        net/mlx5e: Cleanup MACsec uninitialization routine
        atlantic: fix deadlock at aq_nic_stop
        nfp: only clean `sp_indiff` when application firmware is unloaded
        amd-xgbe: add the bit rate quirk for Molex cables
        amd-xgbe: fix the SFP compliance codes check for DAC cables
        amd-xgbe: enable PLL_CTL for fixed PHY modes only
        amd-xgbe: use enums for mailbox cmd and sub_cmds
        amd-xgbe: Yellow carp devices do not need rrc
        bpf: Use __llist_del_all() whenever possbile during memory draining
        bpf: Wait for busy refill_work when destroying bpf memory allocator
        MAINTAINERS: add keyword match on PTP
        ...
      337a0a0b
    • Linus Torvalds's avatar
      Merge tag 'rcu-urgent.2022.10.20a' of... · f6602a97
      Linus Torvalds authored
      Merge tag 'rcu-urgent.2022.10.20a' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu
      
      Pull RCU fix from Paul McKenney:
       "Fix a regression caused by commit bf95b2bc ("rcu: Switch polled
        grace-period APIs to ->gp_seq_polled"), which could incorrectly leave
        interrupts enabled after an early-boot call to synchronize_rcu().
      
        Such synchronize_rcu() calls must acquire leaf rcu_node locks in order
        to properly interact with polled grace periods, but the code did not
        take into account the possibility of synchronize_rcu() being invoked
        from the portion of the boot sequence during which interrupts are
        disabled.
      
        This commit therefore switches the lock acquisition and release from
        irq to irqsave/irqrestore"
      
      * tag 'rcu-urgent.2022.10.20a' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu:
        rcu: Keep synchronize_rcu() from enabling irqs in early boot
      f6602a97
    • Linus Torvalds's avatar
      Merge tag 'linux-kselftest-kunit-fixes-6.1-rc3' of... · 2a91e897
      Linus Torvalds authored
      Merge tag 'linux-kselftest-kunit-fixes-6.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
      
      Pull KUnit fixes from Shuah Khan:
       "One single fix to update alloc_string_stream() callers to check for
        IS_ERR() instead of NULL to be in sync with alloc_string_stream()
        returning an ERR_PTR()"
      
      * tag 'linux-kselftest-kunit-fixes-6.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
        kunit: update NULL vs IS_ERR() tests
      2a91e897
    • Linus Torvalds's avatar
      Merge tag 'linux-kselftest-fixes-6.1-rc3' of... · 21c92498
      Linus Torvalds authored
      Merge tag 'linux-kselftest-fixes-6.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
      
      Pull Kselftest fixes from Shuah Khan:
      
       - futex, intel_pstate, kexec build fixes
      
       - ftrace dynamic_events dependency check fix
      
       - memory-hotplug fix to remove redundant warning from test report
      
      * tag 'linux-kselftest-fixes-6.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
        selftests/ftrace: fix dynamic_events dependency check
        selftests/memory-hotplug: Remove the redundant warning information
        selftests/kexec: fix build for ARCH=x86_64
        selftests/intel_pstate: fix build for ARCH=x86_64
        selftests/futex: fix build for clang
      21c92498
    • Linus Torvalds's avatar
      Merge tag 'pinctrl-v6.1-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl · 74d5b415
      Linus Torvalds authored
      Pull pin control fixes from Linus Walleij:
      
       - Fix typos in UART1 and MMC in the Ingenic driver
      
       - A really well researched glitch bug fix to the Qualcomm driver that
         was tracked down and fixed by Dough Anderson from Chromium. Hats off
         for this one!
      
       - Revert two patches on the Xilinx ZynqMP driver: this needs a proper
         solution making use of firmware version information to adapt to
         different firmware releases
      
       - Fix interrupt triggers in the Ocelot driver
      
      * tag 'pinctrl-v6.1-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl:
        pinctrl: ocelot: Fix incorrect trigger of the interrupt.
        Revert "dt-bindings: pinctrl-zynqmp: Add output-enable configuration"
        Revert "pinctrl: pinctrl-zynqmp: Add support for output-enable and bias-high-impedance"
        pinctrl: qcom: Avoid glitching lines when we first mux to output
        pinctrl: Ingenic: JZ4755 bug fixes
      74d5b415
    • Jakub Kicinski's avatar
      net-memcg: avoid stalls when under memory pressure · 720ca52b
      Jakub Kicinski authored
      As Shakeel explains the commit under Fixes had the unintended
      side-effect of no longer pre-loading the cached memory allowance.
      Even tho we previously dropped the first packet received when
      over memory limit - the consecutive ones would get thru by using
      the cache. The charging was happening in batches of 128kB, so
      we'd let in 128kB (truesize) worth of packets per one drop.
      
      After the change we no longer force charge, there will be no
      cache filling side effects. This causes significant drops and
      connection stalls for workloads which use a lot of page cache,
      since we can't reclaim page cache under GFP_NOWAIT.
      
      Some of the latency can be recovered by improving SACK reneg
      handling but nowhere near enough to get back to the pre-5.15
      performance (the application I'm experimenting with still
      sees 5-10x worst latency).
      
      Apply the suggested workaround of using GFP_ATOMIC. We will now
      be more permissive than previously as we'll drop _no_ packets
      in softirq when under pressure. But I can't think of any good
      and simple way to address that within networking.
      
      Link: https://lore.kernel.org/all/20221012163300.795e7b86@kernel.org/Suggested-by: default avatarShakeel Butt <shakeelb@google.com>
      Fixes: 4b1327be ("net-memcg: pass in gfp_t mask to mem_cgroup_charge_skmem()")
      Acked-by: default avatarShakeel Butt <shakeelb@google.com>
      Acked-by: default avatarRoman Gushchin <roman.gushchin@linux.dev>
      Link: https://lore.kernel.org/r/20221021160304.1362511-1-kuba@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      720ca52b
    • Neal Cardwell's avatar
      tcp: fix indefinite deferral of RTO with SACK reneging · 3d2af9cc
      Neal Cardwell authored
      This commit fixes a bug that can cause a TCP data sender to repeatedly
      defer RTOs when encountering SACK reneging.
      
      The bug is that when we're in fast recovery in a scenario with SACK
      reneging, every time we get an ACK we call tcp_check_sack_reneging()
      and it can note the apparent SACK reneging and rearm the RTO timer for
      srtt/2 into the future. In some SACK reneging scenarios that can
      happen repeatedly until the receive window fills up, at which point
      the sender can't send any more, the ACKs stop arriving, and the RTO
      fires at srtt/2 after the last ACK. But that can take far too long
      (O(10 secs)), since the connection is stuck in fast recovery with a
      low cwnd that cannot grow beyond ssthresh, even if more bandwidth is
      available.
      
      This fix changes the logic in tcp_check_sack_reneging() to only rearm
      the RTO timer if data is cumulatively ACKed, indicating forward
      progress. This avoids this kind of nearly infinite loop of RTO timer
      re-arming. In addition, this meets the goals of
      tcp_check_sack_reneging() in handling Windows TCP behavior that looks
      temporarily like SACK reneging but is not really.
      
      Many thanks to Jakub Kicinski and Neil Spring, who reported this issue
      and provided critical packet traces that enabled root-causing this
      issue. Also, many thanks to Jakub Kicinski for testing this fix.
      
      Fixes: 5ae344c9 ("tcp: reduce spurious retransmits due to transient SACK reneging")
      Reported-by: default avatarJakub Kicinski <kuba@kernel.org>
      Reported-by: default avatarNeil Spring <ntspring@fb.com>
      Signed-off-by: default avatarNeal Cardwell <ncardwell@google.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Cc: Yuchung Cheng <ycheng@google.com>
      Tested-by: default avatarJakub Kicinski <kuba@kernel.org>
      Link: https://lore.kernel.org/r/20221021170821.1093930-1-ncardwell.kernel@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      3d2af9cc
    • Jakub Kicinski's avatar
      Merge tag 'for-netdev' of https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf · e28c4445
      Jakub Kicinski authored
      Alexei Starovoitov says:
      
      ====================
      pull-request: bpf 2022-10-23
      
      We've added 7 non-merge commits during the last 18 day(s) which contain
      a total of 8 files changed, 69 insertions(+), 5 deletions(-).
      
      The main changes are:
      
      1) Wait for busy refill_work when destroying bpf memory allocator, from Hou.
      
      2) Allow bpf_user_ringbuf_drain() callbacks to return 1, from David.
      
      3) Fix dispatcher patchable function entry to 5 bytes nop, from Jiri.
      
      4) Prevent decl_tag from being referenced in func_proto, from Stanislav.
      
      * tag 'for-netdev' of https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf:
        bpf: Use __llist_del_all() whenever possbile during memory draining
        bpf: Wait for busy refill_work when destroying bpf memory allocator
        bpf: Fix dispatcher patchable function entry to 5 bytes nop
        bpf: prevent decl_tag from being referenced in func_proto
        selftests/bpf: Add reproducer for decl_tag in func_proto return type
        selftests/bpf: Make bpf_user_ringbuf_drain() selftest callback return 1
        bpf: Allow bpf_user_ringbuf_drain() callbacks to return 1
      ====================
      
      Link: https://lore.kernel.org/r/20221023192244.81137-1-alexei.starovoitov@gmail.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      e28c4445
    • Dmitry Osipenko's avatar
      ACPI: video: Fix missing native backlight on Chromebooks · e9cf4d9b
      Dmitry Osipenko authored
      Chromebooks don't have backlight in ACPI table, they suppose to use
      native backlight in this case. Check presence of the CrOS embedded
      controller ACPI device and prefer the native backlight if EC found.
      Suggested-by: default avatarHans de Goede <hdegoede@redhat.com>
      Fixes: 2600bfa3 ("ACPI: video: Add acpi_video_backlight_use_native() helper")
      Signed-off-by: default avatarDmitry Osipenko <dmitry.osipenko@collabora.com>
      Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
      Acked-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Link: https://lore.kernel.org/r/20221024141210.67784-1-dmitry.osipenko@collabora.comSigned-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      e9cf4d9b
    • Lu Wei's avatar
      tcp: fix a signed-integer-overflow bug in tcp_add_backlog() · ec791d81
      Lu Wei authored
      The type of sk_rcvbuf and sk_sndbuf in struct sock is int, and
      in tcp_add_backlog(), the variable limit is caculated by adding
      sk_rcvbuf, sk_sndbuf and 64 * 1024, it may exceed the max value
      of int and overflow. This patch reduces the limit budget by
      halving the sndbuf to solve this issue since ACK packets are much
      smaller than the payload.
      
      Fixes: c9c33212 ("tcp: add tcp_add_backlog()")
      Signed-off-by: default avatarLu Wei <luwei32@huawei.com>
      Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
      Acked-by: default avatarKuniyuki Iwashima <kuniyu@amazon.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ec791d81
    • Zhang Changzhong's avatar
      net: lantiq_etop: don't free skb when returning NETDEV_TX_BUSY · 9c1eaa27
      Zhang Changzhong authored
      The ndo_start_xmit() method must not free skb when returning
      NETDEV_TX_BUSY, since caller is going to requeue freed skb.
      
      Fixes: 504d4721 ("MIPS: Lantiq: Add ethernet driver")
      Signed-off-by: default avatarZhang Changzhong <zhangchangzhong@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      9c1eaa27
    • Zhengchao Shao's avatar
      net: fix UAF issue in nfqnl_nf_hook_drop() when ops_init() failed · d266935a
      Zhengchao Shao authored
      When the ops_init() interface is invoked to initialize the net, but
      ops->init() fails, data is released. However, the ptr pointer in
      net->gen is invalid. In this case, when nfqnl_nf_hook_drop() is invoked
      to release the net, invalid address access occurs.
      
      The process is as follows:
      setup_net()
      	ops_init()
      		data = kzalloc(...)   ---> alloc "data"
      		net_assign_generic()  ---> assign "date" to ptr in net->gen
      		...
      		ops->init()           ---> failed
      		...
      		kfree(data);          ---> ptr in net->gen is invalid
      	...
      	ops_exit_list()
      		...
      		nfqnl_nf_hook_drop()
      			*q = nfnl_queue_pernet(net) ---> q is invalid
      
      The following is the Call Trace information:
      BUG: KASAN: use-after-free in nfqnl_nf_hook_drop+0x264/0x280
      Read of size 8 at addr ffff88810396b240 by task ip/15855
      Call Trace:
      <TASK>
      dump_stack_lvl+0x8e/0xd1
      print_report+0x155/0x454
      kasan_report+0xba/0x1f0
      nfqnl_nf_hook_drop+0x264/0x280
      nf_queue_nf_hook_drop+0x8b/0x1b0
      __nf_unregister_net_hook+0x1ae/0x5a0
      nf_unregister_net_hooks+0xde/0x130
      ops_exit_list+0xb0/0x170
      setup_net+0x7ac/0xbd0
      copy_net_ns+0x2e6/0x6b0
      create_new_namespaces+0x382/0xa50
      unshare_nsproxy_namespaces+0xa6/0x1c0
      ksys_unshare+0x3a4/0x7e0
      __x64_sys_unshare+0x2d/0x40
      do_syscall_64+0x35/0x80
      entry_SYSCALL_64_after_hwframe+0x46/0xb0
      </TASK>
      
      Allocated by task 15855:
      kasan_save_stack+0x1e/0x40
      kasan_set_track+0x21/0x30
      __kasan_kmalloc+0xa1/0xb0
      __kmalloc+0x49/0xb0
      ops_init+0xe7/0x410
      setup_net+0x5aa/0xbd0
      copy_net_ns+0x2e6/0x6b0
      create_new_namespaces+0x382/0xa50
      unshare_nsproxy_namespaces+0xa6/0x1c0
      ksys_unshare+0x3a4/0x7e0
      __x64_sys_unshare+0x2d/0x40
      do_syscall_64+0x35/0x80
      entry_SYSCALL_64_after_hwframe+0x46/0xb0
      
      Freed by task 15855:
      kasan_save_stack+0x1e/0x40
      kasan_set_track+0x21/0x30
      kasan_save_free_info+0x2a/0x40
      ____kasan_slab_free+0x155/0x1b0
      slab_free_freelist_hook+0x11b/0x220
      __kmem_cache_free+0xa4/0x360
      ops_init+0xb9/0x410
      setup_net+0x5aa/0xbd0
      copy_net_ns+0x2e6/0x6b0
      create_new_namespaces+0x382/0xa50
      unshare_nsproxy_namespaces+0xa6/0x1c0
      ksys_unshare+0x3a4/0x7e0
      __x64_sys_unshare+0x2d/0x40
      do_syscall_64+0x35/0x80
      entry_SYSCALL_64_after_hwframe+0x46/0xb0
      
      Fixes: f875bae0 ("net: Automatically allocate per namespace data.")
      Signed-off-by: default avatarZhengchao Shao <shaozhengchao@huawei.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d266935a
    • Jakub Kicinski's avatar
      docs: netdev: offer performance feedback to contributors · c5884ef4
      Jakub Kicinski authored
      Some of us gotten used to producing large quantities of peer feedback
      at work, every 3 or 6 months. Extending the same courtesy to community
      members seems like a logical step. It may be hard for some folks to
      get validation of how important their work is internally, especially
      at smaller companies which don't employ many kernel experts.
      
      The concept of "peer feedback" may be a hyperscaler / silicon valley
      thing so YMMV. Hopefully we can build more context as we go.
      Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c5884ef4
    • David S. Miller's avatar
      Merge branch 'kcm-data-races' · 931ae86f
      David S. Miller authored
      Eric Dumazet says:
      
      ====================
      kcm: annotate data-races
      
      This series address two different syzbot reports for KCM.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      931ae86f
    • Eric Dumazet's avatar
      kcm: annotate data-races around kcm->rx_wait · 0c745b51
      Eric Dumazet authored
      kcm->rx_psock can be read locklessly in kcm_rfree().
      Annotate the read and writes accordingly.
      
      syzbot reported:
      
      BUG: KCSAN: data-race in kcm_rcv_strparser / kcm_rfree
      
      write to 0xffff88810784e3d0 of 1 bytes by task 1823 on cpu 1:
      reserve_rx_kcm net/kcm/kcmsock.c:283 [inline]
      kcm_rcv_strparser+0x250/0x3a0 net/kcm/kcmsock.c:363
      __strp_recv+0x64c/0xd20 net/strparser/strparser.c:301
      strp_recv+0x6d/0x80 net/strparser/strparser.c:335
      tcp_read_sock+0x13e/0x5a0 net/ipv4/tcp.c:1703
      strp_read_sock net/strparser/strparser.c:358 [inline]
      do_strp_work net/strparser/strparser.c:406 [inline]
      strp_work+0xe8/0x180 net/strparser/strparser.c:415
      process_one_work+0x3d3/0x720 kernel/workqueue.c:2289
      worker_thread+0x618/0xa70 kernel/workqueue.c:2436
      kthread+0x1a9/0x1e0 kernel/kthread.c:376
      ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306
      
      read to 0xffff88810784e3d0 of 1 bytes by task 17869 on cpu 0:
      kcm_rfree+0x121/0x220 net/kcm/kcmsock.c:181
      skb_release_head_state+0x8e/0x160 net/core/skbuff.c:841
      skb_release_all net/core/skbuff.c:852 [inline]
      __kfree_skb net/core/skbuff.c:868 [inline]
      kfree_skb_reason+0x5c/0x260 net/core/skbuff.c:891
      kfree_skb include/linux/skbuff.h:1216 [inline]
      kcm_recvmsg+0x226/0x2b0 net/kcm/kcmsock.c:1161
      ____sys_recvmsg+0x16c/0x2e0
      ___sys_recvmsg net/socket.c:2743 [inline]
      do_recvmmsg+0x2f1/0x710 net/socket.c:2837
      __sys_recvmmsg net/socket.c:2916 [inline]
      __do_sys_recvmmsg net/socket.c:2939 [inline]
      __se_sys_recvmmsg net/socket.c:2932 [inline]
      __x64_sys_recvmmsg+0xde/0x160 net/socket.c:2932
      do_syscall_x64 arch/x86/entry/common.c:50 [inline]
      do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
      entry_SYSCALL_64_after_hwframe+0x63/0xcd
      
      value changed: 0x01 -> 0x00
      
      Reported by Kernel Concurrency Sanitizer on:
      CPU: 0 PID: 17869 Comm: syz-executor.2 Not tainted 6.1.0-rc1-syzkaller-00010-gbb1a1146-dirty #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/22/2022
      
      Fixes: ab7ac4eb ("kcm: Kernel Connection Multiplexor module")
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0c745b51
    • Eric Dumazet's avatar
      kcm: annotate data-races around kcm->rx_psock · 15e4dabd
      Eric Dumazet authored
      kcm->rx_psock can be read locklessly in kcm_rfree().
      Annotate the read and writes accordingly.
      
      We do the same for kcm->rx_wait in the following patch.
      
      syzbot reported:
      BUG: KCSAN: data-race in kcm_rfree / unreserve_rx_kcm
      
      write to 0xffff888123d827b8 of 8 bytes by task 2758 on cpu 1:
      unreserve_rx_kcm+0x72/0x1f0 net/kcm/kcmsock.c:313
      kcm_rcv_strparser+0x2b5/0x3a0 net/kcm/kcmsock.c:373
      __strp_recv+0x64c/0xd20 net/strparser/strparser.c:301
      strp_recv+0x6d/0x80 net/strparser/strparser.c:335
      tcp_read_sock+0x13e/0x5a0 net/ipv4/tcp.c:1703
      strp_read_sock net/strparser/strparser.c:358 [inline]
      do_strp_work net/strparser/strparser.c:406 [inline]
      strp_work+0xe8/0x180 net/strparser/strparser.c:415
      process_one_work+0x3d3/0x720 kernel/workqueue.c:2289
      worker_thread+0x618/0xa70 kernel/workqueue.c:2436
      kthread+0x1a9/0x1e0 kernel/kthread.c:376
      ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306
      
      read to 0xffff888123d827b8 of 8 bytes by task 5859 on cpu 0:
      kcm_rfree+0x14c/0x220 net/kcm/kcmsock.c:181
      skb_release_head_state+0x8e/0x160 net/core/skbuff.c:841
      skb_release_all net/core/skbuff.c:852 [inline]
      __kfree_skb net/core/skbuff.c:868 [inline]
      kfree_skb_reason+0x5c/0x260 net/core/skbuff.c:891
      kfree_skb include/linux/skbuff.h:1216 [inline]
      kcm_recvmsg+0x226/0x2b0 net/kcm/kcmsock.c:1161
      ____sys_recvmsg+0x16c/0x2e0
      ___sys_recvmsg net/socket.c:2743 [inline]
      do_recvmmsg+0x2f1/0x710 net/socket.c:2837
      __sys_recvmmsg net/socket.c:2916 [inline]
      __do_sys_recvmmsg net/socket.c:2939 [inline]
      __se_sys_recvmmsg net/socket.c:2932 [inline]
      __x64_sys_recvmmsg+0xde/0x160 net/socket.c:2932
      do_syscall_x64 arch/x86/entry/common.c:50 [inline]
      do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
      entry_SYSCALL_64_after_hwframe+0x63/0xcd
      
      value changed: 0xffff88812971ce00 -> 0x0000000000000000
      
      Reported by Kernel Concurrency Sanitizer on:
      CPU: 0 PID: 5859 Comm: syz-executor.3 Not tainted 6.0.0-syzkaller-12189-g19d17ab7-dirty #0
      Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/22/2022
      
      Fixes: ab7ac4eb ("kcm: Kernel Connection Multiplexor module")
      Reported-by: default avatarsyzbot <syzkaller@googlegroups.com>
      Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      15e4dabd
    • Sean Anderson's avatar
      net: fman: Use physical address for userspace interfaces · c99f0f7e
      Sean Anderson authored
      Before 262f2b78 ("net: fman: Map the base address once"), the
      physical address of the MAC was exposed to userspace in two places: via
      sysfs and via SIOCGIFMAP. While this is not best practice, it is an
      external ABI which is in use by userspace software.
      
      The aforementioned commit inadvertently modified these addresses and
      made them virtual. This constitutes and ABI break.  Additionally, it
      leaks the kernel's memory layout to userspace. Partially revert that
      commit, reintroducing the resource back into struct mac_device, while
      keeping the intended changes (the rework of the address mapping).
      
      Fixes: 262f2b78 ("net: fman: Map the base address once")
      Reported-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
      Signed-off-by: default avatarSean Anderson <sean.anderson@seco.com>
      Acked-by: default avatarMadalin Bucur <madalin.bucur@oss.nxp.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c99f0f7e
    • Gayatri Kammela's avatar
      platform/x86/intel: pmc/core: Add Raptor Lake support to pmc core driver · 555a68dd
      Gayatri Kammela authored
      Add Raptor Lake client parts (both RPL and RPL_S) support to pmc core
      driver. Raptor Lake client parts reuse all the Alder Lake PCH IPs.
      
      Cc: Srinivas Pandruvada <srinivas.pandruvada@intel.com>
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: David Box <david.e.box@intel.com>
      Acked-by: default avatarRajneesh Bhardwaj <irenic.rajneesh@gmail.com>
      Signed-off-by: default avatarGayatri Kammela <gayatri.kammela@linux.intel.com>
      Link: https://lore.kernel.org/r/20220912233307.409954-2-gayatri.kammela@linux.intel.comReviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      555a68dd
    • Henning Schild's avatar
      leds: simatic-ipc-leds-gpio: fix incorrect LED to GPIO mapping · ee24395f
      Henning Schild authored
      For apollolake the mapping between LEDs and GPIO pins was off because of
      a refactoring when we introduced a new device model.
      In addition to the reordering the indices in the lookup table need to be
      updated as well.
      
      Fixes: a9712626 ("leds: simatic-ipc-leds-gpio: add new model 227G")
      Signed-off-by: default avatarHenning Schild <henning.schild@siemens.com>
      Link: https://lore.kernel.org/r/20221024092027.4529-1-henning.schild@siemens.comReviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      ee24395f
    • Leon Romanovsky's avatar
      net/mlx5e: Cleanup MACsec uninitialization routine · f8127476
      Leon Romanovsky authored
      The mlx5e_macsec_cleanup() routine has NULL pointer dereferencing if mlx5
      device doesn't support MACsec (priv->macsec will be NULL).
      
      While at it delete comment line, assignment and extra blank lines, so fix
      everything in one patch.
      
      Fixes: 1f53da67 ("net/mlx5e: Create advanced steering operation (ASO) object for MACsec")
      Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarLeon Romanovsky <leonro@nvidia.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f8127476
    • Mario Limonciello's avatar
      platform/x86/amd: pmc: Read SMU version during suspend on Cezanne systems · 0b6e6e14
      Mario Limonciello authored
      commit b0c07116 ("platform/x86: amd-pmc: Avoid reading SMU version at
      probe time") adjusted the behavior for amd-pmc to avoid reading the SMU
      version at startup but rather on first use to improve boot time.
      
      However the SMU version is also used to decide whether to place a timer
      based wakeup in the OS_HINT message. If the idlemask hasn't been read
      before this message was sent then the SMU version will not have been
      cached.
      
      Ensure the SMU version has been read before deciding whether or not to
      run this codepath.
      
      Cc: stable@vger.kernel.org # 6.0
      Reported-by: default avatarYou-Sheng Yang <vicamo.yang@canonical.com>
      Tested-by: default avatarAnson Tsao <anson.tsao@amd.com>
      Fixes: b0c07116 ("platform/x86: amd-pmc: Avoid reading SMU version at probe time")
      Signed-off-by: default avatarMario Limonciello <mario.limonciello@amd.com>
      Link: https://lore.kernel.org/r/20221020113749.6621-2-mario.limonciello@amd.comReviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      0b6e6e14
    • Íñigo Huguet's avatar
      atlantic: fix deadlock at aq_nic_stop · 6960d133
      Íñigo Huguet authored
      NIC is stopped with rtnl_lock held, and during the stop it cancels the
      'service_task' work and free irqs.
      
      However, if CONFIG_MACSEC is set, rtnl_lock is acquired both from
      aq_nic_service_task and aq_linkstate_threaded_isr. Then a deadlock
      happens if aq_nic_stop tries to cancel/disable them when they've already
      started their execution.
      
      As the deadlock is caused by rtnl_lock, it causes many other processes
      to stall, not only atlantic related stuff.
      
      Fix it by introducing a mutex that protects each NIC's macsec related
      data, and locking it instead of the rtnl_lock from the service task and
      the threaded IRQ.
      
      Before this patch, all macsec data was protected with rtnl_lock, but
      maybe not all of it needs to be protected. With this new mutex, further
      efforts can be made to limit the protected data only to that which
      requires it. However, probably it doesn't worth it because all macsec's
      data accesses are infrequent, and almost all are done from macsec_ops
      or ethtool callbacks, called holding rtnl_lock, so macsec_mutex won't
      never be much contended.
      
      The issue appeared repeteadly attaching and deattaching the NIC to a
      bond interface. Doing that after this patch I cannot reproduce the bug.
      
      Fixes: 62c1c2e6 ("net: atlantic: MACSec offload skeleton")
      Reported-by: default avatarLi Liang <liali@redhat.com>
      Suggested-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarÍñigo Huguet <ihuguet@redhat.com>
      Reviewed-by: default avatarIgor Russkikh <irusskikh@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6960d133
    • Jelle van der Waa's avatar
      platform/x86: thinkpad_acpi: Fix reporting a non present second fan on some models · a10d5098
      Jelle van der Waa authored
      thinkpad_acpi was reporting 2 fans on a ThinkPad T14s gen 1, even though
      the laptop has only 1 fan.
      
      The second, not present fan always reads 65535 (-1 in 16 bit signed),
      ignore fans which report 65535 to avoid reporting the non present fan.
      Signed-off-by: default avatarJelle van der Waa <jvanderwaa@redhat.com>
      Link: https://lore.kernel.org/r/20221019194751.5392-1-jvanderwaa@redhat.comReviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      a10d5098
    • Luke D. Jones's avatar
      platform/x86: asus-wmi: Add support for ROG X16 tablet mode · 36abde8d
      Luke D. Jones authored
      Add quirk for ASUS ROG X16 Flow 2-in-1 to enable tablet mode with
      lid flip (all screen rotations).
      Signed-off-by: default avatarLuke D. Jones <luke@ljones.dev>
      Link: https://lore.kernel.org/r/20221010063009.32293-1-luke@ljones.devReviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      36abde8d
  3. 23 Oct, 2022 1 commit