mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
This is the 5.4.33 stable release
-----BEGIN PGP SIGNATURE-----
iQIzBAABCAAdFiEEZH8oZUiU471FcZm+ONu9yGCSaT4FAl6ZbdIACgkQONu9yGCS
aT5Jqw/7BZ639nTAAmz809yOF1JBhvBptRg9tBKYAfw62DzfZe5s9IZA6znIt0f0
nlluLvnhHlDSpgycHNkFry5AkiCUpRQW6NY681xITm918w3BxsKX2pfCawojIOSw
YBaTWoWqNFQQWlC18L1CWJmIvIktSCHXBMTVDpnvRv7sw5A4Oe/zarzVDNb0A6OJ
ThaR7LAKJrUEDDLuCOuB/IrYCOpOzg2SkViFmlo4wmmhvCSi8PXvf3royrSFXxM/
Y1bs67Hu/uqeHl8Y2RaMZpXf1aW9F31sooca4GD+UnVoWppjIOKRyuGLTrXKv7pw
/goIzlE8wfJz5K0iQ4UcbXwwdY81L9UlMdVsmIWHHgxMjSp1J5mfQ5TLUC/VK3UO
Ll9tCYBwH4FjzxNRJq7if8TDAfgPzyhw4BMchgXZWzW1oasl51T2uEye3KgFXQSb
u6TwCx4KGS0w/Q81SKis83Pb0unHGanJOSCZxI1B44raf0ruCBpTYUc713pfegWT
46YtwoorAK8N+GpFQA1tsTJvVclqCF5bHVE19TMvXV4UX/VTPtbIAUE7vnvcxcqO
uh0b9Jfmd6Fcgh7VZQCH7CUYnsyJmGqj2kycB1p+T8UB6H+PCeuQBZBl8sJnf8oj
d5NIzB7WWXBQuEG5XuPtxg6+ARMPEIpd2exEVn9ZOv5qhesBo04=
=pjAq
-----END PGP SIGNATURE-----
Merge 5.4.33 into android-5.4-stable
Changes in 5.4.33
ARM: dts: sun8i-a83t-tbs-a711: HM5065 doesn't like such a high voltage
bus: sunxi-rsb: Return correct data when mixing 16-bit and 8-bit reads
ARM: dts: Fix dm814x Ethernet by changing to use rgmii-id mode
bpf: Fix deadlock with rq_lock in bpf_send_signal()
iwlwifi: mvm: Fix rate scale NSS configuration
Input: tm2-touchkey - add support for Coreriver TC360 variant
soc: fsl: dpio: register dpio irq handlers after dpio create
rxrpc: Abstract out the calculation of whether there's Tx space
rxrpc: Fix call interruptibility handling
net: stmmac: platform: Fix misleading interrupt error msg
net: vxge: fix wrong __VA_ARGS__ usage
hinic: fix a bug of waitting for IO stopped
hinic: fix the bug of clearing event queue
hinic: fix out-of-order excution in arm cpu
hinic: fix wrong para of wait_for_completion_timeout
hinic: fix wrong value of MIN_SKB_LEN
selftests/net: add definition for SOL_DCCP to fix compilation errors for old libc
cxgb4/ptp: pass the sign of offset delta in FW CMD
drm/scheduler: fix rare NULL ptr race
cfg80211: Do not warn on same channel at the end of CSA
qlcnic: Fix bad kzalloc null test
i2c: st: fix missing struct parameter description
i2c: pca-platform: Use platform_irq_get_optional
media: rc: add keymap for Videostrong KII Pro
cpufreq: imx6q: Fixes unwanted cpu overclocking on i.MX6ULL
staging: wilc1000: avoid double unlocking of 'wilc->hif_cs' mutex
media: venus: hfi_parser: Ignore HEVC encoding for V1
firmware: arm_sdei: fix double-lock on hibernate with shared events
null_blk: Fix the null_add_dev() error path
null_blk: Handle null_add_dev() failures properly
null_blk: fix spurious IO errors after failed past-wp access
media: imx: imx7_mipi_csis: Power off the source when stopping streaming
media: imx: imx7-media-csi: Fix video field handling
xhci: bail out early if driver can't accress host in resume
ACPI: EC: Do not clear boot_ec_is_ecdt in acpi_ec_add()
x86: Don't let pgprot_modify() change the page encryption bit
dma-mapping: Fix dma_pgprot() for unencrypted coherent pages
block: keep bdi->io_pages in sync with max_sectors_kb for stacked devices
debugfs: Check module state before warning in {full/open}_proxy_open()
irqchip/versatile-fpga: Handle chained IRQs properly
time/sched_clock: Expire timer in hardirq context
media: allegro: fix type of gop_length in channel_create message
sched: Avoid scale real weight down to zero
selftests/x86/ptrace_syscall_32: Fix no-vDSO segfault
PCI/switchtec: Fix init_completion race condition with poll_wait()
block, bfq: move forward the getting of an extra ref in bfq_bfqq_move
media: i2c: video-i2c: fix build errors due to 'imply hwmon'
libata: Remove extra scsi_host_put() in ata_scsi_add_hosts()
pstore/platform: fix potential mem leak if pstore_init_fs failed
gfs2: Do log_flush in gfs2_ail_empty_gl even if ail list is empty
gfs2: Don't demote a glock until its revokes are written
cpufreq: imx6q: fix error handling
x86/boot: Use unsigned comparison for addresses
efi/x86: Ignore the memory attributes table on i386
genirq/irqdomain: Check pointer in irq_domain_alloc_irqs_hierarchy()
block: Fix use-after-free issue accessing struct io_cq
media: i2c: ov5695: Fix power on and off sequences
usb: dwc3: core: add support for disabling SS instances in park mode
irqchip/gic-v4: Provide irq_retrigger to avoid circular locking dependency
md: check arrays is suspended in mddev_detach before call quiesce operations
firmware: fix a double abort case with fw_load_sysfs_fallback
spi: spi-fsl-dspi: Replace interruptible wait queue with a simple completion
locking/lockdep: Avoid recursion in lockdep_count_{for,back}ward_deps()
block, bfq: fix use-after-free in bfq_idle_slice_timer_body
btrfs: qgroup: ensure qgroup_rescan_running is only set when the worker is at least queued
btrfs: remove a BUG_ON() from merge_reloc_roots()
btrfs: restart relocate_tree_blocks properly
btrfs: track reloc roots based on their commit root bytenr
ASoC: fix regwmask
ASoC: dapm: connect virtual mux with default value
ASoC: dpcm: allow start or stop during pause for backend
ASoC: topology: use name_prefix for new kcontrol
usb: gadget: f_fs: Fix use after free issue as part of queue failure
usb: gadget: composite: Inform controller driver of self-powered
ALSA: usb-audio: Add mixer workaround for TRX40 and co
ALSA: hda: Add driver blacklist
ALSA: hda: Fix potential access overflow in beep helper
ALSA: ice1724: Fix invalid access for enumerated ctl items
ALSA: pcm: oss: Fix regression by buffer overflow fix
ALSA: hda/realtek: Enable mute LED on an HP system
ALSA: hda/realtek - a fake key event is triggered by running shutup
ALSA: doc: Document PC Beep Hidden Register on Realtek ALC256
ALSA: hda/realtek - Set principled PC Beep configuration for ALC256
ALSA: hda/realtek - Remove now-unnecessary XPS 13 headphone noise fixups
ALSA: hda/realtek - Add quirk for Lenovo Carbon X1 8th gen
ALSA: hda/realtek - Add quirk for MSI GL63
media: venus: firmware: Ignore secure call error on first resume
media: hantro: Read be32 words starting at every fourth byte
media: ti-vpe: cal: fix disable_irqs to only the intended target
media: ti-vpe: cal: fix a kernel oops when unloading module
seccomp: Add missing compat_ioctl for notify
acpi/x86: ignore unspecified bit positions in the ACPI global lock field
ACPICA: Allow acpi_any_gpe_status_set() to skip one GPE
ACPI: PM: s2idle: Refine active GPEs check
thermal: devfreq_cooling: inline all stubs for CONFIG_DEVFREQ_THERMAL=n
nvmet-tcp: fix maxh2cdata icresp parameter
nvme-fc: Revert "add module to ops template to allow module references"
efi/x86: Add TPM related EFI tables to unencrypted mapping checks
PCI: pciehp: Fix indefinite wait on sysfs requests
PCI/ASPM: Clear the correct bits when enabling L1 substates
PCI: Add boot interrupt quirk mechanism for Xeon chipsets
PCI: qcom: Fix the fixup of PCI_VENDOR_ID_QCOM
PCI: endpoint: Fix for concurrent memory allocation in OB address region
sched/fair: Fix enqueue_task_fair warning
tpm: Don't make log failures fatal
tpm: tpm1_bios_measurements_next should increase position index
tpm: tpm2_bios_measurements_next should increase position index
KEYS: reaching the keys quotas correctly
cpu/hotplug: Ignore pm_wakeup_pending() for disable_nonboot_cpus()
genirq/debugfs: Add missing sanity checks to interrupt injection
irqchip/versatile-fpga: Apply clear-mask earlier
io_uring: remove bogus RLIMIT_NOFILE check in file registration
pstore: pstore_ftrace_seq_next should increase position index
MIPS/tlbex: Fix LDDIR usage in setup_pw() for Loongson-3
MIPS: OCTEON: irq: Fix potential NULL pointer dereference
PM / Domains: Allow no domain-idle-states DT property in genpd when parsing
PM: sleep: wakeup: Skip wakeup_source_sysfs_remove() if device is not there
ath9k: Handle txpower changes even when TPC is disabled
signal: Extend exec_id to 64bits
x86/tsc_msr: Use named struct initializers
x86/tsc_msr: Fix MSR_FSB_FREQ mask for Cherry Trail devices
x86/tsc_msr: Make MSR derived TSC frequency more accurate
x86/entry/32: Add missing ASM_CLAC to general_protection entry
platform/x86: asus-wmi: Support laptops where the first battery is named BATT
KVM: nVMX: Properly handle userspace interrupt window request
KVM: s390: vsie: Fix region 1 ASCE sanity shadow address checks
KVM: s390: vsie: Fix delivery of addressing exceptions
KVM: x86: Allocate new rmap and large page tracking when moving memslot
KVM: VMX: Always VMCLEAR in-use VMCSes during crash with kexec support
KVM: x86: Gracefully handle __vmalloc() failure during VM allocation
KVM: VMX: Add a trampoline to fix VMREAD error handling
KVM: VMX: fix crash cleanup when KVM wasn't used
smb3: fix performance regression with setting mtime
CIFS: Fix bug which the return value by asynchronous read is error
mtd: spinand: Stop using spinand->oobbuf for buffering bad block markers
mtd: spinand: Do not erase the block before writing a bad block marker
btrfs: Don't submit any btree write bio if the fs has errors
Btrfs: fix crash during unmount due to race with delayed inode workers
btrfs: reloc: clean dirty subvols if we fail to start a transaction
btrfs: set update the uuid generation as soon as possible
btrfs: drop block from cache on error in relocation
btrfs: fix missing file extent item for hole after ranged fsync
btrfs: unset reloc control if we fail to recover
btrfs: fix missing semaphore unlock in btrfs_sync_file
btrfs: use nofs allocations for running delayed items
remoteproc: qcom_q6v5_mss: Don't reassign mpss region on shutdown
remoteproc: qcom_q6v5_mss: Reload the mba region on coredump
remoteproc: Fix NULL pointer dereference in rproc_virtio_notify
crypto: rng - Fix a refcounting bug in crypto_rng_reset()
crypto: mxs-dcp - fix scatterlist linearization for hash
erofs: correct the remaining shrink objects
io_uring: honor original task RLIMIT_FSIZE
mmc: sdhci-of-esdhc: fix esdhc_reset() for different controller versions
powerpc/pseries: Drop pointless static qualifier in vpa_debugfs_init()
tools: gpio: Fix out-of-tree build regression
net: qualcomm: rmnet: Allow configuration updates to existing devices
arm64: dts: allwinner: h6: Fix PMU compatible
sched/core: Remove duplicate assignment in sched_tick_remote()
arm64: dts: allwinner: h5: Fix PMU compatible
mm, memcg: do not high throttle allocators based on wraparound
dm writecache: add cond_resched to avoid CPU hangs
dm integrity: fix a crash with unusually large tag size
dm verity fec: fix memory leak in verity_fec_dtr
dm clone: Add overflow check for number of regions
dm clone metadata: Fix return type of dm_clone_nr_of_hydrated_regions()
XArray: Fix xas_pause for large multi-index entries
xarray: Fix early termination of xas_for_each_marked
crypto: caam/qi2 - fix chacha20 data size error
crypto: caam - update xts sector size for large input length
crypto: ccree - protect against empty or NULL scatterlists
crypto: ccree - only try to map auth tag if needed
crypto: ccree - dec auth tag size from cryptlen map
scsi: zfcp: fix missing erp_lock in port recovery trigger for point-to-point
scsi: ufs: fix Auto-Hibern8 error detection
scsi: lpfc: Fix lpfc_io_buf resource leak in lpfc_get_scsi_buf_s4 error path
ARM: dts: exynos: Fix polarity of the LCD SPI bus on UniversalC210 board
arm64: dts: ti: k3-am65: Add clocks to dwc3 nodes
arm64: armv8_deprecated: Fix undef_hook mask for thumb setend
selftests: vm: drop dependencies on page flags from mlock2 tests
selftests/vm: fix map_hugetlb length used for testing read and write
selftests/powerpc: Add tlbie_test in .gitignore
vfio: platform: Switch to platform_get_irq_optional()
drm/i915/gem: Flush all the reloc_gpu batch
drm/etnaviv: rework perfmon query infrastructure
drm: Remove PageReserved manipulation from drm_pci_alloc
drm/amdgpu/powerplay: using the FCLK DPM table to set the MCLK
drm/amdgpu: unify fw_write_wait for new gfx9 asics
powerpc/pseries: Avoid NULL pointer dereference when drmem is unavailable
nfsd: fsnotify on rmdir under nfsd/clients/
NFS: Fix use-after-free issues in nfs_pageio_add_request()
NFS: Fix a page leak in nfs_destroy_unlinked_subrequests()
ext4: fix a data race at inode->i_blocks
fs/filesystems.c: downgrade user-reachable WARN_ONCE() to pr_warn_once()
ocfs2: no need try to truncate file beyond i_size
perf tools: Support Python 3.8+ in Makefile
s390/diag: fix display of diagnose call statistics
Input: i8042 - add Acer Aspire 5738z to nomux list
ftrace/kprobe: Show the maxactive number on kprobe_events
clk: ingenic/jz4770: Exit with error if CGU init failed
clk: ingenic/TCU: Fix round_rate returning error
kmod: make request_module() return an error when autoloading is disabled
cpufreq: powernv: Fix use-after-free
hfsplus: fix crash and filesystem corruption when deleting files
libata: Return correct status in sata_pmp_eh_recover_pm() when ATA_DFLAG_DETACH is set
ipmi: fix hung processes in __get_guid()
xen/blkfront: fix memory allocation flags in blkfront_setup_indirect()
powerpc/64/tm: Don't let userspace set regs->trap via sigreturn
powerpc/fsl_booke: Avoid creating duplicate tlb1 entry
powerpc/hash64/devmap: Use H_PAGE_THP_HUGE when setting up huge devmap PTE entries
powerpc/xive: Use XIVE_BAD_IRQ instead of zero to catch non configured IPIs
powerpc/64: Setup a paca before parsing device tree etc.
powerpc/xive: Fix xmon support on the PowerNV platform
powerpc/kprobes: Ignore traps that happened in real mode
powerpc/64: Prevent stack protection in early boot
scsi: mpt3sas: Fix kernel panic observed on soft HBA unplug
powerpc: Make setjmp/longjmp signature standard
arm64: Always force a branch protection mode when the compiler has one
dm zoned: remove duplicate nr_rnd_zones increase in dmz_init_zone()
dm clone: replace spin_lock_irqsave with spin_lock_irq
dm clone: Fix handling of partial region discards
dm clone: Add missing casts to prevent overflows and data corruption
scsi: lpfc: Add registration for CPU Offline/Online events
scsi: lpfc: Fix Fabric hostname registration if system hostname changes
scsi: lpfc: Fix configuration of BB credit recovery in service parameters
scsi: lpfc: Fix broken Credit Recovery after driver load
Revert "drm/dp_mst: Remove VCPI while disabling topology mgr"
drm/dp_mst: Fix clearing payload state on topology disable
drm/amdgpu: fix gfx hang during suspend with video playback (v2)
drm/i915/icl+: Don't enable DDI IO power on a TypeC port in TBT mode
powerpc/kasan: Fix kasan_remap_early_shadow_ro()
mmc: sdhci: Convert sdhci_set_timeout_irq() to non-static
mmc: sdhci: Refactor sdhci_set_timeout()
bpf: Fix tnum constraints for 32-bit comparisons
mfd: dln2: Fix sanity checking for endpoints
efi/x86: Fix the deletion of variables in mixed mode
ASoC: stm32: sai: Add missing cleanup
scsi: lpfc: fix inlining of lpfc_sli4_cleanup_poll_list()
Linux 5.4.33
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Change-Id: I6c37e2c64801a572781c46fc5883bcc74e6a7a1a
This commit is contained in:
commit
a9372c6b57
266 changed files with 2951 additions and 1278 deletions
|
|
@ -7,8 +7,8 @@ LDLIBS+= -lpthread -lurcu
|
|||
TARGETS = main idr-test multiorder xarray
|
||||
CORE_OFILES := xarray.o radix-tree.o idr.o linux.o test.o find_bit.o bitmap.o
|
||||
OFILES = main.o $(CORE_OFILES) regression1.o regression2.o regression3.o \
|
||||
regression4.o \
|
||||
tag_check.o multiorder.o idr-test.o iteration_check.o benchmark.o
|
||||
regression4.o tag_check.o multiorder.o idr-test.o iteration_check.o \
|
||||
iteration_check_2.o benchmark.o
|
||||
|
||||
ifndef SHIFT
|
||||
SHIFT=3
|
||||
|
|
|
|||
87
tools/testing/radix-tree/iteration_check_2.c
Normal file
87
tools/testing/radix-tree/iteration_check_2.c
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* iteration_check_2.c: Check that deleting a tagged entry doesn't cause
|
||||
* an RCU walker to finish early.
|
||||
* Copyright (c) 2020 Oracle
|
||||
* Author: Matthew Wilcox <willy@infradead.org>
|
||||
*/
|
||||
#include <pthread.h>
|
||||
#include "test.h"
|
||||
|
||||
static volatile bool test_complete;
|
||||
|
||||
static void *iterator(void *arg)
|
||||
{
|
||||
XA_STATE(xas, arg, 0);
|
||||
void *entry;
|
||||
|
||||
rcu_register_thread();
|
||||
|
||||
while (!test_complete) {
|
||||
xas_set(&xas, 0);
|
||||
rcu_read_lock();
|
||||
xas_for_each_marked(&xas, entry, ULONG_MAX, XA_MARK_0)
|
||||
;
|
||||
rcu_read_unlock();
|
||||
assert(xas.xa_index >= 100);
|
||||
}
|
||||
|
||||
rcu_unregister_thread();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void *throbber(void *arg)
|
||||
{
|
||||
struct xarray *xa = arg;
|
||||
|
||||
rcu_register_thread();
|
||||
|
||||
while (!test_complete) {
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 100; i++) {
|
||||
xa_store(xa, i, xa_mk_value(i), GFP_KERNEL);
|
||||
xa_set_mark(xa, i, XA_MARK_0);
|
||||
}
|
||||
for (i = 0; i < 100; i++)
|
||||
xa_erase(xa, i);
|
||||
}
|
||||
|
||||
rcu_unregister_thread();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void iteration_test2(unsigned test_duration)
|
||||
{
|
||||
pthread_t threads[2];
|
||||
DEFINE_XARRAY(array);
|
||||
int i;
|
||||
|
||||
printv(1, "Running iteration test 2 for %d seconds\n", test_duration);
|
||||
|
||||
test_complete = false;
|
||||
|
||||
xa_store(&array, 100, xa_mk_value(100), GFP_KERNEL);
|
||||
xa_set_mark(&array, 100, XA_MARK_0);
|
||||
|
||||
if (pthread_create(&threads[0], NULL, iterator, &array)) {
|
||||
perror("create iterator thread");
|
||||
exit(1);
|
||||
}
|
||||
if (pthread_create(&threads[1], NULL, throbber, &array)) {
|
||||
perror("create throbber thread");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
sleep(test_duration);
|
||||
test_complete = true;
|
||||
|
||||
for (i = 0; i < 2; i++) {
|
||||
if (pthread_join(threads[i], NULL)) {
|
||||
perror("pthread_join");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
xa_destroy(&array);
|
||||
}
|
||||
|
|
@ -311,6 +311,7 @@ int main(int argc, char **argv)
|
|||
regression4_test();
|
||||
iteration_test(0, 10 + 90 * long_run);
|
||||
iteration_test(7, 10 + 90 * long_run);
|
||||
iteration_test2(10 + 90 * long_run);
|
||||
single_thread_tests(long_run);
|
||||
|
||||
/* Free any remaining preallocated nodes */
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ void xarray_tests(void);
|
|||
void tag_check(void);
|
||||
void multiorder_checks(void);
|
||||
void iteration_test(unsigned order, unsigned duration);
|
||||
void iteration_test2(unsigned duration);
|
||||
void benchmark(void);
|
||||
void idr_checks(void);
|
||||
void ida_tests(void);
|
||||
|
|
|
|||
|
|
@ -21,6 +21,10 @@
|
|||
#include <sys/socket.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifndef SOL_DCCP
|
||||
#define SOL_DCCP 269
|
||||
#endif
|
||||
|
||||
static const char *IP4_ADDR = "127.0.0.1";
|
||||
static const char *IP6_ADDR = "::1";
|
||||
static const char *IP4_MAPPED6 = "::ffff:127.0.0.1";
|
||||
|
|
|
|||
|
|
@ -5,3 +5,4 @@ prot_sao
|
|||
segv_errors
|
||||
wild_bctr
|
||||
large_vm_fork_separation
|
||||
tlbie_test
|
||||
|
|
|
|||
|
|
@ -45,20 +45,20 @@ static void check_bytes(char *addr)
|
|||
printf("First hex is %x\n", *((unsigned int *)addr));
|
||||
}
|
||||
|
||||
static void write_bytes(char *addr)
|
||||
static void write_bytes(char *addr, size_t length)
|
||||
{
|
||||
unsigned long i;
|
||||
|
||||
for (i = 0; i < LENGTH; i++)
|
||||
for (i = 0; i < length; i++)
|
||||
*(addr + i) = (char)i;
|
||||
}
|
||||
|
||||
static int read_bytes(char *addr)
|
||||
static int read_bytes(char *addr, size_t length)
|
||||
{
|
||||
unsigned long i;
|
||||
|
||||
check_bytes(addr);
|
||||
for (i = 0; i < LENGTH; i++)
|
||||
for (i = 0; i < length; i++)
|
||||
if (*(addr + i) != (char)i) {
|
||||
printf("Mismatch at %lu\n", i);
|
||||
return 1;
|
||||
|
|
@ -96,11 +96,11 @@ int main(int argc, char **argv)
|
|||
|
||||
printf("Returned address is %p\n", addr);
|
||||
check_bytes(addr);
|
||||
write_bytes(addr);
|
||||
ret = read_bytes(addr);
|
||||
write_bytes(addr, length);
|
||||
ret = read_bytes(addr, length);
|
||||
|
||||
/* munmap() length of MAP_HUGETLB memory must be hugepage aligned */
|
||||
if (munmap(addr, LENGTH)) {
|
||||
if (munmap(addr, length)) {
|
||||
perror("munmap");
|
||||
exit(1);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,59 +67,6 @@ out:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static uint64_t get_pageflags(unsigned long addr)
|
||||
{
|
||||
FILE *file;
|
||||
uint64_t pfn;
|
||||
unsigned long offset;
|
||||
|
||||
file = fopen("/proc/self/pagemap", "r");
|
||||
if (!file) {
|
||||
perror("fopen pagemap");
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
offset = addr / getpagesize() * sizeof(pfn);
|
||||
|
||||
if (fseek(file, offset, SEEK_SET)) {
|
||||
perror("fseek pagemap");
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
if (fread(&pfn, sizeof(pfn), 1, file) != 1) {
|
||||
perror("fread pagemap");
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
fclose(file);
|
||||
return pfn;
|
||||
}
|
||||
|
||||
static uint64_t get_kpageflags(unsigned long pfn)
|
||||
{
|
||||
uint64_t flags;
|
||||
FILE *file;
|
||||
|
||||
file = fopen("/proc/kpageflags", "r");
|
||||
if (!file) {
|
||||
perror("fopen kpageflags");
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
if (fseek(file, pfn * sizeof(flags), SEEK_SET)) {
|
||||
perror("fseek kpageflags");
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
if (fread(&flags, sizeof(flags), 1, file) != 1) {
|
||||
perror("fread kpageflags");
|
||||
_exit(1);
|
||||
}
|
||||
|
||||
fclose(file);
|
||||
return flags;
|
||||
}
|
||||
|
||||
#define VMFLAGS "VmFlags:"
|
||||
|
||||
static bool is_vmflag_set(unsigned long addr, const char *vmflag)
|
||||
|
|
@ -159,19 +106,13 @@ out:
|
|||
#define RSS "Rss:"
|
||||
#define LOCKED "lo"
|
||||
|
||||
static bool is_vma_lock_on_fault(unsigned long addr)
|
||||
static unsigned long get_value_for_name(unsigned long addr, const char *name)
|
||||
{
|
||||
bool ret = false;
|
||||
bool locked;
|
||||
FILE *smaps = NULL;
|
||||
unsigned long vma_size, vma_rss;
|
||||
char *line = NULL;
|
||||
char *value;
|
||||
size_t size = 0;
|
||||
|
||||
locked = is_vmflag_set(addr, LOCKED);
|
||||
if (!locked)
|
||||
goto out;
|
||||
char *value_ptr;
|
||||
FILE *smaps = NULL;
|
||||
unsigned long value = -1UL;
|
||||
|
||||
smaps = seek_to_smaps_entry(addr);
|
||||
if (!smaps) {
|
||||
|
|
@ -180,112 +121,70 @@ static bool is_vma_lock_on_fault(unsigned long addr)
|
|||
}
|
||||
|
||||
while (getline(&line, &size, smaps) > 0) {
|
||||
if (!strstr(line, SIZE)) {
|
||||
if (!strstr(line, name)) {
|
||||
free(line);
|
||||
line = NULL;
|
||||
size = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
value = line + strlen(SIZE);
|
||||
if (sscanf(value, "%lu kB", &vma_size) < 1) {
|
||||
value_ptr = line + strlen(name);
|
||||
if (sscanf(value_ptr, "%lu kB", &value) < 1) {
|
||||
printf("Unable to parse smaps entry for Size\n");
|
||||
goto out;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
while (getline(&line, &size, smaps) > 0) {
|
||||
if (!strstr(line, RSS)) {
|
||||
free(line);
|
||||
line = NULL;
|
||||
size = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
value = line + strlen(RSS);
|
||||
if (sscanf(value, "%lu kB", &vma_rss) < 1) {
|
||||
printf("Unable to parse smaps entry for Rss\n");
|
||||
goto out;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
ret = locked && (vma_rss < vma_size);
|
||||
out:
|
||||
free(line);
|
||||
if (smaps)
|
||||
fclose(smaps);
|
||||
return ret;
|
||||
free(line);
|
||||
return value;
|
||||
}
|
||||
|
||||
static bool is_vma_lock_on_fault(unsigned long addr)
|
||||
{
|
||||
bool locked;
|
||||
unsigned long vma_size, vma_rss;
|
||||
|
||||
locked = is_vmflag_set(addr, LOCKED);
|
||||
if (!locked)
|
||||
return false;
|
||||
|
||||
vma_size = get_value_for_name(addr, SIZE);
|
||||
vma_rss = get_value_for_name(addr, RSS);
|
||||
|
||||
/* only one page is faulted in */
|
||||
return (vma_rss < vma_size);
|
||||
}
|
||||
|
||||
#define PRESENT_BIT 0x8000000000000000ULL
|
||||
#define PFN_MASK 0x007FFFFFFFFFFFFFULL
|
||||
#define UNEVICTABLE_BIT (1UL << 18)
|
||||
|
||||
static int lock_check(char *map)
|
||||
static int lock_check(unsigned long addr)
|
||||
{
|
||||
unsigned long page_size = getpagesize();
|
||||
uint64_t page1_flags, page2_flags;
|
||||
bool locked;
|
||||
unsigned long vma_size, vma_rss;
|
||||
|
||||
page1_flags = get_pageflags((unsigned long)map);
|
||||
page2_flags = get_pageflags((unsigned long)map + page_size);
|
||||
locked = is_vmflag_set(addr, LOCKED);
|
||||
if (!locked)
|
||||
return false;
|
||||
|
||||
/* Both pages should be present */
|
||||
if (((page1_flags & PRESENT_BIT) == 0) ||
|
||||
((page2_flags & PRESENT_BIT) == 0)) {
|
||||
printf("Failed to make both pages present\n");
|
||||
return 1;
|
||||
}
|
||||
vma_size = get_value_for_name(addr, SIZE);
|
||||
vma_rss = get_value_for_name(addr, RSS);
|
||||
|
||||
page1_flags = get_kpageflags(page1_flags & PFN_MASK);
|
||||
page2_flags = get_kpageflags(page2_flags & PFN_MASK);
|
||||
|
||||
/* Both pages should be unevictable */
|
||||
if (((page1_flags & UNEVICTABLE_BIT) == 0) ||
|
||||
((page2_flags & UNEVICTABLE_BIT) == 0)) {
|
||||
printf("Failed to make both pages unevictable\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!is_vmflag_set((unsigned long)map, LOCKED)) {
|
||||
printf("VMA flag %s is missing on page 1\n", LOCKED);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!is_vmflag_set((unsigned long)map + page_size, LOCKED)) {
|
||||
printf("VMA flag %s is missing on page 2\n", LOCKED);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return (vma_rss == vma_size);
|
||||
}
|
||||
|
||||
static int unlock_lock_check(char *map)
|
||||
{
|
||||
unsigned long page_size = getpagesize();
|
||||
uint64_t page1_flags, page2_flags;
|
||||
|
||||
page1_flags = get_pageflags((unsigned long)map);
|
||||
page2_flags = get_pageflags((unsigned long)map + page_size);
|
||||
page1_flags = get_kpageflags(page1_flags & PFN_MASK);
|
||||
page2_flags = get_kpageflags(page2_flags & PFN_MASK);
|
||||
|
||||
if ((page1_flags & UNEVICTABLE_BIT) || (page2_flags & UNEVICTABLE_BIT)) {
|
||||
printf("A page is still marked unevictable after unlock\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (is_vmflag_set((unsigned long)map, LOCKED)) {
|
||||
printf("VMA flag %s is present on page 1 after unlock\n", LOCKED);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (is_vmflag_set((unsigned long)map + page_size, LOCKED)) {
|
||||
printf("VMA flag %s is present on page 2 after unlock\n", LOCKED);
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -311,7 +210,7 @@ static int test_mlock_lock()
|
|||
goto unmap;
|
||||
}
|
||||
|
||||
if (lock_check(map))
|
||||
if (!lock_check((unsigned long)map))
|
||||
goto unmap;
|
||||
|
||||
/* Now unlock and recheck attributes */
|
||||
|
|
@ -330,64 +229,18 @@ out:
|
|||
|
||||
static int onfault_check(char *map)
|
||||
{
|
||||
unsigned long page_size = getpagesize();
|
||||
uint64_t page1_flags, page2_flags;
|
||||
|
||||
page1_flags = get_pageflags((unsigned long)map);
|
||||
page2_flags = get_pageflags((unsigned long)map + page_size);
|
||||
|
||||
/* Neither page should be present */
|
||||
if ((page1_flags & PRESENT_BIT) || (page2_flags & PRESENT_BIT)) {
|
||||
printf("Pages were made present by MLOCK_ONFAULT\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
*map = 'a';
|
||||
page1_flags = get_pageflags((unsigned long)map);
|
||||
page2_flags = get_pageflags((unsigned long)map + page_size);
|
||||
|
||||
/* Only page 1 should be present */
|
||||
if ((page1_flags & PRESENT_BIT) == 0) {
|
||||
printf("Page 1 is not present after fault\n");
|
||||
return 1;
|
||||
} else if (page2_flags & PRESENT_BIT) {
|
||||
printf("Page 2 was made present\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
page1_flags = get_kpageflags(page1_flags & PFN_MASK);
|
||||
|
||||
/* Page 1 should be unevictable */
|
||||
if ((page1_flags & UNEVICTABLE_BIT) == 0) {
|
||||
printf("Failed to make faulted page unevictable\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!is_vma_lock_on_fault((unsigned long)map)) {
|
||||
printf("VMA is not marked for lock on fault\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!is_vma_lock_on_fault((unsigned long)map + page_size)) {
|
||||
printf("VMA is not marked for lock on fault\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int unlock_onfault_check(char *map)
|
||||
{
|
||||
unsigned long page_size = getpagesize();
|
||||
uint64_t page1_flags;
|
||||
|
||||
page1_flags = get_pageflags((unsigned long)map);
|
||||
page1_flags = get_kpageflags(page1_flags & PFN_MASK);
|
||||
|
||||
if (page1_flags & UNEVICTABLE_BIT) {
|
||||
printf("Page 1 is still marked unevictable after unlock\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (is_vma_lock_on_fault((unsigned long)map) ||
|
||||
is_vma_lock_on_fault((unsigned long)map + page_size)) {
|
||||
|
|
@ -445,7 +298,6 @@ static int test_lock_onfault_of_present()
|
|||
char *map;
|
||||
int ret = 1;
|
||||
unsigned long page_size = getpagesize();
|
||||
uint64_t page1_flags, page2_flags;
|
||||
|
||||
map = mmap(NULL, 2 * page_size, PROT_READ | PROT_WRITE,
|
||||
MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
|
||||
|
|
@ -465,17 +317,6 @@ static int test_lock_onfault_of_present()
|
|||
goto unmap;
|
||||
}
|
||||
|
||||
page1_flags = get_pageflags((unsigned long)map);
|
||||
page2_flags = get_pageflags((unsigned long)map + page_size);
|
||||
page1_flags = get_kpageflags(page1_flags & PFN_MASK);
|
||||
page2_flags = get_kpageflags(page2_flags & PFN_MASK);
|
||||
|
||||
/* Page 1 should be unevictable */
|
||||
if ((page1_flags & UNEVICTABLE_BIT) == 0) {
|
||||
printf("Failed to make present page unevictable\n");
|
||||
goto unmap;
|
||||
}
|
||||
|
||||
if (!is_vma_lock_on_fault((unsigned long)map) ||
|
||||
!is_vma_lock_on_fault((unsigned long)map + page_size)) {
|
||||
printf("VMA with present pages is not marked lock on fault\n");
|
||||
|
|
@ -507,7 +348,7 @@ static int test_munlockall()
|
|||
goto out;
|
||||
}
|
||||
|
||||
if (lock_check(map))
|
||||
if (!lock_check((unsigned long)map))
|
||||
goto unmap;
|
||||
|
||||
if (munlockall()) {
|
||||
|
|
@ -549,7 +390,7 @@ static int test_munlockall()
|
|||
goto out;
|
||||
}
|
||||
|
||||
if (lock_check(map))
|
||||
if (!lock_check((unsigned long)map))
|
||||
goto unmap;
|
||||
|
||||
if (munlockall()) {
|
||||
|
|
|
|||
|
|
@ -414,8 +414,12 @@ int main()
|
|||
|
||||
#if defined(__i386__) && (!defined(__GLIBC__) || __GLIBC__ > 2 || __GLIBC_MINOR__ >= 16)
|
||||
vsyscall32 = (void *)getauxval(AT_SYSINFO);
|
||||
printf("[RUN]\tCheck AT_SYSINFO return regs\n");
|
||||
test_sys32_regs(do_full_vsyscall32);
|
||||
if (vsyscall32) {
|
||||
printf("[RUN]\tCheck AT_SYSINFO return regs\n");
|
||||
test_sys32_regs(do_full_vsyscall32);
|
||||
} else {
|
||||
printf("[SKIP]\tAT_SYSINFO is not available\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
test_ptrace_syscall_restart();
|
||||
|
|
|
|||
Loading…
Reference in a new issue