lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Mon, 8 Mar 2010 10:21:06 +0800
From:	real yr <realyr@...il.com>
To:	linux-kernel@...r.kernel.org
Subject: Why should check "current" consistency?

The source code is listed as follows:
This code is inserted into do_fork() function
============================================
struct asmp_cpu_info *info;
......
restart:
if ((info = current->asmp->cpu)) {
dprintk("forking tsk=%p current=%p #tasks=%d\n", p, current,
info->num_tasks);
spin_lock_irqsave(&info->lock, flags);
                /* MY PROBLEM */
if (info != current->asmp->cpu) {
spin_unlock_irqrestore(&info->lock, flags);
goto restart;
}
WARN_ON(info->shielded != 1);
WARN_ON(info->num_tasks == 0);
p->asmp->cpu = info;
list_add_tail(&p->asmp->list, &info->tasks);
++info->num_tasks;
spin_unlock_irqrestore(&info->lock, flags);
}
=========================================
Please see the code with comments "/* MY PROBLEM */", since info is a
local variable,
even if this code was preempted or interrupted, when the attached
process resumes its
state, it will continues from where it was interrupted and the
"current" macro shold be the same.
So, Why should check "if (info != current->asmp->cpu) {" ?

Thanks in advance!
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ