/* Do the capability checks, and require read and write.  */
static int smack_ptrace_traceme(struct task_struct *ptp)
/* Do the capability checks, and require read and write.  */
static int smack_ptrace_traceme(struct task_struct *ptp)
{
	int rc;
	struct smk_audit_info ad;
	char *sp, *tsp;
	rc = cap_ptrace_traceme(ptp);
	if (rc != 0)
		return rc;
	smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_TASK);
	smk_ad_setfield_u_tsk(&ad, ptp);
	sp = current_security();
	tsp = task_security(ptp);
	rc = smk_access(tsp, sp, MAY_READWRITE, NULL);
	if (rc != 0 && has_capability(ptp, CAP_MAC_OVERRIDE))
		rc = 0;
	smack_log(tsp, sp, MAY_READWRITE, rc, &ad);
	return rc;
}