/* determine how safe it is to execute the proposed program */
int check_unsafe_exec(struct linux_binprm *bprm)
/* determine how safe it is to execute the proposed program */
int check_unsafe_exec(struct linux_binprm *bprm)
{
	struct task_struct *p = current, *t;
	unsigned n_fs;
	int res = 0;
	bprm->unsafe = tracehook_unsafe_exec(p);
	n_fs = 1;
	write_lock(&p->fs->lock);
	rcu_read_lock();
	for (t = next_thread(p); t != p; t = next_thread(t)) {
		if (t->fs == p->fs)
			n_fs++;
	}
	rcu_read_unlock();
	if (p->fs->users > n_fs) {
		bprm->unsafe |= LSM_UNSAFE_SHARE;
	} else {
		res = -EAGAIN;
		if (!p->fs->in_exec) {
			p->fs->in_exec = 1;
			res = 1;
		}
	}
	write_unlock(&p->fs->lock);
	return res;
}