Commit 1ba73b99 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6

* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6:
  [IA64] kexec: Use EFI_LOADER_DATA for ELF core header
  [IA64] permon use-after-free fix
  [IA64] sync compat getdents
  [IA64] always build arch/ia64/lib/xor.o
  [IA64] Remove stack hard limit on ia64
  [IA64] point saved_max_pfn to the max_pfn of the entire system
  Revert "[IA64] swiotlb abstraction (e.g. for Xen)"
parents 185d84b4 cee87af2
...@@ -1267,6 +1267,10 @@ sys32_getdents (unsigned int fd, struct compat_dirent __user *dirent, unsigned i ...@@ -1267,6 +1267,10 @@ sys32_getdents (unsigned int fd, struct compat_dirent __user *dirent, unsigned i
struct getdents32_callback buf; struct getdents32_callback buf;
int error; int error;
error = -EFAULT;
if (!access_ok(VERIFY_WRITE, dirent, count))
goto out;
error = -EBADF; error = -EBADF;
file = fget(fd); file = fget(fd);
if (!file) if (!file)
...@@ -1283,9 +1287,9 @@ sys32_getdents (unsigned int fd, struct compat_dirent __user *dirent, unsigned i ...@@ -1283,9 +1287,9 @@ sys32_getdents (unsigned int fd, struct compat_dirent __user *dirent, unsigned i
error = buf.error; error = buf.error;
lastdirent = buf.previous; lastdirent = buf.previous;
if (lastdirent) { if (lastdirent) {
error = -EINVAL;
if (put_user(file->f_pos, &lastdirent->d_off)) if (put_user(file->f_pos, &lastdirent->d_off))
goto out_putf; error = -EFAULT;
else
error = count - buf.count; error = count - buf.count;
} }
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
* Skip non-WB memory and ignore empty memory ranges. * Skip non-WB memory and ignore empty memory ranges.
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <linux/bootmem.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/types.h> #include <linux/types.h>
...@@ -1009,6 +1010,11 @@ efi_memmap_init(unsigned long *s, unsigned long *e) ...@@ -1009,6 +1010,11 @@ efi_memmap_init(unsigned long *s, unsigned long *e)
} else } else
ae = efi_md_end(md); ae = efi_md_end(md);
#ifdef CONFIG_CRASH_DUMP
/* saved_max_pfn should ignore max_addr= command line arg */
if (saved_max_pfn < (ae >> PAGE_SHIFT))
saved_max_pfn = (ae >> PAGE_SHIFT);
#endif
/* keep within max_addr= and min_addr= command line arg */ /* keep within max_addr= and min_addr= command line arg */
as = max(as, min_addr); as = max(as, min_addr);
ae = min(ae, max_addr); ae = min(ae, max_addr);
...@@ -1177,3 +1183,33 @@ kdump_find_rsvd_region (unsigned long size, ...@@ -1177,3 +1183,33 @@ kdump_find_rsvd_region (unsigned long size,
return ~0UL; return ~0UL;
} }
#endif #endif
#ifdef CONFIG_PROC_VMCORE
/* locate the size find a the descriptor at a certain address */
unsigned long
vmcore_find_descriptor_size (unsigned long address)
{
void *efi_map_start, *efi_map_end, *p;
efi_memory_desc_t *md;
u64 efi_desc_size;
unsigned long ret = 0;
efi_map_start = __va(ia64_boot_param->efi_memmap);
efi_map_end = efi_map_start + ia64_boot_param->efi_memmap_size;
efi_desc_size = ia64_boot_param->efi_memdesc_size;
for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) {
md = p;
if (efi_wb(md) && md->type == EFI_LOADER_DATA
&& md->phys_addr == address) {
ret = efi_md_size(md);
break;
}
}
if (ret == 0)
printk(KERN_WARNING "Cannot locate EFI vmcore descriptor\n");
return ret;
}
#endif
...@@ -2299,7 +2299,7 @@ pfm_remap_buffer(struct vm_area_struct *vma, unsigned long buf, unsigned long ad ...@@ -2299,7 +2299,7 @@ pfm_remap_buffer(struct vm_area_struct *vma, unsigned long buf, unsigned long ad
* allocate a sampling buffer and remaps it into the user address space of the task * allocate a sampling buffer and remaps it into the user address space of the task
*/ */
static int static int
pfm_smpl_buffer_alloc(struct task_struct *task, pfm_context_t *ctx, unsigned long rsize, void **user_vaddr) pfm_smpl_buffer_alloc(struct task_struct *task, struct file *filp, pfm_context_t *ctx, unsigned long rsize, void **user_vaddr)
{ {
struct mm_struct *mm = task->mm; struct mm_struct *mm = task->mm;
struct vm_area_struct *vma = NULL; struct vm_area_struct *vma = NULL;
...@@ -2349,6 +2349,7 @@ pfm_smpl_buffer_alloc(struct task_struct *task, pfm_context_t *ctx, unsigned lon ...@@ -2349,6 +2349,7 @@ pfm_smpl_buffer_alloc(struct task_struct *task, pfm_context_t *ctx, unsigned lon
* partially initialize the vma for the sampling buffer * partially initialize the vma for the sampling buffer
*/ */
vma->vm_mm = mm; vma->vm_mm = mm;
vma->vm_file = filp;
vma->vm_flags = VM_READ| VM_MAYREAD |VM_RESERVED; vma->vm_flags = VM_READ| VM_MAYREAD |VM_RESERVED;
vma->vm_page_prot = PAGE_READONLY; /* XXX may need to change */ vma->vm_page_prot = PAGE_READONLY; /* XXX may need to change */
...@@ -2387,6 +2388,8 @@ pfm_smpl_buffer_alloc(struct task_struct *task, pfm_context_t *ctx, unsigned lon ...@@ -2387,6 +2388,8 @@ pfm_smpl_buffer_alloc(struct task_struct *task, pfm_context_t *ctx, unsigned lon
goto error; goto error;
} }
get_file(filp);
/* /*
* now insert the vma in the vm list for the process, must be * now insert the vma in the vm list for the process, must be
* done with mmap lock held * done with mmap lock held
...@@ -2464,7 +2467,7 @@ pfarg_is_sane(struct task_struct *task, pfarg_context_t *pfx) ...@@ -2464,7 +2467,7 @@ pfarg_is_sane(struct task_struct *task, pfarg_context_t *pfx)
} }
static int static int
pfm_setup_buffer_fmt(struct task_struct *task, pfm_context_t *ctx, unsigned int ctx_flags, pfm_setup_buffer_fmt(struct task_struct *task, struct file *filp, pfm_context_t *ctx, unsigned int ctx_flags,
unsigned int cpu, pfarg_context_t *arg) unsigned int cpu, pfarg_context_t *arg)
{ {
pfm_buffer_fmt_t *fmt = NULL; pfm_buffer_fmt_t *fmt = NULL;
...@@ -2505,7 +2508,7 @@ pfm_setup_buffer_fmt(struct task_struct *task, pfm_context_t *ctx, unsigned int ...@@ -2505,7 +2508,7 @@ pfm_setup_buffer_fmt(struct task_struct *task, pfm_context_t *ctx, unsigned int
/* /*
* buffer is always remapped into the caller's address space * buffer is always remapped into the caller's address space
*/ */
ret = pfm_smpl_buffer_alloc(current, ctx, size, &uaddr); ret = pfm_smpl_buffer_alloc(current, filp, ctx, size, &uaddr);
if (ret) goto error; if (ret) goto error;
/* keep track of user address of buffer */ /* keep track of user address of buffer */
...@@ -2716,7 +2719,7 @@ pfm_context_create(pfm_context_t *ctx, void *arg, int count, struct pt_regs *reg ...@@ -2716,7 +2719,7 @@ pfm_context_create(pfm_context_t *ctx, void *arg, int count, struct pt_regs *reg
* does the user want to sample? * does the user want to sample?
*/ */
if (pfm_uuid_cmp(req->ctx_smpl_buf_id, pfm_null_uuid)) { if (pfm_uuid_cmp(req->ctx_smpl_buf_id, pfm_null_uuid)) {
ret = pfm_setup_buffer_fmt(current, ctx, ctx_flags, 0, req); ret = pfm_setup_buffer_fmt(current, filp, ctx, ctx_flags, 0, req);
if (ret) goto buffer_error; if (ret) goto buffer_error;
} }
......
...@@ -251,6 +251,12 @@ reserve_memory (void) ...@@ -251,6 +251,12 @@ reserve_memory (void)
} }
#endif #endif
#ifdef CONFIG_PROC_VMCORE
if (reserve_elfcorehdr(&rsvd_region[n].start,
&rsvd_region[n].end) == 0)
n++;
#endif
efi_memmap_init(&rsvd_region[n].start, &rsvd_region[n].end); efi_memmap_init(&rsvd_region[n].start, &rsvd_region[n].end);
n++; n++;
...@@ -453,6 +459,30 @@ static int __init parse_elfcorehdr(char *arg) ...@@ -453,6 +459,30 @@ static int __init parse_elfcorehdr(char *arg)
return 0; return 0;
} }
early_param("elfcorehdr", parse_elfcorehdr); early_param("elfcorehdr", parse_elfcorehdr);
int __init reserve_elfcorehdr(unsigned long *start, unsigned long *end)
{
unsigned long length;
/* We get the address using the kernel command line,
* but the size is extracted from the EFI tables.
* Both address and size are required for reservation
* to work properly.
*/
if (elfcorehdr_addr >= ELFCORE_ADDR_MAX)
return -EINVAL;
if ((length = vmcore_find_descriptor_size(elfcorehdr_addr)) == 0) {
elfcorehdr_addr = ELFCORE_ADDR_MAX;
return -EINVAL;
}
*start = (unsigned long)__va(elfcorehdr_addr);
*end = *start + length;
return 0;
}
#endif /* CONFIG_PROC_VMCORE */ #endif /* CONFIG_PROC_VMCORE */
void __init void __init
......
...@@ -9,12 +9,11 @@ lib-y := __divsi3.o __udivsi3.o __modsi3.o __umodsi3.o \ ...@@ -9,12 +9,11 @@ lib-y := __divsi3.o __udivsi3.o __modsi3.o __umodsi3.o \
checksum.o clear_page.o csum_partial_copy.o \ checksum.o clear_page.o csum_partial_copy.o \
clear_user.o strncpy_from_user.o strlen_user.o strnlen_user.o \ clear_user.o strncpy_from_user.o strlen_user.o strnlen_user.o \
flush.o ip_fast_csum.o do_csum.o \ flush.o ip_fast_csum.o do_csum.o \
memset.o strlen.o memset.o strlen.o xor.o
lib-$(CONFIG_ITANIUM) += copy_page.o copy_user.o memcpy.o lib-$(CONFIG_ITANIUM) += copy_page.o copy_user.o memcpy.o
lib-$(CONFIG_MCKINLEY) += copy_page_mck.o memcpy_mck.o lib-$(CONFIG_MCKINLEY) += copy_page_mck.o memcpy_mck.o
lib-$(CONFIG_PERFMON) += carta_random.o lib-$(CONFIG_PERFMON) += carta_random.o
lib-$(CONFIG_MD_RAID456) += xor.o
AFLAGS___divdi3.o = AFLAGS___divdi3.o =
AFLAGS___udivdi3.o = -DUNSIGNED AFLAGS___udivdi3.o = -DUNSIGNED
......
...@@ -197,11 +197,6 @@ find_memory (void) ...@@ -197,11 +197,6 @@ find_memory (void)
find_initrd(); find_initrd();
#ifdef CONFIG_CRASH_DUMP
/* If we are doing a crash dump, we still need to know the real mem
* size before original memory map is reset. */
saved_max_pfn = max_pfn;
#endif
} }
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
......
...@@ -480,12 +480,6 @@ void __init find_memory(void) ...@@ -480,12 +480,6 @@ void __init find_memory(void)
max_pfn = max_low_pfn; max_pfn = max_low_pfn;
find_initrd(); find_initrd();
#ifdef CONFIG_CRASH_DUMP
/* If we are doing a crash dump, we still need to know the real mem
* size before original memory map is reset. */
saved_max_pfn = max_pfn;
#endif
} }
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
......
...@@ -17,10 +17,11 @@ ...@@ -17,10 +17,11 @@
* - kernel code & data * - kernel code & data
* - crash dumping code reserved region * - crash dumping code reserved region
* - Kernel memory map built from EFI memory map * - Kernel memory map built from EFI memory map
* - ELF core header
* *
* More could be added if necessary * More could be added if necessary
*/ */
#define IA64_MAX_RSVD_REGIONS 7 #define IA64_MAX_RSVD_REGIONS 8
struct rsvd_region { struct rsvd_region {
unsigned long start; /* virtual address of beginning of element */ unsigned long start; /* virtual address of beginning of element */
...@@ -36,6 +37,9 @@ extern void find_initrd (void); ...@@ -36,6 +37,9 @@ extern void find_initrd (void);
extern int filter_rsvd_memory (unsigned long start, unsigned long end, void *arg); extern int filter_rsvd_memory (unsigned long start, unsigned long end, void *arg);
extern void efi_memmap_init(unsigned long *, unsigned long *); extern void efi_memmap_init(unsigned long *, unsigned long *);
extern unsigned long vmcore_find_descriptor_size(unsigned long address);
extern int reserve_elfcorehdr(unsigned long *start, unsigned long *end);
/* /*
* For rounding an address to the next IA64_GRANULE_SIZE or order * For rounding an address to the next IA64_GRANULE_SIZE or order
*/ */
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
#define _ASM_IA64_RESOURCE_H #define _ASM_IA64_RESOURCE_H
#include <asm/ustack.h> #include <asm/ustack.h>
#define _STK_LIM_MAX DEFAULT_USER_STACK_SIZE
#include <asm-generic/resource.h> #include <asm-generic/resource.h>
#endif /* _ASM_IA64_RESOURCE_H */ #endif /* _ASM_IA64_RESOURCE_H */
#ifndef _ASM_SWIOTLB_H
#define _ASM_SWIOTLB_H 1
#include <asm/machvec.h>
#define SWIOTLB_ARCH_NEED_LATE_INIT
#define SWIOTLB_ARCH_NEED_ALLOC
#endif /* _ASM_SWIOTLB_H */
...@@ -44,7 +44,6 @@ extern void swiotlb_init(void); ...@@ -44,7 +44,6 @@ extern void swiotlb_init(void);
extern int swiotlb_force; extern int swiotlb_force;
#ifdef CONFIG_SWIOTLB #ifdef CONFIG_SWIOTLB
#define SWIOTLB_ARCH_NEED_ALLOC
extern int swiotlb; extern int swiotlb;
#else #else
#define swiotlb 0 #define swiotlb 0
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment