Petr Mladek
e91c2518a5
livepatch: Initialize shadow variables safely by a custom callback
...
The existing API allows to pass a sample data to initialize the shadow
data. It works well when the data are position independent. But it fails
miserably when we need to set a pointer to the shadow structure itself.
Unfortunately, we might need to initialize the pointer surprisingly
often because of struct list_head. It is even worse because the list
might be hidden in other common structures, for example, struct mutex,
struct wait_queue_head.
For example, this was needed to fix races in ALSA sequencer. It required
to add mutex into struct snd_seq_client. See commit b3defb791b
("ALSA: seq: Make ioctls race-free") and commit d15d662e89
("ALSA: seq: Fix racy pool initializations")
This patch makes the API more safe. A custom constructor function and data
are passed to klp_shadow_*alloc() functions instead of the sample data.
Note that ctor_data are no longer a template for shadow->data. It might
point to any data that might be necessary when the constructor is called.
Also note that the constructor is called under klp_shadow_lock. It is
an internal spin_lock that synchronizes alloc() vs. get() operations,
see klp_shadow_get_or_alloc(). On one hand, this adds a risk of ABBA
deadlocks. On the other hand, it allows to do some operations safely.
For example, we could add the new structure into an existing list.
This must be done only once when the structure is allocated.
Reported-by: Nicolai Stange <nstange@suse.de>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
Acked-by: Miroslav Benes <mbenes@suse.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2018-04-17 13:42:48 +02:00
..
ABI
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/livepatching
2018-01-31 13:02:18 -08:00
accounting
acpi
admin-guide
Merge branch 'core-rcu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
2018-01-30 10:15:30 -08:00
aoe
arm
arm64
arm64 updates for 4.16:
2018-01-30 13:57:43 -08:00
auxdisplay
backlight
blackfin
block
blockdev
bpf
bus-devices
cdrom
cgroup-v1
Documentation: Fix 'file_mapped' -> 'mapped_file'
2018-01-30 09:52:11 -08:00
cma
connector
console
core-api
genericirq.rst: Remove :c:func:... in code blocks
2017-12-02 08:41:46 -07:00
cpu-freq
cpuidle
cris
crypto
dev-tools
device-mapper
dm cache: Documentation: update default migration_throttling value
2018-01-30 16:55:47 -05:00
devicetree
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
2018-01-31 13:00:01 -08:00
doc-guide
driver-api
DMAengine updates for v4.16-rc1
2018-01-31 11:52:20 -08:00
driver-model
serdev: Introduce devm_serdev_device_open()
2018-01-08 10:08:34 +00:00
early-userspace
EDID
extcon
fault-injection
fb
features
Xtensa improvements for v4.16:
2018-01-29 16:40:28 -08:00
filesystems
Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
2018-01-31 09:25:20 -08:00
firmware_class
fmc
fpga
frv
gpio
gpio: Fix a documentation spelling mistake
2018-01-21 16:52:31 +01:00
gpu
docs: fix, intel_guc_loader.c has been moved to intel_guc_fw.c
2018-01-02 17:21:51 +02:00
hid
hwmon
hwmon: (pmbus/max31785) Add dual tachometer support
2018-01-02 15:05:34 -08:00
i2c
ia64
ide
iio
infiniband
input
HID: hid-multitouch: support fine-grain orientation reporting
2017-12-01 10:01:01 +01:00
ioctl
isdn
kbuild
kconfig: fix relational operators for bool and tristate symbols
2018-01-06 02:31:23 +09:00
kdump
kernel-hacking
laptops
leds
lightnvm
livepatch
livepatch: Initialize shadow variables safely by a custom callback
2018-04-17 13:42:48 +02:00
locking
Merge branch 'for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu into core/rcu
2018-01-03 14:14:18 +01:00
m68k
md
raid5-ppl: PPL support for disks with write-back cache enabled
2018-01-15 14:29:42 -08:00
media
media: docs: add documentation for frontend attach info
2017-11-30 04:19:04 -05:00
memory-devices
metag
mic
mips
misc-devices
mmc
mn10300
mtd
mtd: spi-nor: add an API to restore the status of SPI flash chip
2017-12-13 00:36:00 +01:00
namespaces
netlabel
networking
doc: clarification about setting SO_ZEROCOPY
2018-01-10 15:01:49 -05:00
nfc
nios2
nvdimm
nvmem
openrisc
parisc
PCI
pcmcia
perf
perf: ARM DynamIQ Shared Unit PMU support
2018-01-02 16:43:12 +00:00
phy
platform
power
regulator: Changes for v4.16
2018-01-29 11:32:44 -08:00
powerpc
pps
process
Merge branch 'perf/urgent' into perf/core, to pick up fixes and to refresh to v4.15
2017-12-06 23:37:06 +01:00
pti
ptp
rapidio
RCU
Merge branches 'cond_resched.2017.12.04a', 'dyntick.2017.11.28a', 'fixes.2017.12.11a', 'srbd.2017.12.05a' and 'torture.2017.12.11a' into HEAD
2017-12-11 09:21:58 -08:00
s390
scheduler
scsi
scsi: documentation: Fix case of 'scsi_device' struct mention(s)
2017-12-02 08:43:43 -07:00
security
serial
sh
sound
sparc
sphinx
sphinx-static
spi
sysctl
Revert "mm/page-writeback.c: print a warning if the vm dirtiness settings are illogical"
2017-11-29 18:40:43 -08:00
target
thermal
cpu_cooling: Remove static-power related documentation
2018-01-03 13:11:48 +01:00
timers
trace
translations
A few late-arriving docs updates that have no real reason to wait. There's
2017-11-23 21:01:32 -10:00
usb
Documentation: usb: fix typo in UVC gadgetfs config command
2018-01-11 18:39:52 +01:00
userspace-api
virtual
KVM: PPC: Book3S: Provide information about hardware/firmware CVE workarounds
2018-01-19 15:17:01 +11:00
vm
Documentation/vm/zswap.txt: update with same-value filled page feature
2017-12-14 16:00:48 -08:00
w1
w1: w1-gpio: Convert to use GPIO descriptors
2017-12-08 15:32:53 +01:00
watchdog
wimax
x86
Merge branch 'x86-cache-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
2018-01-29 17:48:22 -08:00
xtensa
xtensa: add support for KASAN
2017-12-16 22:37:12 -08:00
.gitignore
00-INDEX
atomic_bitops.txt
atomic_t.txt
bcache.txt
bt8xxgpio.txt
btmrvl.txt
bus-virt-phys-mapping.txt
cachetlb.txt
cgroup-v2.txt
cgroup, docs: document the root cgroup behavior of cpu and io controllers
2018-01-16 08:07:09 -08:00
Changes
circular-buffers.txt
doc: De-emphasize smp_read_barrier_depends
2017-12-05 11:57:53 -08:00
clearing-warn-once.txt
clk.txt
CodingStyle
conf.py
cpu-load.txt
cputopology.txt
crc32.txt
dcdbas.txt
debugging-modules.txt
debugging-via-ohci1394.txt
dell_rbu.txt
digsig.txt
DMA-API-HOWTO.txt
DMA-API.txt
DMA-attributes.txt
DMA-ISA-LPC.txt
docutils.conf
dontdiff
efi-stub.txt
eisa.txt
errseq.rst
flexible-arrays.txt
futex-requeue-pi.txt
gcc-plugins.txt
highuid.txt
hw_random.txt
hwspinlock.txt
index.rst
Intel-IOMMU.txt
intel_txt.txt
io-mapping.txt
io_ordering.txt
iostats.txt
IPMI.txt
IRQ-affinity.txt
IRQ-domain.txt
irqdomain: Kill CONFIG_IRQ_DOMAIN_DEBUG
2018-01-24 12:32:58 +01:00
IRQ.txt
irqflags-tracing.txt
isa.txt
isapnp.txt
kernel-doc-nano-HOWTO.txt
kernel-per-CPU-kthreads.txt
kobject.txt
kprobes.txt
kref.txt
ldm.txt
lockup-watchdogs.txt
logo.gif
logo.txt
lsm.txt
lzo.txt
mailbox.txt
Makefile
memory-barriers.txt
doc: De-emphasize smp_read_barrier_depends
2017-12-05 11:57:53 -08:00
memory-hotplug.txt
men-chameleon-bus.txt
nommu-mmap.txt
ntb.txt
numastat.txt
padata.txt
parport-lowlevel.txt
percpu-rw-semaphore.txt
phy.txt
pi-futex.txt
pnp.txt
preempt-locking.txt
printk-formats.txt
vsprintf: add printk specifier %px
2017-11-29 12:13:14 +11:00
pwm.txt
rbtree.txt
remoteproc.txt
rfkill.txt
robust-futex-ABI.txt
robust-futexes.txt
rpmsg.txt
rtc.txt
SAK.txt
sgi-ioc4.txt
siphash.txt
SM501.txt
smsc_ece1099.txt
static-keys.txt
SubmittingPatches
svga.txt
switchtec.txt
sync_file.txt
tee.txt
this_cpu_ops.txt
unaligned-memory-access.txt
vfio-mediated-device.txt
vfio.txt
video-output.txt
xillybus.txt
xz.txt
zorro.txt