[20.04 FEAT] Enable proper kprobes on ftrace support

Bug #1865858 reported by bugproxy
14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu on IBM z Systems
Fix Released
High
Frank Heimes
linux (Ubuntu)
Fix Released
High
Frank Heimes

Bug Description

Our architecture backend already provides kprobes on ftrace support by allowing to setting a kprobe on the first instruction even if it is the ftrace nop or ftrace mcount instruction block.

This however still means that an illegal instruction is placed to the first instruction, which causes an exception and subsequent single stepping of the replaced instruction.

With proper kprobes on ftrace support there won't be an exception nor any single stepping - which means that kprobes placed at the first instruction will be much faster than now.

As a side effect by implementing this both the ftrace as well as the kprobes code will get a bit simpler.

Mandatory requirement for Performance Measurements!

Code available with kernel 5.6
https://github.com/torvalds/linux/commit/657480d9c01574d1e11bbb29e725db9907daf782

CVE References

bugproxy (bugproxy)
tags: added: architecture-s39064 bugnameltc-184162 severity-high targetmilestone-inin2004
Changed in ubuntu:
assignee: nobody → Skipper Bug Screeners (skipper-screen-team)
affects: ubuntu → linux (Ubuntu)
Revision history for this message
Frank Heimes (fheimes) wrote :

Looks like commit 657480d9c015 "s390: support KPROBES_ON_FTRACE" is in since 5.6-rc1

I tried to cherry pick (on top of focal master-next) but it failed:

$ git cherry-pick -x -s -e 657480d9c015
Auto-merging arch/s390/kernel/mcount.S
CONFLICT (content): Merge conflict in arch/s390/kernel/mcount.S
Auto-merging arch/s390/Kconfig
warning: inexact rename detection was skipped due to too many files.
warning: you may want to set your merge.renamelimit variable to at least 1670 and retry the command.
error: could not apply 657480d9c015... s390: support KPROBES_ON_FTRACE
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add <paths>' or 'git rm <paths>'
hint: and commit the result with 'git commit'

 git status
On branch master-next
Your branch is up to date with 'origin/master-next'.

You are currently cherry-picking commit 657480d9c015.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
 modified: Documentation/features/debug/kprobes-on-ftrace/arch-support.txt
 modified: arch/s390/Kconfig
 modified: arch/s390/include/asm/kprobes.h
 modified: arch/s390/kernel/ftrace.c
 modified: arch/s390/kernel/kprobes.c

Unmerged paths:
  (use "git add <file>..." to mark resolution)
 both modified: arch/s390/kernel/mcount.S

$ git difftool
diff --cc arch/s390/kernel/mcount.S
index 3431b2d5e334,7458dcfd6464..000000000000
--- a/arch/s390/kernel/mcount.S
+++ b/arch/s390/kernel/mcount.S
@@@ -41,6 -41,10 +41,13 @@@ EXPORT_SYMBOL(_mcount
  ENTRY(ftrace_caller)
   .globl ftrace_regs_caller
   .set ftrace_regs_caller,ftrace_caller
++<<<<<<< HEAD
++=======
+ stg %r14,(__SF_GPRS+8*8)(%r15) # save traced function caller
+ lghi %r14,0 # save condition code
+ ipm %r14 # don't put any instructions
+ sllg %r14,%r14,16 # clobbering CC before this point
++>>>>>>> 657480d9c015... s390: support KPROBES_ON_FTRACE
   lgr %r1,%r15
  #if !(defined(CC_USING_HOTPATCH) || defined(CC_USING_NOP_MCOUNT))
   aghi %r0,MCOUNT_RETURN_FIXUP

The conflict is in "arch/s390/kernel/mcount.S" assembler code.
Are there add. commits needed as pre-reqs? Or a backport?

Please can you check on top of focal master-next?
$ git clone https://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/focal --branch master-next --single-branch

Changed in ubuntu-z-systems:
status: New → Incomplete
Revision history for this message
bugproxy (bugproxy) wrote : Comment bridged from LTC Bugzilla

------- Comment From <email address hidden> 2020-03-03 09:59 EDT-------
Hi,

i think the easiest way is to also cherry-pick b4adfe55915d8363e244e42386d69567db1719b9.

So the following commands should work:

git cherry-pick b4adfe55915d8363e244e42386d69567db1719b9
git cherry-pick 657480d9c01574d1e11bbb29e725db9907daf782

Revision history for this message
Frank Heimes (fheimes) wrote :

Hi Sven, yes, that was the missing suspect. Thx!
Was able to cherry-pick things now - will soon sent he request to the ml ...

Changed in ubuntu-z-systems:
status: Incomplete → Triaged
Changed in linux (Ubuntu):
status: New → Triaged
Changed in ubuntu-z-systems:
importance: Undecided → High
Changed in linux (Ubuntu):
importance: Undecided → High
Changed in ubuntu-z-systems:
assignee: nobody → Frank Heimes (fheimes)
Changed in linux (Ubuntu):
assignee: Skipper Bug Screeners (skipper-screen-team) → Frank Heimes (fheimes)
Revision history for this message
Frank Heimes (fheimes) wrote :

Patch request submitted:
https://lists.ubuntu.com/archives/kernel-team/2020-March/thread.html#107969
changing status to 'In Progress'.

Changed in linux (Ubuntu):
status: Triaged → In Progress
Changed in ubuntu-z-systems:
status: Triaged → In Progress
information type: Private → Public
Frank Heimes (fheimes)
Changed in linux (Ubuntu):
status: In Progress → Fix Committed
Changed in ubuntu-z-systems:
status: In Progress → Fix Committed
Revision history for this message
Ubuntu Kernel Bot (ubuntu-kernel-bot) wrote :

This bug is awaiting verification that the kernel in -proposed solves the problem. Please test the kernel and update this bug with the results. If the problem is solved, change the tag 'verification-needed-focal' to 'verification-done-focal'. If the problem still exists, change the tag 'verification-needed-focal' to 'verification-failed-focal'.

If verification is not done by 5 working days from today, this fix will be dropped from the source code, and this bug will be closed.

See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you!

tags: added: verification-needed-focal
Frank Heimes (fheimes)
tags: added: verification-done-focal
removed: verification-needed-focal
Revision history for this message
Launchpad Janitor (janitor) wrote :
Download full text (81.5 KiB)

This bug was fixed in the package linux - 5.4.0-18.22

---------------
linux (5.4.0-18.22) focal; urgency=medium

  * focal/linux: 5.4.0-18.22 -proposed tracker (LP: #1866488)

  * Packaging resync (LP: #1786013)
    - [Packaging] resync getabis
    - [Packaging] update helper scripts

  * Add sysfs attribute to show remapped NVMe (LP: #1863621)
    - SAUCE: ata: ahci: Add sysfs attribute to show remapped NVMe device count

  * [20.04 FEAT] Compression improvements in Linux kernel (LP: #1830208)
    - lib/zlib: add s390 hardware support for kernel zlib_deflate
    - s390/boot: rename HEAP_SIZE due to name collision
    - lib/zlib: add s390 hardware support for kernel zlib_inflate
    - s390/boot: add dfltcc= kernel command line parameter
    - lib/zlib: add zlib_deflate_dfltcc_enabled() function
    - btrfs: use larger zlib buffer for s390 hardware compression
    - [Config] Introducing s390x specific kernel config option CONFIG_ZLIB_DFLTCC

  * [UBUNTU 20.04] s390x/pci: increase CONFIG_PCI_NR_FUNCTIONS to 512 in kernel
    config (LP: #1866056)
    - [Config] Increase CONFIG_PCI_NR_FUNCTIONS from 64 to 512 starting with focal
      on s390x

  * CONFIG_IP_MROUTE_MULTIPLE_TABLES is not set (LP: #1865332)
    - [Config] CONFIG_IP_MROUTE_MULTIPLE_TABLES=y

  * Dell XPS 13 9300 Intel 1650S wifi [34f0:1651] fails to load firmware
    (LP: #1865962)
    - iwlwifi: remove IWL_DEVICE_22560/IWL_DEVICE_FAMILY_22560
    - iwlwifi: 22000: fix some indentation
    - iwlwifi: pcie: rx: use rxq queue_size instead of constant
    - iwlwifi: allocate more receive buffers for HE devices
    - iwlwifi: remove some outdated iwl22000 configurations
    - iwlwifi: assume the driver_data is a trans_cfg, but allow full cfg

  * [FOCAL][REGRESSION] Intel Gen 9 brightness cannot be controlled
    (LP: #1861521)
    - Revert "USUNTU: SAUCE: drm/i915: Force DPCD backlight mode on Dell Precision
      4K sku"
    - Revert "UBUNTU: SAUCE: drm/i915: Force DPCD backlight mode on X1 Extreme 2nd
      Gen 4K AMOLED panel"
    - SAUCE: drm/dp: Introduce EDID-based quirks
    - SAUCE: drm/i915: Force DPCD backlight mode on X1 Extreme 2nd Gen 4K AMOLED
      panel
    - SAUCE: drm/i915: Force DPCD backlight mode for some Dell CML 2020 panels

  * [20.04 FEAT] Enable proper kprobes on ftrace support (LP: #1865858)
    - s390/ftrace: save traced function caller
    - s390: support KPROBES_ON_FTRACE

  * alsa/sof: load different firmware on different platforms (LP: #1857409)
    - ASoC: SOF: Intel: hda: use fallback for firmware name
    - ASoC: Intel: acpi-match: split CNL tables in three
    - ASoC: SOF: Intel: Fix CFL and CML FW nocodec binary names.

  * [UBUNTU 20.04] Enable CONFIG_NET_SWITCHDEV in kernel config for s390x
    starting with focal (LP: #1865452)
    - [Config] Enable CONFIG_NET_SWITCHDEV in kernel config for s390x starting
      with focal

  * Focal update: v5.4.24 upstream stable release (LP: #1866333)
    - io_uring: grab ->fs as part of async offload
    - EDAC: skx_common: downgrade message importance on missing PCI device
    - net: dsa: b53: Ensure the default VID is untagged
    - net: fib_rules: Correctly set table field when table number exceeds 8 bit...

Changed in linux (Ubuntu):
status: Fix Committed → Fix Released
Frank Heimes (fheimes)
Changed in ubuntu-z-systems:
status: Fix Committed → Fix Released
Revision history for this message
bugproxy (bugproxy) wrote :

------- Comment From <email address hidden> 2020-03-17 04:28 EDT-------
IBM Bugzilla status-> closed, Fix Released with focal

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.