mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 20:51:44 +00:00
arm64: Change elfcore for_each_mte_vma() to use VMA iterator
Rework for_each_mte_vma() to use a VMA iterator instead of an explicit linked-list. Link: https://lkml.kernel.org/r/20220906194824.2110408-32-Liam.Howlett@oracle.com Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Link: https://lore.kernel.org/r/20220218023650.672072-1-Liam.Howlett@oracle.com Signed-off-by: Will Deacon <will@kernel.org> Reviewed-by: Davidlohr Bueso <dave@stgolabs.net> Tested-by: Yu Zhao <yuzhao@google.com> Cc: David Hildenbrand <david@redhat.com> Cc: David Howells <dhowells@redhat.com> Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org> Cc: SeongJae Park <sj@kernel.org> Cc: Sven Schnelle <svens@linux.ibm.com> Cc: Vlastimil Babka <vbabka@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
de2b84d24b
commit
ef770d180e
@ -8,9 +8,9 @@
|
|||||||
#include <asm/cpufeature.h>
|
#include <asm/cpufeature.h>
|
||||||
#include <asm/mte.h>
|
#include <asm/mte.h>
|
||||||
|
|
||||||
#define for_each_mte_vma(tsk, vma) \
|
#define for_each_mte_vma(vmi, vma) \
|
||||||
if (system_supports_mte()) \
|
if (system_supports_mte()) \
|
||||||
for (vma = tsk->mm->mmap; vma; vma = vma->vm_next) \
|
for_each_vma(vmi, vma) \
|
||||||
if (vma->vm_flags & VM_MTE)
|
if (vma->vm_flags & VM_MTE)
|
||||||
|
|
||||||
static unsigned long mte_vma_tag_dump_size(struct vm_area_struct *vma)
|
static unsigned long mte_vma_tag_dump_size(struct vm_area_struct *vma)
|
||||||
@ -81,8 +81,9 @@ Elf_Half elf_core_extra_phdrs(void)
|
|||||||
{
|
{
|
||||||
struct vm_area_struct *vma;
|
struct vm_area_struct *vma;
|
||||||
int vma_count = 0;
|
int vma_count = 0;
|
||||||
|
VMA_ITERATOR(vmi, current->mm, 0);
|
||||||
|
|
||||||
for_each_mte_vma(current, vma)
|
for_each_mte_vma(vmi, vma)
|
||||||
vma_count++;
|
vma_count++;
|
||||||
|
|
||||||
return vma_count;
|
return vma_count;
|
||||||
@ -91,8 +92,9 @@ Elf_Half elf_core_extra_phdrs(void)
|
|||||||
int elf_core_write_extra_phdrs(struct coredump_params *cprm, loff_t offset)
|
int elf_core_write_extra_phdrs(struct coredump_params *cprm, loff_t offset)
|
||||||
{
|
{
|
||||||
struct vm_area_struct *vma;
|
struct vm_area_struct *vma;
|
||||||
|
VMA_ITERATOR(vmi, current->mm, 0);
|
||||||
|
|
||||||
for_each_mte_vma(current, vma) {
|
for_each_mte_vma(vmi, vma) {
|
||||||
struct elf_phdr phdr;
|
struct elf_phdr phdr;
|
||||||
|
|
||||||
phdr.p_type = PT_AARCH64_MEMTAG_MTE;
|
phdr.p_type = PT_AARCH64_MEMTAG_MTE;
|
||||||
@ -116,8 +118,9 @@ size_t elf_core_extra_data_size(void)
|
|||||||
{
|
{
|
||||||
struct vm_area_struct *vma;
|
struct vm_area_struct *vma;
|
||||||
size_t data_size = 0;
|
size_t data_size = 0;
|
||||||
|
VMA_ITERATOR(vmi, current->mm, 0);
|
||||||
|
|
||||||
for_each_mte_vma(current, vma)
|
for_each_mte_vma(vmi, vma)
|
||||||
data_size += mte_vma_tag_dump_size(vma);
|
data_size += mte_vma_tag_dump_size(vma);
|
||||||
|
|
||||||
return data_size;
|
return data_size;
|
||||||
@ -126,8 +129,9 @@ size_t elf_core_extra_data_size(void)
|
|||||||
int elf_core_write_extra_data(struct coredump_params *cprm)
|
int elf_core_write_extra_data(struct coredump_params *cprm)
|
||||||
{
|
{
|
||||||
struct vm_area_struct *vma;
|
struct vm_area_struct *vma;
|
||||||
|
VMA_ITERATOR(vmi, current->mm, 0);
|
||||||
|
|
||||||
for_each_mte_vma(current, vma) {
|
for_each_mte_vma(vmi, vma) {
|
||||||
if (vma->vm_flags & VM_DONTDUMP)
|
if (vma->vm_flags & VM_DONTDUMP)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user