mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-11 13:27:06 +09:00
PD#OTT-5676 [Problem] digital security team requires OSS to be patched up to the latest or non-vulnerable version [Solution] mm: get rid of vmacache_flush_all() entirely Jann Horn points out that the vmacache_flush_all() function is not only potentially expensive, it's buggy too. It also happens to be entirely unnecessary, because the sequence number overflow case can be avoided by simply making the sequence number be 64-bit. That doesn't even grow the data structures in question, because the other adjacent fields are already 64-bit. So simplify the whole thing by just making the sequence number overflow case go away entirely, which gets rid of all the complications and makes the code faster too. Win-win. [Test] Change-Id: I536c7b183ced970e18c9d67211f32da0ee404111 Signed-off-by: Hanjie Lin <hanjie.lin@amlogic.com>
34 lines
883 B
C
34 lines
883 B
C
#ifndef __LINUX_VMACACHE_H
|
|
#define __LINUX_VMACACHE_H
|
|
|
|
#include <linux/sched.h>
|
|
#include <linux/mm.h>
|
|
|
|
/*
|
|
* Hash based on the page number. Provides a good hit rate for
|
|
* workloads with good locality and those with random accesses as well.
|
|
*/
|
|
#define VMACACHE_HASH(addr) ((addr >> PAGE_SHIFT) & VMACACHE_MASK)
|
|
|
|
static inline void vmacache_flush(struct task_struct *tsk)
|
|
{
|
|
memset(tsk->vmacache, 0, sizeof(tsk->vmacache));
|
|
}
|
|
|
|
extern void vmacache_update(unsigned long addr, struct vm_area_struct *newvma);
|
|
extern struct vm_area_struct *vmacache_find(struct mm_struct *mm,
|
|
unsigned long addr);
|
|
|
|
#ifndef CONFIG_MMU
|
|
extern struct vm_area_struct *vmacache_find_exact(struct mm_struct *mm,
|
|
unsigned long start,
|
|
unsigned long end);
|
|
#endif
|
|
|
|
static inline void vmacache_invalidate(struct mm_struct *mm)
|
|
{
|
|
mm->vmacache_seqnum++;
|
|
}
|
|
|
|
#endif /* __LINUX_VMACACHE_H */
|