Skip to content

Commit

Permalink
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/g…
Browse files Browse the repository at this point in the history
…it/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)"
  • Loading branch information
Linus Torvalds committed Mar 7, 2007
2 parents 185d84b + cee87af commit 1ba73b9
Show file tree
Hide file tree
Showing 12 changed files with 121 additions and 181 deletions.
10 changes: 7 additions & 3 deletions arch/ia64/ia32/sys_ia32.c
Original file line number Diff line number Diff line change
Expand Up @@ -1267,6 +1267,10 @@ sys32_getdents (unsigned int fd, struct compat_dirent __user *dirent, unsigned i
struct getdents32_callback buf;
int error;

error = -EFAULT;
if (!access_ok(VERIFY_WRITE, dirent, count))
goto out;

error = -EBADF;
file = fget(fd);
if (!file)
Expand All @@ -1283,10 +1287,10 @@ sys32_getdents (unsigned int fd, struct compat_dirent __user *dirent, unsigned i
error = buf.error;
lastdirent = buf.previous;
if (lastdirent) {
error = -EINVAL;
if (put_user(file->f_pos, &lastdirent->d_off))
goto out_putf;
error = count - buf.count;
error = -EFAULT;
else
error = count - buf.count;
}

out_putf:
Expand Down
36 changes: 36 additions & 0 deletions arch/ia64/kernel/efi.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* Skip non-WB memory and ignore empty memory ranges.
*/
#include <linux/module.h>
#include <linux/bootmem.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/types.h>
Expand Down Expand Up @@ -1009,6 +1010,11 @@ efi_memmap_init(unsigned long *s, unsigned long *e)
} else
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 */
as = max(as, min_addr);
ae = min(ae, max_addr);
Expand Down Expand Up @@ -1177,3 +1183,33 @@ kdump_find_rsvd_region (unsigned long size,
return ~0UL;
}
#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
11 changes: 7 additions & 4 deletions arch/ia64/kernel/perfmon.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
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 vm_area_struct *vma = NULL;
Expand Down Expand Up @@ -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
*/
vma->vm_mm = mm;
vma->vm_file = filp;
vma->vm_flags = VM_READ| VM_MAYREAD |VM_RESERVED;
vma->vm_page_prot = PAGE_READONLY; /* XXX may need to change */

Expand Down Expand Up @@ -2387,6 +2388,8 @@ pfm_smpl_buffer_alloc(struct task_struct *task, pfm_context_t *ctx, unsigned lon
goto error;
}

get_file(filp);

/*
* now insert the vma in the vm list for the process, must be
* done with mmap lock held
Expand Down Expand Up @@ -2464,7 +2467,7 @@ pfarg_is_sane(struct task_struct *task, pfarg_context_t *pfx)
}

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)
{
pfm_buffer_fmt_t *fmt = NULL;
Expand Down Expand Up @@ -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
*/
ret = pfm_smpl_buffer_alloc(current, ctx, size, &uaddr);
ret = pfm_smpl_buffer_alloc(current, filp, ctx, size, &uaddr);
if (ret) goto error;

/* keep track of user address of buffer */
Expand Down Expand Up @@ -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?
*/
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;
}

Expand Down
30 changes: 30 additions & 0 deletions arch/ia64/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,12 @@ reserve_memory (void)
}
#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);
n++;

Expand Down Expand Up @@ -453,6 +459,30 @@ static int __init parse_elfcorehdr(char *arg)
return 0;
}
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 */

void __init
Expand Down
3 changes: 1 addition & 2 deletions arch/ia64/lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ lib-y := __divsi3.o __udivsi3.o __modsi3.o __umodsi3.o \
checksum.o clear_page.o csum_partial_copy.o \
clear_user.o strncpy_from_user.o strlen_user.o strnlen_user.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_MCKINLEY) += copy_page_mck.o memcpy_mck.o
lib-$(CONFIG_PERFMON) += carta_random.o
lib-$(CONFIG_MD_RAID456) += xor.o

AFLAGS___divdi3.o =
AFLAGS___udivdi3.o = -DUNSIGNED
Expand Down
5 changes: 0 additions & 5 deletions arch/ia64/mm/contig.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,6 @@ find_memory (void)

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
Expand Down
6 changes: 0 additions & 6 deletions arch/ia64/mm/discontig.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,12 +480,6 @@ void __init find_memory(void)
max_pfn = max_low_pfn;

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
Expand Down
6 changes: 5 additions & 1 deletion include/asm-ia64/meminit.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
* - kernel code & data
* - crash dumping code reserved region
* - Kernel memory map built from EFI memory map
* - ELF core header
*
* More could be added if necessary
*/
#define IA64_MAX_RSVD_REGIONS 7
#define IA64_MAX_RSVD_REGIONS 8

struct rsvd_region {
unsigned long start; /* virtual address of beginning of element */
Expand All @@ -36,6 +37,9 @@ extern void find_initrd (void);
extern int filter_rsvd_memory (unsigned long start, unsigned long end, void *arg);
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
*/
Expand Down
1 change: 0 additions & 1 deletion include/asm-ia64/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#define _ASM_IA64_RESOURCE_H

#include <asm/ustack.h>
#define _STK_LIM_MAX DEFAULT_USER_STACK_SIZE
#include <asm-generic/resource.h>

#endif /* _ASM_IA64_RESOURCE_H */
9 changes: 0 additions & 9 deletions include/asm-ia64/swiotlb.h

This file was deleted.

1 change: 0 additions & 1 deletion include/asm-x86_64/swiotlb.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ extern void swiotlb_init(void);
extern int swiotlb_force;

#ifdef CONFIG_SWIOTLB
#define SWIOTLB_ARCH_NEED_ALLOC
extern int swiotlb;
#else
#define swiotlb 0
Expand Down
Loading

0 comments on commit 1ba73b9

Please sign in to comment.