Skip to content

Commit

Permalink
Merge remote-tracking branch 'aosp/android15-6.6-2024-08' into nxp-li…
Browse files Browse the repository at this point in the history
…nux-sdk/lf-6.6.y_android
  • Loading branch information
zhipeng66 committed Sep 11, 2024
2 parents e0d1c9f + 32a68c6 commit 112aa92
Show file tree
Hide file tree
Showing 12 changed files with 89 additions and 20 deletions.
16 changes: 16 additions & 0 deletions android/abi_gki_aarch64.stg
Original file line number Diff line number Diff line change
Expand Up @@ -296735,6 +296735,12 @@ function {
parameter_id: 0xd0b3a203
parameter_id: 0xd0b3a203
}
function {
id: 0x10e61e10
return_type_id: 0x48b5725f
parameter_id: 0x0258f96e
parameter_id: 0x3a1c763b
}
function {
id: 0x10e93841
return_type_id: 0x48b5725f
Expand Down Expand Up @@ -366494,6 +366500,15 @@ elf_symbol {
type_id: 0x9435d177
full_name: "devm_nvmem_device_get"
}
elf_symbol {
id: 0xe504a070
name: "devm_nvmem_device_put"
is_defined: true
symbol_type: FUNCTION
crc: 0x53ca63ed
type_id: 0x10e61e10
full_name: "devm_nvmem_device_put"
}
elf_symbol {
id: 0x47264dbb
name: "devm_nvmem_register"
Expand Down Expand Up @@ -416624,6 +416639,7 @@ interface {
symbol_id: 0x91f58d29
symbol_id: 0x7abe395b
symbol_id: 0xa8b058e5
symbol_id: 0xe504a070
symbol_id: 0x47264dbb
symbol_id: 0x35094803
symbol_id: 0x5bc8c0f2
Expand Down
1 change: 1 addition & 0 deletions android/abi_gki_aarch64_imx
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@
devm_mipi_dsi_attach
devm_mipi_dsi_device_register_full
devm_nvmem_device_get
devm_nvmem_device_put
devm_nvmem_register
devm_of_clk_add_hw_provider
devm_of_iomap
Expand Down
10 changes: 6 additions & 4 deletions arch/x86/entry/vdso/vdso-layout.lds.S
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0 */
#include <asm/vdso.h>

#include <linux/page_size_compat.h>

/*
* Linker script for vDSO. This is an ELF shared object prelinked to
* its virtual address, and with only one read-only segment.
Expand All @@ -16,17 +18,17 @@ SECTIONS
* segment.
*/

vvar_start = . - 4 * PAGE_SIZE;
vvar_start = . - 4 * __MAX_PAGE_SIZE;
vvar_page = vvar_start;

/* Place all vvars at the offsets in asm/vvar.h. */
#define EMIT_VVAR(name, offset) vvar_ ## name = vvar_page + offset;
#include <asm/vvar.h>
#undef EMIT_VVAR

pvclock_page = vvar_start + PAGE_SIZE;
hvclock_page = vvar_start + 2 * PAGE_SIZE;
timens_page = vvar_start + 3 * PAGE_SIZE;
pvclock_page = vvar_start + __MAX_PAGE_SIZE;
hvclock_page = vvar_start + 2 * __MAX_PAGE_SIZE;
timens_page = vvar_start + 3 * __MAX_PAGE_SIZE;

#undef _ASM_X86_VVAR_H
/* Place all vvars in timens too at the offsets in asm/vvar.h. */
Expand Down
16 changes: 13 additions & 3 deletions arch/x86/entry/vdso/vdso2c.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@
* are built for 32-bit userspace.
*/

/*
* For x86_64 16kB page size emulation
*
* The redefinition is needed here since, vdso2c is a program that runs
* on the host.
*
* It converts the vdso shared lib to a C array.
*/
#define __MAX_PAGE_SIZE 16384

static void BITSFUNC(copy)(FILE *outfile, const unsigned char *data, size_t len)
{
size_t i;
Expand Down Expand Up @@ -175,7 +185,7 @@ static void BITSFUNC(go)(void *raw_addr, size_t raw_len,
return;
}

mapping_size = (stripped_len + 4095) / 4096 * 4096;
mapping_size = (stripped_len + __MAX_PAGE_SIZE-1) / __MAX_PAGE_SIZE * __MAX_PAGE_SIZE;

fprintf(outfile, "/* AUTOMATICALLY GENERATED -- DO NOT EDIT */\n\n");
fprintf(outfile, "#include <linux/linkage.h>\n");
Expand All @@ -184,8 +194,8 @@ static void BITSFUNC(go)(void *raw_addr, size_t raw_len,
fprintf(outfile, "#include <asm/vdso.h>\n");
fprintf(outfile, "\n");
fprintf(outfile,
"static unsigned char raw_data[%lu] __ro_after_init __aligned(PAGE_SIZE) = {",
mapping_size);
"static unsigned char raw_data[%lu] __ro_after_init __aligned(%d) = {",
mapping_size, __MAX_PAGE_SIZE);
for (i = 0; i < stripped_len; i++) {
if (i % 10 == 0)
fprintf(outfile, "\n\t");
Expand Down
3 changes: 2 additions & 1 deletion arch/x86/entry/vsyscall/vsyscall_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <linux/mm_types.h>
#include <linux/syscalls.h>
#include <linux/ratelimit.h>
#include <linux/page_size_compat.h>

#include <asm/vsyscall.h>
#include <asm/unistd.h>
Expand Down Expand Up @@ -284,7 +285,7 @@ static const struct vm_operations_struct gate_vma_ops = {
};
static struct vm_area_struct gate_vma __ro_after_init = {
.vm_start = VSYSCALL_ADDR,
.vm_end = VSYSCALL_ADDR + PAGE_SIZE,
.vm_end = VSYSCALL_ADDR + __MAX_PAGE_SIZE,
.vm_page_prot = PAGE_READONLY_EXEC,
.vm_flags = VM_READ | VM_EXEC,
.vm_ops = &gate_vma_ops,
Expand Down
1 change: 1 addition & 0 deletions drivers/android/binder.c
Original file line number Diff line number Diff line change
Expand Up @@ -3637,6 +3637,7 @@ static void binder_transaction(struct binder_proc *proc,
*/
copy_size = object_offset - user_offset;
if (copy_size && (user_offset > object_offset ||
object_offset > tr->data_size ||
binder_alloc_copy_user_to_buffer(
&target_proc->alloc,
t->buffer, user_offset,
Expand Down
3 changes: 2 additions & 1 deletion drivers/dma-buf/dma-heap.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <linux/uaccess.h>
#include <linux/syscalls.h>
#include <linux/dma-heap.h>
#include <linux/page_size_compat.h>
#include <uapi/linux/dma-heap.h>

#define DEVNAME "dma_heap"
Expand Down Expand Up @@ -89,7 +90,7 @@ struct dma_buf *dma_heap_buffer_alloc(struct dma_heap *heap, size_t len,
* Allocations from all heaps have to begin
* and end on page boundaries.
*/
len = PAGE_ALIGN(len);
len = __PAGE_ALIGN(len);
if (!len)
return ERR_PTR(-EINVAL);

Expand Down
4 changes: 1 addition & 3 deletions fs/proc/task_mmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,7 @@ show_map_vma(struct seq_file *m, struct vm_area_struct *vma)
start = vma->vm_start;
end = vma->vm_end;

/* Skip page size fixup VMAs */
if (flags & __VM_NO_COMPAT)
return;
__fold_filemap_fixup_entry(&((struct proc_maps_private *)m->private)->iter, &end);

show_vma_header_prefix(m, start, end, flags, pgoff, dev, ino);
if (mm)
Expand Down
14 changes: 12 additions & 2 deletions include/linux/page_size_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@

#include <asm/page.h>

#define __MAX_PAGE_SHIFT 14
#define __MAX_PAGE_SIZE (_AC(1,UL) << __MAX_PAGE_SHIFT)
#define __MAX_PAGE_MASK (~(__MAX_PAGE_SIZE-1))

#ifndef __ASSEMBLY__

#include <linux/align.h>
#include <linux/jump_label.h>
#include <linux/mman.h>
Expand Down Expand Up @@ -105,8 +111,8 @@ static __always_inline unsigned __page_shift(void)
* NOTE: __MAP_NO_COMPAT is not new UABI it is only ever set by the kernel
* in ___filemap_fixup()
*/
#define __VM_NO_COMPAT (_AC(1,ULL) << 59)
#define __MAP_NO_COMPAT (_AC(1,UL) << 31)
#define __VM_NO_COMPAT _BITULL(58)
#define __MAP_NO_COMPAT _BITUL(31)

/*
* Conditional page-alignment based on mmap flags
Expand Down Expand Up @@ -155,4 +161,8 @@ static __always_inline void __filemap_fixup(unsigned long addr, unsigned long pr
___filemap_fixup(addr, prot, old_len, new_len);
}

extern void __fold_filemap_fixup_entry(struct vma_iterator *iter, unsigned long *end);

#endif /* !__ASSEMBLY__ */

#endif /* __LINUX_PAGE_SIZE_COMPAT_H */
8 changes: 5 additions & 3 deletions include/linux/pgsize_migration.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,24 @@
* This allows the kernel to identify the portion of an ELF LOAD segment VMA
* that is padding.
*
* 4 high bits of vm_flags [63,60] are used to represent ELF segment padding
* 4 high bits of vm_flags [62,59] are used to represent ELF segment padding
* up to 60kB, which is sufficient for ELFs of both 16kB and 64kB segment
* alignment (p_align).
*
* The representation is illustrated below.
*
* 63 62 61 60
* 62 61 60 59
* _________ _________ _________ _________
* | Bit 3 | Bit 2 | Bit 1 | Bit 0 |
* | of 4kB | of 4kB | of 4kB | of 4kB |
* | chunks | chunks | chunks | chunks |
* |_________|_________|_________|_________|
*
* NOTE: Bit 63 is already used by mseal()
*/

#define VM_PAD_WIDTH 4
#define VM_PAD_SHIFT (BITS_PER_LONG - VM_PAD_WIDTH)
#define VM_PAD_SHIFT (BITS_PER_LONG - VM_PAD_WIDTH - 1)
#define VM_TOTAL_PAD_PAGES ((1ULL << VM_PAD_WIDTH) - 1)
#define VM_PAD_MASK (VM_TOTAL_PAD_PAGES << VM_PAD_SHIFT)
#define VMA_PAD_START(vma) (vma->vm_end - (vma_pad_pages(vma) << PAGE_SHIFT))
Expand Down
5 changes: 3 additions & 2 deletions mm/mseal.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <linux/mm.h>
#include <linux/mm_inline.h>
#include <linux/mmu_context.h>
#include <linux/page_size_compat.h>
#include <linux/syscalls.h>
#include <linux/sched.h>
#include "internal.h"
Expand Down Expand Up @@ -283,10 +284,10 @@ static int do_mseal(unsigned long start, size_t len_in, unsigned long flags)
return ret;

start = untagged_addr(start);
if (!PAGE_ALIGNED(start))
if (!__PAGE_ALIGNED(start))
return -EINVAL;

len = PAGE_ALIGN(len_in);
len = __PAGE_ALIGN(len_in);
/* Check to see whether len was rounded up from small -ve to zero. */
if (len_in && !len)
return -EINVAL;
Expand Down
28 changes: 27 additions & 1 deletion mm/page_size_compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ static int __init early_page_shift_compat(char *buf)

return 0;
}
early_param("androidboot.page_shift", early_page_shift_compat);
early_param("page_shift", early_page_shift_compat);

static int __init init_mmap_rnd_bits(void)
{
Expand Down Expand Up @@ -176,3 +176,29 @@ void ___filemap_fixup(unsigned long addr, unsigned long prot, unsigned long old_
MAP_PRIVATE|MAP_ANONYMOUS|MAP_FIXED|__MAP_NO_COMPAT,
0, 0, &populate, NULL);
}

/*
* Folds any anon fixup entries created by ___filemap_fixup()
* into the previous mapping so that /proc/<pid>/[s]maps don't
* show unaliged entries.
*/
void __fold_filemap_fixup_entry(struct vma_iterator *iter, unsigned long *end)
{
struct vm_area_struct *next_vma;

/* Not emulating page size? */
if (!static_branch_unlikely(&page_shift_compat_enabled))
return;

/* Advance iterator */
next_vma = vma_next(iter);

/* If fixup VMA, adjust the end to cover its extent */
if (next_vma && (next_vma->vm_flags & __VM_NO_COMPAT)) {
*end = next_vma->vm_end;
return;
}

/* Rewind iterator */
vma_prev(iter);
}

0 comments on commit 112aa92

Please sign in to comment.