aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVineet Gupta <vgupta@synopsys.com>2020-08-06 22:37:36 -0700
committerVineet Gupta <vgupta@kernel.org>2021-10-18 10:20:04 -0700
commitb1afff27a36ab56a6ed1d5933731a360aa896ad3 (patch)
treeeef370540a4ee39ef75f28f49252ab8344a3fb09
parent31629f213dffeacb54300d56f1aecb69b05f6ab1 (diff)
downloadarc-b1afff27a36ab56a6ed1d5933731a360aa896ad3.tar.gz
xxx: debug fork/execve
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
-rw-r--r--arch/arc/kernel/setup.c1
-rw-r--r--fs/exec.c6
-rw-r--r--kernel/fork.c12
-rw-r--r--kernel/kthread.c5
4 files changed, 24 insertions, 0 deletions
diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c
index 7eb620ca1424f..4dfe0543928bd 100644
--- a/arch/arc/kernel/setup.c
+++ b/arch/arc/kernel/setup.c
@@ -39,6 +39,7 @@ unsigned int intr_to_DE_cnt;
int __initdata uboot_tag;
int __initdata uboot_magic;
char __initdata *uboot_arg;
+int arc_debug = 0;
const struct machine_desc *machine_desc;
diff --git a/fs/exec.c b/fs/exec.c
index a098c133d8d74..2a6bc19181031 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1791,6 +1791,8 @@ static int exec_binprm(struct linux_binprm *bprm)
return 0;
}
+extern int arc_debug;
+
/*
* sys_execve() executes a new program.
*/
@@ -1804,6 +1806,10 @@ static int bprm_execve(struct linux_binprm *bprm,
if (retval)
return retval;
+ if (arc_debug)
+ printk("\n(%d) EXECVE: %p %s\n",
+ current->pid, current, filename->name);
+
check_unsafe_exec(bprm);
current->in_execve = 1;
diff --git a/kernel/fork.c b/kernel/fork.c
index 38681ad44c76b..27c8ce0c387b0 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -127,6 +127,8 @@ int nr_threads; /* The idle threads do not count.. */
static int max_threads; /* tunable limit on nr_threads */
+extern int arc_debug;
+
#define NAMED_ARRAY_INDEX(x) [x] = __stringify(x)
static const char * const resident_page_types[] = {
@@ -2273,6 +2275,9 @@ static __latent_entropy struct task_struct *copy_process(
p->tgid = p->pid;
}
+ if (arc_debug)
+ printk("(%d) New child %p (%d)\n\n", current->pid, p, p->pid);
+
p->nr_dirtied = 0;
p->nr_dirtied_pause = 128 >> (PAGE_SHIFT - 10);
p->dirty_paused_when = 0;
@@ -2581,6 +2586,13 @@ pid_t kernel_clone(struct kernel_clone_args *args)
trace = 0;
}
+ if (arc_debug) {
+ char comm[TASK_COMM_LEN];
+ printk("(%d)/%d Fork: \'%s\'\n",
+ current->pid, current->tgid,
+ get_task_comm(comm, current));
+ }
+
p = copy_process(NULL, trace, NUMA_NO_NODE, args);
add_latent_entropy();
diff --git a/kernel/kthread.c b/kernel/kthread.c
index 5b37a8567168b..5db8e0d1c37f5 100644
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -331,10 +331,15 @@ int tsk_fork_get_node(struct task_struct *tsk)
return NUMA_NO_NODE;
}
+extern int arc_debug;
+
static void create_kthread(struct kthread_create_info *create)
{
int pid;
+ if (arc_debug)
+ printk("\nkthread fn %pS\n", create->threadfn);
+
#ifdef CONFIG_NUMA
current->pref_node_fork = create->node;
#endif