Sindbad~EG File Manager

Current Path : /proc/2568807/root/usr/share/systemtap/tapset/linux/
Upload File :
Current File : //proc/2568807/root/usr/share/systemtap/tapset/linux/sysc_removexattr.stp

# removexattr ________________________________________________
#
# asmlinkage long
# sys_removexattr(char __user *path,
#		     char __user *name)
#

@define _SYSCALL_REMOVEXATTR_NAME
%(
	name = "removexattr"
%)

@define _SYSCALL_REMOVEXATTR_ARGSTR
%(
	argstr = sprintf("%s, %s", path, name_str)
%)

@define _SYSCALL_REMOVEXATTR_REGARGS
%(
	path = user_string_quoted(pointer_arg(1))
	path_unquoted = user_string_nofault(pointer_arg(1))
	name_str = user_string_quoted(pointer_arg(2))
	name_str_unquoted = user_string_nofault(pointer_arg(2))
%)

@define _SYSCALL_REMOVEXATTR_REGARGS_STORE
%(
        if (@probewrite(path_unquoted))
          set_user_string_arg(pointer_arg(1), path_unquoted)

	if (@probewrite(name_str_unquoted))
	  set_user_string_arg(pointer_arg(2), name_str_unquoted)
%)

probe syscall.removexattr = dw_syscall.removexattr !, nd_syscall.removexattr ? {}
probe syscall.removexattr.return = dw_syscall.removexattr.return !,
                                   nd_syscall.removexattr.return ? {}

# dw_removexattr _____________________________________________________

probe dw_syscall.removexattr = kernel.function("sys_removexattr").call
{
	@_SYSCALL_REMOVEXATTR_NAME
	path = user_string_quoted(@choose_defined($pathname, $path))
	name_str = user_string_quoted($name)
	@_SYSCALL_REMOVEXATTR_ARGSTR
}
probe dw_syscall.removexattr.return = kernel.function("sys_removexattr").return
{
	@_SYSCALL_REMOVEXATTR_NAME
	@SYSC_RETVALSTR($return)
}

# nd_removexattr _____________________________________________________

probe nd_syscall.removexattr = nd1_syscall.removexattr!, nd2_syscall.removexattr!, tp_syscall.removexattr
  { }

probe nd1_syscall.removexattr = kprobe.function("sys_removexattr") ?
{
	@_SYSCALL_REMOVEXATTR_NAME
	asmlinkage()
	@_SYSCALL_REMOVEXATTR_REGARGS
	@_SYSCALL_REMOVEXATTR_ARGSTR
}

/* kernel 4.17+ */
probe nd2_syscall.removexattr = kprobe.function(@arch_syscall_prefix "sys_removexattr") ?
{
	__set_syscall_pt_regs(pointer_arg(1))
	@_SYSCALL_REMOVEXATTR_NAME
	@_SYSCALL_REMOVEXATTR_REGARGS
	@_SYSCALL_REMOVEXATTR_ARGSTR
},
{
        %( @_IS_SREG_KERNEL %? @_SYSCALL_REMOVEXATTR_REGARGS_STORE %)
}

/* kernel 3.5+, but undesirable because it affects all syscalls */
probe tp_syscall.removexattr = kernel.trace("sys_enter")
{
	__set_syscall_pt_regs($regs)
	@__syscall_compat_gate(@const("__NR_removexattr"), @const("__NR_compat_removexattr"))
	@_SYSCALL_REMOVEXATTR_NAME
	@_SYSCALL_REMOVEXATTR_REGARGS
	@_SYSCALL_REMOVEXATTR_ARGSTR
},
{
        %( @_IS_SREG_KERNEL %? @_SYSCALL_REMOVEXATTR_REGARGS_STORE %)
}

probe nd_syscall.removexattr.return = nd1_syscall.removexattr.return!, nd2_syscall.removexattr.return!, tp_syscall.removexattr.return
  { }

probe nd1_syscall.removexattr.return = kprobe.function("sys_removexattr").return ?
{
	@_SYSCALL_REMOVEXATTR_NAME
	@SYSC_RETVALSTR(returnval())
}

/* kernel 4.17+ */
probe nd2_syscall.removexattr.return = kprobe.function(@arch_syscall_prefix "sys_removexattr").return ?
{
	@_SYSCALL_REMOVEXATTR_NAME
	@SYSC_RETVALSTR(returnval())
}

/* kernel 3.5+, but undesirable because it affects all syscalls */
probe tp_syscall.removexattr.return = kernel.trace("sys_exit")
{
	__set_syscall_pt_regs($regs)
	@__syscall_compat_gate(@const("__NR_removexattr"), @const("__NR_compat_removexattr"))
	@_SYSCALL_REMOVEXATTR_NAME
	@SYSC_RETVALSTR($ret)
}

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists