Skip to content

Address non concurrency-safe libimaevm global variables

Mimi Zohar linux-integrity 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest13 patches 6 repliesIn review
  2. v213 patches 5 repliesSuperseded
  3. v112 patches 15 repliesSuperseded

Changes in v3 from the cover letter

Addressed Stefan Berger's comments:
- Forward declare "struct public_key_entry" in order to replace "void *public_key" usage.
- Move the "__attribute__((deprecated))" from the functions to the function definitions.
- Allow suppressing just the libimevm deprecated warngings by defining and enabling "-DIMAEVM_SUPPRESS_DEPRECATED".
- Add "Reviewed-by" tags.

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/13Rename "public_keys" to "g_public_keys"src/libimaevm.c+6 -60 replies
2/13Free public keys listsrc/imaevm.h src/libimaevm.c+19 -00 replies
3/13Update library function definitions to include a "public_keys" parametersrc/imaevm.h src/libimaevm.c+78 -251 reply
4/13Update imaevm_verify_hash() definition to include "hash_algo" parametersrc/imaevm.h src/libimaevm.c+11 -71 reply
5/13Update cmd_verify_ima() to define and use a local list of public keyssrc/evmctl.c+19 -101 reply
6/13Update cmd_verify_evm to define and use a local list of public keyssrc/evmctl.c+15 -51 reply
7/13Update ima_measurements to define and use a local list of public keyssrc/evmctl.c+19 -81 reply
8/13Define library ima_calc_hash2() function with a hash algorithm parametersrc/imaevm.h src/libimaevm.c+10 -50 replies
9/13Use a local hash algorithm variable when verifying file signaturessrc/libimaevm.c+28 -201 reply
10/13Update EVM signature verification to use a local hash algorithm variablesrc/evmctl.c+10 -90 replies
11/13Use a file specific hash algorithm variable for signing filessrc/evmctl.c+17 -170 replies
12/13Update sign_hash_v*() definition to include the key passwordsrc/libimaevm.c+10 -80 replies
13/13Define and use a file specific "keypass" variablesrc/evmctl.c+9 -80 replies

Reviews trailers per patch

All 13 patches have a Reviewed-by or Acked-by.

PatchStefan Berger
1/13R-b
2/13R-b
3/13R-b
4/13R-b
5/13R-b
6/13R-b
7/13R-b
8/13R-b
9/13R-b
10/13R-b
11/13R-b
12/13R-b
13/13R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [ima-evm-utils PATCH v3 00/13] Address non concurrency-safe libimaevm global variables

The libimaevm global variables are not concurrency-safe. Instead of relying on global variables, define new functions with these variables as parameters, update static functions definitions with these variables, and deprecate existing functions. The change is limited to public keys, hash algorithm, and key password.

To avoid library incompatability, make the existing functions wrappers for the new function versions and deprecate existing functions.

The deprecated function warnings can be disabled by specifying '-Wno-deprecated-declarations'. Allow suppressing just the libimevm warnings by enabling IMAEVM_SUPPRESS_DEPRECATED.

e.g. configure CFLAGS="-DIMAEVM_SUPPRESS_DEPRECATED"

Changelog v3:
Addressed Stefan Berger's comments:
- Forward declare "struct public_key_entry" in order to replace "void *public_key" usage.
- Move the "__attribute__((deprecated))" from the functions to the function definitions.
- Allow suppressing just the libimevm deprecated warngings by defining and enabling "-DIMAEVM_SUPPRESS_DEPRECATED".
- Add "Reviewed-by" tags.

Changelog v2:
Addressed Stefan Berger's comments:
- Prefix the new library functions to avoid namespace pollution.
- Define internal library function 'public_keys' as struct public_key_entry, not void.
- Prefix new static global variables with 'g_'.
- Annotate deprecated functions with "__attribute__(deprecated)".
- init_public_keys() function was defined as void. The new imaevm_init_public_keys() function is defined as an int. Check the return value.
- Update sign_{ima,evm} function definitions to include the hash algorithm as a paramater.
- Added Stefan's "Reviewed-by" tag.

Mimi Zohar (13):
Rename "public_keys" to "g_public_keys"
Free public keys list
Update library function definitions to include a "public_keys"
parameter
Update imaevm_verify_hash() definition to include "hash_algo"
parameter
Update cmd_verify_ima() to define and use a local list of public keys Update cmd_verify_evm to define and use a local list of public keys Update ima_measurements to define and use a local list of public keys Define library ima_calc_hash2() function with a hash algorithm
parameter
Use a local hash algorithm variable when verifying file signatures Update EVM signature verification to use a local hash algorithm
variable
Use a file specific hash algorithm variable for signing files Update sign_hash_v*() definition to include the key password Define and use a file specific "keypass" variable

 src/evmctl.c    | 136 +++++++++++++++++++++++++++-----------------
 src/imaevm.h    |  29 ++++++++--
 src/libimaevm.c | 148 +++++++++++++++++++++++++++++++++++-------------
 3 files changed, 218 insertions(+), 95 deletions(-)
Signature · 1 line
2.39.3