> +/**
> + * sys_stacktrace_setup - register an address for user space stacktrace 
> walking.
> + * @op: Type of operation to perform
> + * @addr_start: The virtual address of the stacktrace information
> + * @addr_length: The length of the stacktrace information
> + * @text_start: The virtual address of the text that @addr_start represents
> + * @text_length: The length of teh text
> + *
> + * This system call is used by dynamic library utilities to inform the kernel
> + * of meta data that it loaded that can be used by the kernel to know how
> + * to stack walk the given text locations.
> + *
> + * Currently only sframes are supported, but in the future, this may be used
> + * to tell the kernel about JIT code which will most likely have a different
> + * format.
> + *
> + * The type command may be extended and parameters may be used for other
> + * purposes.
> + *
> + * Return: 0 if successful, otherwise a negative error.
> + */
> +SYSCALL_DEFINE5(stacktrace_setup, int, op, unsigned long, addr_start,
> +             unsigned long, addr_length, unsigned long, text_start,
> +             unsigned long, text_length)
> +{
> +     switch (op) {
> +     case STACKTRACE_REGISTER_SFRAME:
> +             return sframe_add_section(addr_start, addr_start + addr_length,
> +                                       text_start, text_start+text_length);
> +     case STACKTRACE_UNREGISTER_SFRAME:
> +             return sframe_remove_section(addr_start);
> +     }
> +     return -EINVAL;
> +}

FWIW passing start and end of both the tracing data and the text segment
it covers seems reasonable to me.  This covers the case in which the
same tracing data describes several text segments, which can happen with
SFrame and other similar formats.

> diff --git a/scripts/syscall.tbl b/scripts/syscall.tbl
> index 7a42b32b6577..54a99cffeec4 100644
> --- a/scripts/syscall.tbl
> +++ b/scripts/syscall.tbl
> @@ -412,3 +412,4 @@
>  469  common  file_setattr                    sys_file_setattr
>  470  common  listns                          sys_listns
>  471  common  rseq_slice_yield                sys_rseq_slice_yield
> +472  common  stacktrace_setup                sys_stacktrace_setup

Reply via email to