Files
kernel_arpi/arch/arm64/include/asm/mte.h
Greg Kroah-Hartman 05dba81225 Merge 5.15.76 into android14-5.15
Changes in 5.15.76
	r8152: add PID for the Lenovo OneLink+ Dock
	arm64/mm: Consolidate TCR_EL1 fields
	usb: gadget: uvc: consistently use define for headerlen
	usb: gadget: uvc: use on returned header len in video_encode_isoc_sg
	usb: gadget: uvc: rework uvcg_queue_next_buffer to uvcg_complete_buffer
	usb: gadget: uvc: giveback vb2 buffer on req complete
	usb: gadget: uvc: improve sg exit condition
	arm64: errata: Remove AES hwcap for COMPAT tasks
	perf/x86/intel/pt: Relax address filter validation
	btrfs: enhance unsupported compat RO flags handling
	ocfs2: clear dinode links count in case of error
	ocfs2: fix BUG when iput after ocfs2_mknod fails
	selinux: enable use of both GFP_KERNEL and GFP_ATOMIC in convert_context()
	cpufreq: qcom: fix writes in read-only memory region
	i2c: qcom-cci: Fix ordering of pm_runtime_xx and i2c_add_adapter
	x86/microcode/AMD: Apply the patch early on every logical thread
	hwmon/coretemp: Handle large core ID value
	ata: ahci-imx: Fix MODULE_ALIAS
	ata: ahci: Match EM_MAX_SLOTS with SATA_PMP_MAX_PORTS
	x86/resctrl: Fix min_cbm_bits for AMD
	cpufreq: qcom: fix memory leak in error path
	drm/amdgpu: fix sdma doorbell init ordering on APUs
	mm,hugetlb: take hugetlb_lock before decrementing h->resv_huge_pages
	kvm: Add support for arch compat vm ioctls
	KVM: arm64: vgic: Fix exit condition in scan_its_table()
	media: ipu3-imgu: Fix NULL pointer dereference in active selection access
	media: mceusb: set timeout to at least timeout provided
	media: venus: dec: Handle the case where find_format fails
	x86/topology: Fix multiple packages shown on a single-package system
	x86/topology: Fix duplicated core ID within a package
	btrfs: fix processing of delayed data refs during backref walking
	btrfs: fix processing of delayed tree block refs during backref walking
	drm/vc4: Add module dependency on hdmi-codec
	ACPI: extlog: Handle multiple records
	tipc: Fix recognition of trial period
	tipc: fix an information leak in tipc_topsrv_kern_subscr
	i40e: Fix DMA mappings leak
	HID: magicmouse: Do not set BTN_MOUSE on double report
	sfc: Change VF mac via PF as first preference if available.
	net/atm: fix proc_mpc_write incorrect return value
	net: phy: dp83867: Extend RX strap quirk for SGMII mode
	net: phylink: add mac_managed_pm in phylink_config structure
	scsi: lpfc: Fix memory leak in lpfc_create_port()
	udp: Update reuse->has_conns under reuseport_lock.
	cifs: Fix xid leak in cifs_create()
	cifs: Fix xid leak in cifs_copy_file_range()
	cifs: Fix xid leak in cifs_flock()
	cifs: Fix xid leak in cifs_ses_add_channel()
	dm: remove unnecessary assignment statement in alloc_dev()
	net: hsr: avoid possible NULL deref in skb_clone()
	ionic: catch NULL pointer issue on reconfig
	netfilter: nf_tables: relax NFTA_SET_ELEM_KEY_END set flags requirements
	nvme-hwmon: consistently ignore errors from nvme_hwmon_init
	nvme-hwmon: kmalloc the NVME SMART log buffer
	nvmet: fix workqueue MEM_RECLAIM flushing dependency
	net: sched: cake: fix null pointer access issue when cake_init() fails
	net: sched: delete duplicate cleanup of backlog and qlen
	net: sched: sfb: fix null pointer access issue when sfb_init() fails
	sfc: include vport_id in filter spec hash and equal()
	wwan_hwsim: fix possible memory leak in wwan_hwsim_dev_new()
	net: hns: fix possible memory leak in hnae_ae_register()
	net: sched: fix race condition in qdisc_graft()
	net: phy: dp83822: disable MDI crossover status change interrupt
	iommu/vt-d: Allow NVS regions in arch_rmrr_sanity_check()
	iommu/vt-d: Clean up si_domain in the init_dmars() error path
	fs: dlm: fix invalid derefence of sb_lvbptr
	arm64: mte: move register initialization to C
	ksmbd: handle smb2 query dir request for OutputBufferLength that is too small
	ksmbd: fix incorrect handling of iterate_dir
	tracing: Simplify conditional compilation code in tracing_set_tracer()
	tracing: Do not free snapshot if tracer is on cmdline
	mmc: sdhci-tegra: Use actual clock rate for SW tuning correction
	perf: Skip and warn on unknown format 'configN' attrs
	ACPI: video: Force backlight native for more TongFang devices
	x86/Kconfig: Drop check for -mabi=ms for CONFIG_EFI_STUB
	Makefile.debug: re-enable debug info for .S files
	mmc: core: Add SD card quirk for broken discard
	mm: /proc/pid/smaps_rollup: fix no vma's null-deref
	Linux 5.15.76

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ica5b3f26c36900ff31ccac63f4fb55b52bff0ec2
2022-11-03 14:21:38 +09:00

146 lines
3.4 KiB
C

/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (C) 2020 ARM Ltd.
*/
#ifndef __ASM_MTE_H
#define __ASM_MTE_H
#include <asm/compiler.h>
#include <asm/mte-def.h>
#ifndef __ASSEMBLY__
#include <linux/bitfield.h>
#include <linux/page-flags.h>
#include <linux/types.h>
#include <asm/pgtable-types.h>
void mte_clear_page_tags(void *addr);
unsigned long mte_copy_tags_from_user(void *to, const void __user *from,
unsigned long n);
unsigned long mte_copy_tags_to_user(void __user *to, void *from,
unsigned long n);
int mte_save_tags(struct page *page);
void mte_save_page_tags(const void *page_addr, void *tag_storage);
bool mte_restore_tags(swp_entry_t entry, struct page *page);
void mte_restore_page_tags(void *page_addr, const void *tag_storage);
void mte_invalidate_tags(int type, pgoff_t offset);
void mte_invalidate_tags_area(int type);
void *mte_allocate_tag_storage(void);
void mte_free_tag_storage(char *storage);
#ifdef CONFIG_ARM64_MTE
/* track which pages have valid allocation tags */
#define PG_mte_tagged PG_arch_2
void mte_zero_clear_page_tags(void *addr);
void mte_sync_tags(pte_t old_pte, pte_t pte);
void mte_copy_page_tags(void *kto, const void *kfrom);
void mte_thread_init_user(void);
void mte_thread_switch(struct task_struct *next);
void mte_cpu_setup(void);
void mte_suspend_enter(void);
void mte_suspend_exit(void);
long set_mte_ctrl(struct task_struct *task, unsigned long arg);
long get_mte_ctrl(struct task_struct *task);
int mte_ptrace_copy_tags(struct task_struct *child, long request,
unsigned long addr, unsigned long data);
#else /* CONFIG_ARM64_MTE */
/* unused if !CONFIG_ARM64_MTE, silence the compiler */
#define PG_mte_tagged 0
static inline void mte_zero_clear_page_tags(void *addr)
{
}
static inline void mte_sync_tags(pte_t old_pte, pte_t pte)
{
}
static inline void mte_copy_page_tags(void *kto, const void *kfrom)
{
}
static inline void mte_thread_init_user(void)
{
}
static inline void mte_thread_switch(struct task_struct *next)
{
}
static inline void mte_suspend_enter(void)
{
}
static inline void mte_suspend_exit(void)
{
}
static inline long set_mte_ctrl(struct task_struct *task, unsigned long arg)
{
return 0;
}
static inline long get_mte_ctrl(struct task_struct *task)
{
return 0;
}
static inline int mte_ptrace_copy_tags(struct task_struct *child,
long request, unsigned long addr,
unsigned long data)
{
return -EIO;
}
#endif /* CONFIG_ARM64_MTE */
#ifdef CONFIG_KASAN_HW_TAGS
/* Whether the MTE asynchronous mode is enabled. */
DECLARE_STATIC_KEY_FALSE(mte_async_or_asymm_mode);
static inline bool system_uses_mte_async_or_asymm_mode(void)
{
return static_branch_unlikely(&mte_async_or_asymm_mode);
}
void mte_check_tfsr_el1(void);
static inline void mte_check_tfsr_entry(void)
{
if (!system_supports_mte())
return;
mte_check_tfsr_el1();
}
static inline void mte_check_tfsr_exit(void)
{
if (!system_supports_mte())
return;
/*
* The asynchronous faults are sync'ed automatically with
* TFSR_EL1 on kernel entry but for exit an explicit dsb()
* is required.
*/
dsb(nsh);
isb();
mte_check_tfsr_el1();
}
#else
static inline bool system_uses_mte_async_or_asymm_mode(void)
{
return false;
}
static inline void mte_check_tfsr_el1(void)
{
}
static inline void mte_check_tfsr_entry(void)
{
}
static inline void mte_check_tfsr_exit(void)
{
}
#endif /* CONFIG_KASAN_HW_TAGS */
#endif /* __ASSEMBLY__ */
#endif /* __ASM_MTE_H */