2019-05-28 09:57:20 -07:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-11-02 14:30:58 -05:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-09-19 16:44:50 -04:00
|
|
|
|
|
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-04-28 10:51:53 -04:00
|
|
|
|
2006-11-27 11:31:22 -06:00
|
|
|
|
2008-08-06 13:30:24 -05:00
|
|
|
|
2011-04-05 13:16:24 -05:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
2006-01-20 08:47:07 +00:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-06-06 14:38:25 -07:00
|
|
|
|
|
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
2014-06-06 14:38:25 -07:00
|
|
|
|
|
|
|
|
|
2006-11-06 08:53:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-11-06 08:53:28 +00:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-06-06 14:38:25 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-09-06 17:01:40 -05:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-06-06 14:38:25 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dlm: fixes for nodir mode
The "nodir" mode (statically assign master nodes instead
of using the resource directory) has always been highly
experimental, and never seriously used. This commit
fixes a number of problems, making nodir much more usable.
- Major change to recovery: recover all locks and restart
all in-progress operations after recovery. In some
cases it's not possible to know which in-progess locks
to recover, so recover all. (Most require recovery
in nodir mode anyway since rehashing changes most
master nodes.)
- Change the way nodir mode is enabled, from a command
line mount arg passed through gfs2, into a sysfs
file managed by dlm_controld, consistent with the
other config settings.
- Allow recovering MSTCPY locks on an rsb that has not
yet been turned into a master copy.
- Ignore RCOM_LOCK and RCOM_LOCK_REPLY recovery messages
from a previous, aborted recovery cycle. Base this
on the local recovery status not being in the state
where any nodes should be sending LOCK messages for the
current recovery cycle.
- Hold rsb lock around dlm_purge_mstcpy_locks() because it
may run concurrently with dlm_recover_master_copy().
- Maintain highbast on process-copy lkb's (in addition to
the master as is usual), because the lkb can switch
back and forth between being a master and being a
process copy as the master node changes in recovery.
- When recovering MSTCPY locks, flag rsb's that have
non-empty convert or waiting queues for granting
at the end of recovery. (Rename flag from LOCKS_PURGED
to RECOVER_GRANT and similar for the recovery function,
because it's not only resources with purged locks
that need grant a grant attempt.)
- Replace a couple of unnecessary assertion panics with
error messages.
Signed-off-by: David Teigland <teigland@redhat.com>
2012-04-26 15:54:29 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-06-06 14:38:25 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dlm: fixes for nodir mode
The "nodir" mode (statically assign master nodes instead
of using the resource directory) has always been highly
experimental, and never seriously used. This commit
fixes a number of problems, making nodir much more usable.
- Major change to recovery: recover all locks and restart
all in-progress operations after recovery. In some
cases it's not possible to know which in-progess locks
to recover, so recover all. (Most require recovery
in nodir mode anyway since rehashing changes most
master nodes.)
- Change the way nodir mode is enabled, from a command
line mount arg passed through gfs2, into a sysfs
file managed by dlm_controld, consistent with the
other config settings.
- Allow recovering MSTCPY locks on an rsb that has not
yet been turned into a master copy.
- Ignore RCOM_LOCK and RCOM_LOCK_REPLY recovery messages
from a previous, aborted recovery cycle. Base this
on the local recovery status not being in the state
where any nodes should be sending LOCK messages for the
current recovery cycle.
- Hold rsb lock around dlm_purge_mstcpy_locks() because it
may run concurrently with dlm_recover_master_copy().
- Maintain highbast on process-copy lkb's (in addition to
the master as is usual), because the lkb can switch
back and forth between being a master and being a
process copy as the master node changes in recovery.
- When recovering MSTCPY locks, flag rsb's that have
non-empty convert or waiting queues for granting
at the end of recovery. (Rename flag from LOCKS_PURGED
to RECOVER_GRANT and similar for the recovery function,
because it's not only resources with purged locks
that need grant a grant attempt.)
- Replace a couple of unnecessary assertion panics with
error messages.
Signed-off-by: David Teigland <teigland@redhat.com>
2012-04-26 15:54:29 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-04-28 10:51:53 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-09-06 17:01:40 -05:00
|
|
|
|
2006-04-28 10:51:53 -04:00
|
|
|
|
|
|
|
|
|
2006-08-08 17:08:42 -05:00
|
|
|
|
|
|
|
|
|
2006-09-06 17:01:40 -05:00
|
|
|
|
2006-08-08 17:08:42 -05:00
|
|
|
|
|
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dlm: fixes for nodir mode
The "nodir" mode (statically assign master nodes instead
of using the resource directory) has always been highly
experimental, and never seriously used. This commit
fixes a number of problems, making nodir much more usable.
- Major change to recovery: recover all locks and restart
all in-progress operations after recovery. In some
cases it's not possible to know which in-progess locks
to recover, so recover all. (Most require recovery
in nodir mode anyway since rehashing changes most
master nodes.)
- Change the way nodir mode is enabled, from a command
line mount arg passed through gfs2, into a sysfs
file managed by dlm_controld, consistent with the
other config settings.
- Allow recovering MSTCPY locks on an rsb that has not
yet been turned into a master copy.
- Ignore RCOM_LOCK and RCOM_LOCK_REPLY recovery messages
from a previous, aborted recovery cycle. Base this
on the local recovery status not being in the state
where any nodes should be sending LOCK messages for the
current recovery cycle.
- Hold rsb lock around dlm_purge_mstcpy_locks() because it
may run concurrently with dlm_recover_master_copy().
- Maintain highbast on process-copy lkb's (in addition to
the master as is usual), because the lkb can switch
back and forth between being a master and being a
process copy as the master node changes in recovery.
- When recovering MSTCPY locks, flag rsb's that have
non-empty convert or waiting queues for granting
at the end of recovery. (Rename flag from LOCKS_PURGED
to RECOVER_GRANT and similar for the recovery function,
because it's not only resources with purged locks
that need grant a grant attempt.)
- Replace a couple of unnecessary assertion panics with
error messages.
Signed-off-by: David Teigland <teigland@redhat.com>
2012-04-26 15:54:29 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-04-28 10:51:53 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-08-08 17:08:42 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dlm: fixes for nodir mode
The "nodir" mode (statically assign master nodes instead
of using the resource directory) has always been highly
experimental, and never seriously used. This commit
fixes a number of problems, making nodir much more usable.
- Major change to recovery: recover all locks and restart
all in-progress operations after recovery. In some
cases it's not possible to know which in-progess locks
to recover, so recover all. (Most require recovery
in nodir mode anyway since rehashing changes most
master nodes.)
- Change the way nodir mode is enabled, from a command
line mount arg passed through gfs2, into a sysfs
file managed by dlm_controld, consistent with the
other config settings.
- Allow recovering MSTCPY locks on an rsb that has not
yet been turned into a master copy.
- Ignore RCOM_LOCK and RCOM_LOCK_REPLY recovery messages
from a previous, aborted recovery cycle. Base this
on the local recovery status not being in the state
where any nodes should be sending LOCK messages for the
current recovery cycle.
- Hold rsb lock around dlm_purge_mstcpy_locks() because it
may run concurrently with dlm_recover_master_copy().
- Maintain highbast on process-copy lkb's (in addition to
the master as is usual), because the lkb can switch
back and forth between being a master and being a
process copy as the master node changes in recovery.
- When recovering MSTCPY locks, flag rsb's that have
non-empty convert or waiting queues for granting
at the end of recovery. (Rename flag from LOCKS_PURGED
to RECOVER_GRANT and similar for the recovery function,
because it's not only resources with purged locks
that need grant a grant attempt.)
- Replace a couple of unnecessary assertion panics with
error messages.
Signed-off-by: David Teigland <teigland@redhat.com>
2012-04-26 15:54:29 -05:00
|
|
|
|
2006-04-28 10:51:53 -04:00
|
|
|
|
2006-08-08 17:08:42 -05:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
2019-05-07 21:48:05 -04:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-11-02 14:41:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-01-19 02:58:23 +01:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-05-07 21:48:05 -04:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
2006-11-02 14:41:23 +00:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
2007-10-29 20:13:17 +01:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-02-14 11:54:44 -06:00
|
|
|
|
2007-05-18 09:03:35 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
2007-05-18 09:03:35 -05:00
|
|
|
|
2014-02-14 11:54:44 -06:00
|
|
|
|
2007-05-18 09:03:35 -05:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-05-18 09:03:35 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-02-17 09:41:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-07-28 18:49:17 +05:30
|
|
|
|
2010-02-17 09:41:34 +00:00
|
|
|
|
|
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
2008-02-02 01:53:46 +08:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
2006-01-20 08:47:07 +00:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-02-17 09:41:34 +00:00
|
|
|
|
2007-10-29 20:13:17 +01:00
|
|
|
|
2008-04-30 00:55:09 -07:00
|
|
|
|
2007-10-29 20:13:17 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-10-29 20:13:17 +01:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
2008-08-18 14:03:25 -05:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-08-18 14:03:25 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
2008-08-18 14:03:25 -05:00
|
|
|
|
|
|
|
|
|
2007-05-18 08:58:15 -05:00
|
|
|
|
2008-08-18 14:03:25 -05:00
|
|
|
|
2007-05-18 08:58:15 -05:00
|
|
|
|
2007-05-18 08:59:31 -05:00
|
|
|
|
2011-03-28 14:17:26 -05:00
|
|
|
|
2007-05-18 08:58:15 -05:00
|
|
|
|
2008-08-18 14:03:25 -05:00
|
|
|
|
|
|
|
|
|
2007-05-18 08:58:15 -05:00
|
|
|
|
2011-03-28 14:17:26 -05:00
|
|
|
|
2007-05-18 08:58:15 -05:00
|
|
|
|
2011-03-28 14:17:26 -05:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-07-12 16:44:04 -05:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
2006-07-12 16:44:04 -05:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
2006-07-12 16:44:04 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-08-06 13:30:24 -05:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-04-05 13:16:24 -05:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-11-02 14:30:58 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
2008-08-06 13:30:24 -05:00
|
|
|
|
2007-05-18 09:02:20 -05:00
|
|
|
|
2011-11-02 14:30:58 -05:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
2018-11-02 14:18:21 -06:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-08-18 11:43:30 -05:00
|
|
|
|
2011-11-02 14:30:58 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-07-11 09:26:55 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-11-02 14:30:58 -05:00
|
|
|
|
|
|
|
|
|
2017-05-18 10:42:12 +08:00
|
|
|
|
|
|
|
|
|
2011-11-02 14:30:58 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-08-18 11:43:30 -05:00
|
|
|
|
|
|
|
|
|
2008-08-06 13:30:24 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-04-08 15:38:43 -05:00
|
|
|
|
|
|
|
|
|
2008-08-06 13:30:24 -05:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
2008-08-06 13:30:24 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-04-08 15:38:43 -05:00
|
|
|
|
2008-08-06 13:30:24 -05:00
|
|
|
|
|
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
2009-11-30 16:34:43 -06:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-08-18 14:03:25 -05:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
2011-11-02 14:30:58 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-05-18 08:59:31 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-06-11 10:47:18 -05:00
|
|
|
|
2008-08-06 13:30:24 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-06-11 10:47:18 -05:00
|
|
|
|
2007-01-09 09:41:48 -06:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
treewide: Use array_size() in vmalloc()
The vmalloc() function has no 2-factor argument form, so multiplication
factors need to be wrapped in array_size(). This patch replaces cases of:
vmalloc(a * b)
with:
vmalloc(array_size(a, b))
as well as handling cases of:
vmalloc(a * b * c)
with:
vmalloc(array3_size(a, b, c))
This does, however, attempt to ignore constant size factors like:
vmalloc(4 * 1024)
though any constants defined via macros get caught up in the conversion.
Any factors with a sizeof() of "unsigned char", "char", and "u8" were
dropped, since they're redundant.
The Coccinelle script used for this was:
// Fix redundant parens around sizeof().
@@
type TYPE;
expression THING, E;
@@
(
vmalloc(
- (sizeof(TYPE)) * E
+ sizeof(TYPE) * E
, ...)
|
vmalloc(
- (sizeof(THING)) * E
+ sizeof(THING) * E
, ...)
)
// Drop single-byte sizes and redundant parens.
@@
expression COUNT;
typedef u8;
typedef __u8;
@@
(
vmalloc(
- sizeof(u8) * (COUNT)
+ COUNT
, ...)
|
vmalloc(
- sizeof(__u8) * (COUNT)
+ COUNT
, ...)
|
vmalloc(
- sizeof(char) * (COUNT)
+ COUNT
, ...)
|
vmalloc(
- sizeof(unsigned char) * (COUNT)
+ COUNT
, ...)
|
vmalloc(
- sizeof(u8) * COUNT
+ COUNT
, ...)
|
vmalloc(
- sizeof(__u8) * COUNT
+ COUNT
, ...)
|
vmalloc(
- sizeof(char) * COUNT
+ COUNT
, ...)
|
vmalloc(
- sizeof(unsigned char) * COUNT
+ COUNT
, ...)
)
// 2-factor product with sizeof(type/expression) and identifier or constant.
@@
type TYPE;
expression THING;
identifier COUNT_ID;
constant COUNT_CONST;
@@
(
vmalloc(
- sizeof(TYPE) * (COUNT_ID)
+ array_size(COUNT_ID, sizeof(TYPE))
, ...)
|
vmalloc(
- sizeof(TYPE) * COUNT_ID
+ array_size(COUNT_ID, sizeof(TYPE))
, ...)
|
vmalloc(
- sizeof(TYPE) * (COUNT_CONST)
+ array_size(COUNT_CONST, sizeof(TYPE))
, ...)
|
vmalloc(
- sizeof(TYPE) * COUNT_CONST
+ array_size(COUNT_CONST, sizeof(TYPE))
, ...)
|
vmalloc(
- sizeof(THING) * (COUNT_ID)
+ array_size(COUNT_ID, sizeof(THING))
, ...)
|
vmalloc(
- sizeof(THING) * COUNT_ID
+ array_size(COUNT_ID, sizeof(THING))
, ...)
|
vmalloc(
- sizeof(THING) * (COUNT_CONST)
+ array_size(COUNT_CONST, sizeof(THING))
, ...)
|
vmalloc(
- sizeof(THING) * COUNT_CONST
+ array_size(COUNT_CONST, sizeof(THING))
, ...)
)
// 2-factor product, only identifiers.
@@
identifier SIZE, COUNT;
@@
vmalloc(
- SIZE * COUNT
+ array_size(COUNT, SIZE)
, ...)
// 3-factor product with 1 sizeof(type) or sizeof(expression), with
// redundant parens removed.
@@
expression THING;
identifier STRIDE, COUNT;
type TYPE;
@@
(
vmalloc(
- sizeof(TYPE) * (COUNT) * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
vmalloc(
- sizeof(TYPE) * (COUNT) * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
vmalloc(
- sizeof(TYPE) * COUNT * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
vmalloc(
- sizeof(TYPE) * COUNT * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(TYPE))
, ...)
|
vmalloc(
- sizeof(THING) * (COUNT) * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
vmalloc(
- sizeof(THING) * (COUNT) * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
vmalloc(
- sizeof(THING) * COUNT * (STRIDE)
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
|
vmalloc(
- sizeof(THING) * COUNT * STRIDE
+ array3_size(COUNT, STRIDE, sizeof(THING))
, ...)
)
// 3-factor product with 2 sizeof(variable), with redundant parens removed.
@@
expression THING1, THING2;
identifier COUNT;
type TYPE1, TYPE2;
@@
(
vmalloc(
- sizeof(TYPE1) * sizeof(TYPE2) * COUNT
+ array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
, ...)
|
vmalloc(
- sizeof(TYPE1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
, ...)
|
vmalloc(
- sizeof(THING1) * sizeof(THING2) * COUNT
+ array3_size(COUNT, sizeof(THING1), sizeof(THING2))
, ...)
|
vmalloc(
- sizeof(THING1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(THING1), sizeof(THING2))
, ...)
|
vmalloc(
- sizeof(TYPE1) * sizeof(THING2) * COUNT
+ array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
, ...)
|
vmalloc(
- sizeof(TYPE1) * sizeof(THING2) * (COUNT)
+ array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
, ...)
)
// 3-factor product, only identifiers, with redundant parens removed.
@@
identifier STRIDE, SIZE, COUNT;
@@
(
vmalloc(
- (COUNT) * STRIDE * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
vmalloc(
- COUNT * (STRIDE) * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
vmalloc(
- COUNT * STRIDE * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
vmalloc(
- (COUNT) * (STRIDE) * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
vmalloc(
- COUNT * (STRIDE) * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
vmalloc(
- (COUNT) * STRIDE * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
vmalloc(
- (COUNT) * (STRIDE) * (SIZE)
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
|
vmalloc(
- COUNT * STRIDE * SIZE
+ array3_size(COUNT, STRIDE, SIZE)
, ...)
)
// Any remaining multi-factor products, first at least 3-factor products
// when they're not all constants...
@@
expression E1, E2, E3;
constant C1, C2, C3;
@@
(
vmalloc(C1 * C2 * C3, ...)
|
vmalloc(
- E1 * E2 * E3
+ array3_size(E1, E2, E3)
, ...)
)
// And then all remaining 2 factors products when they're not all constants.
@@
expression E1, E2;
constant C1, C2;
@@
(
vmalloc(C1 * C2, ...)
|
vmalloc(
- E1 * E2
+ array_size(E1, E2)
, ...)
)
Signed-off-by: Kees Cook <keescook@chromium.org>
2018-06-12 14:27:11 -07:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-10-26 15:24:55 -05:00
|
|
|
|
|
|
|
|
|
2009-01-07 16:50:41 -06:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
2012-06-14 12:17:32 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-07-06 17:00:54 -05:00
|
|
|
|
|
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
2006-01-20 08:47:07 +00:00
|
|
|
|
2007-03-28 09:56:46 -05:00
|
|
|
|
|
|
|
|
|
2007-05-18 08:59:31 -05:00
|
|
|
|
|
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
2011-07-07 14:05:03 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-07-25 13:44:31 -05:00
|
|
|
|
|
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-05-18 09:03:35 -05:00
|
|
|
|
|
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
2011-04-05 13:16:24 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
2006-01-20 08:47:07 +00:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
2006-11-27 13:19:28 -06:00
|
|
|
|
|
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-09-27 15:53:38 -05:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
2006-01-20 08:47:07 +00:00
|
|
|
|
2006-07-12 16:44:04 -05:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
2009-11-30 16:34:43 -06:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
2012-06-14 12:17:32 -05:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
2011-10-20 13:26:28 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
2012-05-15 16:07:49 -05:00
|
|
|
|
|
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
2006-07-12 16:44:04 -05:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-08-24 14:47:20 -05:00
|
|
|
|
2008-08-06 13:30:24 -05:00
|
|
|
|
2006-08-24 14:47:20 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-04-05 13:16:24 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-08-02 11:08:21 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-04-05 13:16:24 -05:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
2012-08-02 11:08:21 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-12-17 15:54:39 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
2011-04-05 13:16:24 -05:00
|
|
|
|
2007-12-17 15:54:39 -04:00
|
|
|
|
2007-05-18 09:02:20 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
2007-05-18 09:03:35 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
2011-04-05 13:16:24 -05:00
|
|
|
|
2007-05-18 09:02:20 -05:00
|
|
|
|
2007-05-18 09:03:35 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-05-18 09:02:20 -05:00
|
|
|
|
|
|
|
|
|
2014-02-14 11:54:44 -06:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-05-18 09:03:35 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-04-05 13:16:24 -05:00
|
|
|
|
2006-08-24 14:47:20 -05:00
|
|
|
|
2011-04-05 13:16:24 -05:00
|
|
|
|
|
|
|
|
|
2007-05-18 09:02:20 -05:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-05-15 16:07:49 -05:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
2012-06-14 12:17:32 -05:00
|
|
|
|
2011-07-06 17:00:54 -05:00
|
|
|
|
2018-11-15 13:15:05 +03:00
|
|
|
|
2018-12-03 10:02:01 -06:00
|
|
|
|
|
|
|
|
|
2011-07-01 15:49:23 -05:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
2007-05-18 09:02:20 -05:00
|
|
|
|
2007-12-20 08:13:05 -08:00
|
|
|
|
2007-05-18 09:02:20 -05:00
|
|
|
|
|
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-11-02 14:30:58 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-01-20 08:47:07 +00:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-11-02 14:30:58 -05:00
|
|
|
|
|
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
2009-04-08 15:38:43 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-05-18 09:03:35 -05:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
2006-01-20 08:47:07 +00:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-07-06 17:00:54 -05:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
2011-07-06 17:00:54 -05:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
2013-10-16 14:20:25 +02:00
|
|
|
|
2011-07-06 17:00:54 -05:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
2011-07-06 17:00:54 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
2011-07-06 17:00:54 -05:00
|
|
|
|
|
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-10-26 15:24:55 -05:00
|
|
|
|
2008-08-06 13:30:24 -05:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
2011-07-06 17:00:54 -05:00
|
|
|
|
2008-08-06 13:30:24 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-07-06 17:00:54 -05:00
|
|
|
|
2008-08-06 13:30:24 -05:00
|
|
|
|
2011-07-06 17:00:54 -05:00
|
|
|
|
2008-08-06 13:30:24 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
2008-08-18 11:43:30 -05:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-04-05 13:16:24 -05:00
|
|
|
|
|
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-15 11:17:40 -06:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-07-06 17:00:54 -05:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
2011-07-06 17:00:54 -05:00
|
|
|
|
|
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-10-26 15:24:55 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-11-07 09:06:49 -06:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
2011-10-26 15:24:55 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-11-07 09:06:49 -06:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-07-01 15:49:23 -05:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
2012-06-14 12:17:32 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-07-07 14:05:03 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-11-27 11:31:22 -06:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-02-14 11:54:44 -06:00
|
|
|
|
2007-12-20 08:13:05 -08:00
|
|
|
|
2007-05-18 09:02:20 -05:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-08-06 13:30:24 -05:00
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-08-06 13:30:24 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-11-13 13:22:34 -06:00
|
|
|
|
2008-08-06 13:30:24 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2006-01-18 09:30:29 +00:00
|
|
|
|
|
|
|
|
|
2008-08-18 11:43:30 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-25 12:48:01 -05:00
|
|
|
|
2008-08-18 11:43:30 -05:00
|
|
|
|
|
|
|
|
|
2013-06-25 12:48:01 -05:00
|
|
|
|
2008-08-18 11:43:30 -05:00
|
|
|
|
|
|
|
|
|
2013-06-25 12:48:01 -05:00
|
|
|
|
|
|
|
|
|
2008-08-18 11:43:30 -05:00
|
|
|
|
2013-06-25 12:48:01 -05:00
|
|
|
|
2008-08-18 11:43:30 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-06-25 12:48:01 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-08-18 11:43:30 -05:00
|
|
|
|
|
|
|
|
|