Re: [patch 1/1] x86, ptrace: PEBS support

From: Andrew Morton
Date: Tue Apr 15 2008 - 20:37:01 EST


On Tue, 8 Apr 2008 11:01:58 +0200
Markus Metzger <markus.t.metzger@xxxxxxxxx> wrote:

> +static inline void *ds_allocate_buffer(size_t size, unsigned int *pages)
> {
> - (*(unsigned long *)(base + ds_cfg.bts_interrupt_threshold.offset)) = value;
> + unsigned long rlim, vm, pgsz;
> + void *buffer;
> +
> + pgsz = PAGE_ALIGN(size) >> PAGE_SHIFT;
> +
> + rlim = current->signal->rlim[RLIMIT_AS].rlim_cur >> PAGE_SHIFT;
> + vm = current->mm->total_vm + pgsz;
> + if (rlim < vm)
> + return 0;
> +
> + rlim = current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur >> PAGE_SHIFT;
> + vm = current->mm->locked_vm + pgsz;
> + if (rlim < vm)
> + return 0;

Should we skip the RLIMIT_MEMLOCK check if capable(CAP_IPC_LOCK)?

It's a fairly large patch.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/