Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\coredump.c Create Date:2022-07-28 20:30:54
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:do_coredump

Proto:void do_coredump(const kernel_siginfo_t *siginfo)

Type:void

Parameter:

TypeParameterName
const kernel_siginfo_t *siginfo
569  mm = mm
573  retval = 0
575  size_t * argv = NULL
576  argc = 0
579  bool need_suid_safe = false
580  bool core_dumped = false
581  core_dump_count = Atomic operations that C can't guarantee us. Useful for* resource counting etc..(0)
582  struct coredump_params cprm = {siginfo = siginfo, regs = unlike current_pt_regs(), this one is equal to task_pt_regs(current)* on *all* architectures; the only reason to have a per-arch definition* is optimisation.(), limit = rlimit(RLIMIT_CORE), mm_flags = Must use atomic bitops to access , }
594  audit_core_dumps(si_signo)
596  binfmt = binfmt
597  If Not binfmt || Not core_dump Then Go to fail
599  If Not This returns the actual value of the suid_dumpable flag. For things* that are using this for checking for privilege transitions, it must* test against SUID_DUMP_USER rather than treating it as a boolean* value. Then Go to fail
602  cred = prepare_creds - Prepare a new set of credentials for modification* Prepare a new set of task credentials for modification
603  If Not cred Then Go to fail
611  If This returns the actual value of the suid_dumpable flag. For things* that are using this for checking for privilege transitions, it must* test against SUID_DUMP_USER rather than treating it as a boolean* value. == Dump as root Then
613  UID for VFS ops = GLOBAL_ROOT_UID
614  need_suid_safe = true
617  retval = coredump_wait(si_signo, & core_state)
618  If retval < 0 Then Go to fail_creds
621  old_cred = verride_creds - Override the current process's subjective credentials*@new: The credentials to be assigned* Install a set of temporary override subjective credentials on the current* process, returning the old set for later reversion.
623  ispipe = rmat_corename will inspect the pattern parameter, and output a* name into corename, which must have space for at least* CORENAME_MAX_SIZE bytes plus one byte for the zero terminator.
625  If ispipe Then
631  If ispipe < 0 Then
634  Go to fail_unlock
637  If limit == 1 Then
657  Go to fail_unlock
659  limit = RLIM_INFINITY
661  dump_count = atomic_inc_return( & core_dump_count)
666  Go to fail_dropcount
669  helper_argv = kmalloc_array - allocate memory for an array.*@n: number of elements.*@size: element size.*@flags: the type of memory to allocate (see kmalloc).
671  If Not helper_argv Then
674  Go to fail_dropcount
676  When argi < argc cycle helper_argv[argi] = corename + argv[argi]
678  helper_argv[argi] = NULL
680  retval = -ENOMEM
681  sub_info = all_usermodehelper_setup - prepare to call a usermode helper*@path: path to usermode executable*@argv: arg vector for process*@envp: environment for process*@gfp_mask: gfp mask for memory allocation*@cleanup: a cleanup function*@init: an init
684  If sub_info Then retval = all_usermodehelper_exec - start a usermode application*@sub_info: information about the subprocessa*@wait: wait for the application to finish and return status.* when UMH_NO_WAIT don't wait at all, but you get no useful error back
688  kfree(helper_argv)
689  If retval Then
692  Go to close_fail
694  Else
696  open_flags = O_CREAT | O_RDWR | O_NOFOLLOW | O_LARGEFILE | O_EXCL
699  If limit < minimal dump size Then Go to fail_unlock
702  If need_suid_safe && corename[0] != '/' Then
707  Go to fail_unlock
715  If Not need_suid_safe Then
731  If need_suid_safe Then
749  Else
752  If IS_ERR(file) Then Go to fail_unlock
755  inode = file_inode(file)
756  If i_nlink > 1 Then Go to close_fail
758  If d_unhashed - is dentry hashed*@dentry: entry to check* Returns true if the dentry passed is not currently hashed. Then Go to close_fail
764  If Not S_ISREG(i_mode) Then Go to close_fail
772  If Not uid_eq(i_uid, current_fsuid()) Then Go to close_fail
774  If (i_mode & 0677) != 0600 Then Go to close_fail
776  If Not (f_mode & Has write method(s) ) Then Go to close_fail
778  If do_truncate(dentry, 0, 0, file) Then Go to close_fail
783  retval = Helper to unshare the files of the current task.* We don't want to expose copy_files internals to* the exec layer of the kernel.
784  If retval Then Go to close_fail
786  If displaced Then put_files_struct(displaced)
788  If Not dump_interrupted() Then
789  file_start_write(file)
790  core_dumped = core_dump( & cprm)
791  file_end_write(file)
793  If ispipe && core_pipe_limit Then wait_for_dump_helpers(file)
795  close_fail :
796  If file Then "id" is the POSIX thread ID. We use the* files pointer for this..
798  fail_dropcount :
799  If ispipe Then atomic_dec( & core_dump_count)
801  fail_unlock :
802  kfree(argv)
803  kfree(corename)
804  coredump_finish(mm, core_dumped)
805  vert_creds - Revert a temporary subjective credentials override*@old: The credentials to be restored* Revert a temporary set of override subjective credentials to an old set,* discarding the override set.
806  fail_creds :
807  put_cred - Release a reference to a set of credentials*@cred: The credentials to release* Release a reference to a set of credentials, deleting them when the last ref* is released
808  fail :
809  Return
Caller
NameDescribe
get_signal