403Webshell
Server IP : 103.4.122.14  /  Your IP : 216.73.216.103
Web Server : Apache/2.4.62 (Unix) OpenSSL/1.0.2k-fips
System : Linux cwp2.slnet.com.au 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User : statewid ( 1251)
PHP Version : 8.3.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/share/systemtap/tapset/linux/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/share/systemtap/tapset/linux/sysc_dup3.stp
# dup3 _______________________________________________________
# SYSCALL_DEFINE3(dup3, unsigned int, oldfd, unsigned int, newfd, int, flags)

@define _SYSCALL_DUP3_NAME
%(
	name = "dup3";
%)

@define _SYSCALL_DUP3_ARGSTR
%(
	argstr = sprintf("%d, %d, %s", oldfd, newfd,  flags_str)
%)

@define _SYSCALL_DUP3_REGARGS
%(
	oldfd = int_arg(1)
	newfd = int_arg(2)
	flags = int_arg(3)
	flags_str = _dup3_flag_str(flags)
%)

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

# dw_dup3 _____________________________________________________

probe dw_syscall.dup3 = kernel.function("sys_dup3").call ?
{
	@__syscall_compat_gate(@const("__NR_dup3"), @const("__NR_compat_dup3"))
	@_SYSCALL_DUP3_NAME
	oldfd = __int32($oldfd)
	newfd = __int32($newfd)
	flags = __int32($flags)
	flags_str = _dup3_flag_str(flags)
	@_SYSCALL_DUP3_ARGSTR
}
probe dw_syscall.dup3.return = kernel.function("sys_dup3").return ?
{
	@__syscall_compat_gate(@const("__NR_dup3"), @const("__NR_compat_dup3"))
	@_SYSCALL_DUP3_NAME
	@SYSC_RETVALSTR($return)
}

# nd_dup3 _____________________________________________________

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

probe nd1_syscall.dup3 = kprobe.function("sys_dup3") ?
{
	@__syscall_compat_gate(@const("__NR_dup3"), @const("__NR_compat_dup3"))
	@_SYSCALL_DUP3_NAME
	asmlinkage()
	@_SYSCALL_DUP3_REGARGS
	@_SYSCALL_DUP3_ARGSTR
}

/* kernel 4.17+ */
probe nd2_syscall.dup3 = kprobe.function(@arch_syscall_prefix "sys_dup3") ?
{
	__set_syscall_pt_regs(pointer_arg(1))
	@_SYSCALL_DUP3_NAME
	@_SYSCALL_DUP3_REGARGS
	@_SYSCALL_DUP3_ARGSTR
}

/* kernel 3.5+, but undesirable because it affects all syscalls */
probe tp_syscall.dup3 = kernel.trace("sys_enter")
{
	__set_syscall_pt_regs($regs)
	@__syscall_compat_gate(@const("__NR_dup3"), @const("__NR_compat_dup3"))
	@_SYSCALL_DUP3_NAME
	@_SYSCALL_DUP3_REGARGS
	@_SYSCALL_DUP3_ARGSTR
}

probe nd_syscall.dup3.return = nd1_syscall.dup3.return!, nd2_syscall.dup3.return!, tp_syscall.dup3.return
  { }
  
probe nd1_syscall.dup3.return = kprobe.function("sys_dup3").return ?
{
	@__syscall_compat_gate(@const("__NR_dup3"), @const("__NR_compat_dup3"))
	@_SYSCALL_DUP3_NAME
	@SYSC_RETVALSTR(returnval())
}

/* kernel 4.17+ */
probe nd2_syscall.dup3.return = kprobe.function(@arch_syscall_prefix "sys_dup3").return ?
{
	@_SYSCALL_DUP3_NAME
	@SYSC_RETVALSTR(returnval())
}
 
/* kernel 3.5+, but undesirable because it affects all syscalls */
probe tp_syscall.dup3.return = kernel.trace("sys_exit")
{
	__set_syscall_pt_regs($regs)
	@__syscall_compat_gate(@const("__NR_dup3"), @const("__NR_compat_dup3"))
	@_SYSCALL_DUP3_NAME
	@SYSC_RETVALSTR($ret)
}

Youez - 2016 - github.com/yon3zu
LinuXploit