@@ -1455,14 +1455,15 @@ struct task_struct {
1455
1455
/* Used for emulating ABI behavior of previous Linux versions */
1456
1456
unsigned int personality ;
1457
1457
1458
- unsigned in_execve :1 ; /* Tell the LSMs that the process is doing an
1459
- * execve */
1460
- unsigned in_iowait :1 ;
1461
-
1462
- /* Revert to default priority/policy when forking */
1458
+ /* scheduler bits, serialized by scheduler locks */
1463
1459
unsigned sched_reset_on_fork :1 ;
1464
1460
unsigned sched_contributes_to_load :1 ;
1465
1461
unsigned sched_migrated :1 ;
1462
+ unsigned :0 ; /* force alignment to the next boundary */
1463
+
1464
+ /* unserialized, strictly 'current' */
1465
+ unsigned in_execve :1 ; /* bit to tell LSMs we're in execve */
1466
+ unsigned in_iowait :1 ;
1466
1467
#ifdef CONFIG_MEMCG
1467
1468
unsigned memcg_may_oom :1 ;
1468
1469
#endif
@@ -2002,7 +2003,8 @@ static inline int pid_alive(const struct task_struct *p)
2002
2003
}
2003
2004
2004
2005
/**
2005
- * is_global_init - check if a task structure is init
2006
+ * is_global_init - check if a task structure is init. Since init
2007
+ * is free to have sub-threads we need to check tgid.
2006
2008
* @tsk: Task structure to be checked.
2007
2009
*
2008
2010
* Check if a task structure is the first user space task the kernel created.
@@ -2011,7 +2013,7 @@ static inline int pid_alive(const struct task_struct *p)
2011
2013
*/
2012
2014
static inline int is_global_init (struct task_struct * tsk )
2013
2015
{
2014
- return tsk -> pid == 1 ;
2016
+ return task_tgid_nr ( tsk ) == 1 ;
2015
2017
}
2016
2018
2017
2019
extern struct pid * cad_pid ;
0 commit comments