2

Is there a way to block every input of a process from the standard input? I mean, not closing it's stdin file descriptor, but avoid any input that comes from the standard input device.

1
  • I strongly disagree with the close votes. Commented Jul 10, 2015 at 2:05

2 Answers 2

2

Assign the /dev/null device to STDIN.

Sign up to request clarification or add additional context in comments.

2 Comments

The question is about doing it in kernel. Could you be more elaborate on how this could be done in kernel?
How do you want to identify the process to change? I presume that you do not want to change every process.
0

You can modify this function in fork.c:

static int copy_files(unsigned long clone_flags, struct task_struct *tsk)

You need to do this just before you return from the function:

files_fdtable(newf)->fd[0] = NULL 

This is the way it could be done. But take it with a pinch of salt!

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.