public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch v8 0/2] Disable safe string constraint assertions
@ 2020-05-20  3:01 Michael D Kinney
  2020-05-20  3:01 ` [Patch v8 1/2] MdePkg: Fix SafeString performing assertions on runtime checks Michael D Kinney
  2020-05-20  3:01 ` [Patch v8 2/2] MdePkg/Test/BaseLib: Add SAFE_STRING_CONSTRAINT_CHECK unit test Michael D Kinney
  0 siblings, 2 replies; 10+ messages in thread
From: Michael D Kinney @ 2020-05-20  3:01 UTC (permalink / raw)
  To: devel

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054

V8 Add DEBUG_VERBOSE message and unit test
V7 addressed review comments (only documentation changes).

Current implementation of SafeString does not let one parse untrusted
data with its interfaces as they ASSERT on failing runtime checks and
require one to effectively reimplement the function on the caller side.

All the former proposals made it clear that the attempts to introduce
a solution preserving this behavior require a lot of changes
throughout the codebase including platform code (e.g. introducing
constraint assertions and updating all DebugLib implementations)
or require all sorts of hacks.

Since the original code has roughly no benefit except in some very
special cases and the effort required to preserve it is very high,
I propose to remove it as agreed on with several other parties.

Please note, that this patch does not change the behaviour of the
functions in RELEASE builds. I.e. they will still check for NULL
and return RETURN_INVALID_PARAMETER. In the future we may (or may
not) want them to simply ASSERT in this case. Regardless this should
be done in a separate BZ entry and a separate commit. For this reason
I ask everyone not to touch this subject.

Due to the amount of discussion this has already undergone after
almost a year I kindly request everyone to reduce the communication
to the minimum and abstain from proposing another approach.

Requesting to merge this into edk2-stable202005.

Cc: Andrew Fish afish@apple.com
Cc: Ard Biesheuvel ard.biesheuvel@linaro.org
Cc: Bret Barkelew bret.barkelew@microsoft.com
Cc: Brian J. Johnson brian.johnson@hpe.com
Cc: Chasel Chiu chasel.chiu@intel.com
Cc: Jordan Justen jordan.l.justen@intel.com
Cc: Laszlo Ersek lersek@redhat.com
Cc: Leif Lindholm leif@nuviainc.com
Cc: Liming Gao liming.gao@intel.com
Cc: Marvin Häuser mhaeuser@outlook.de
Cc: Michael D Kinney michael.d.kinney@intel.com
Cc: Vincent Zimmer vincent.zimmer@intel.com
Cc: Zhichao Gao zhichao.gao@intel.com
Cc: Jiewen Yao jiewen.yao@intel.com
Signed-off-by: Vitaly Cheptsov vit9696@protonmail.com

Michael D Kinney (2):
  MdePkg: Fix SafeString performing assertions on runtime checks
  MdePkg/Test/BaseLib: Add SAFE_STRING_CONSTRAINT_CHECK unit test

 MdePkg/Include/Library/BaseLib.h              | 111 -----------------
 MdePkg/Library/BaseLib/SafeString.c           | 115 +-----------------
 .../UnitTest/Library/BaseLib/Base64UnitTest.c |  85 +++++++++++++
 3 files changed, 88 insertions(+), 223 deletions(-)

-- 
2.21.0.windows.1


^ permalink raw reply	[flat|nested] 10+ messages in thread
* [Patch v8 0/2] Disable safe string constraint assertions
@ 2020-05-20  3:11 Michael D Kinney
  2020-05-20  3:11 ` [Patch v8 2/2] MdePkg/Test/BaseLib: Add SAFE_STRING_CONSTRAINT_CHECK unit test Michael D Kinney
  0 siblings, 1 reply; 10+ messages in thread
From: Michael D Kinney @ 2020-05-20  3:11 UTC (permalink / raw)
  To: devel

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2054

V8 Add DEBUG_VERBOSE message and unit test
V7 addressed review comments (only documentation changes).

Current implementation of SafeString does not let one parse untrusted
data with its interfaces as they ASSERT on failing runtime checks and
require one to effectively reimplement the function on the caller side.

All the former proposals made it clear that the attempts to introduce
a solution preserving this behavior require a lot of changes
throughout the codebase including platform code (e.g. introducing
constraint assertions and updating all DebugLib implementations)
or require all sorts of hacks.

Since the original code has roughly no benefit except in some very
special cases and the effort required to preserve it is very high,
I propose to remove it as agreed on with several other parties.

Please note, that this patch does not change the behaviour of the
functions in RELEASE builds. I.e. they will still check for NULL
and return RETURN_INVALID_PARAMETER. In the future we may (or may
not) want them to simply ASSERT in this case. Regardless this should
be done in a separate BZ entry and a separate commit. For this reason
I ask everyone not to touch this subject.

Due to the amount of discussion this has already undergone after
almost a year I kindly request everyone to reduce the communication
to the minimum and abstain from proposing another approach.

Requesting to merge this into edk2-stable202005.

Cc: Andrew Fish afish@apple.com
Cc: Ard Biesheuvel ard.biesheuvel@linaro.org
Cc: Bret Barkelew bret.barkelew@microsoft.com
Cc: Brian J. Johnson brian.johnson@hpe.com
Cc: Chasel Chiu chasel.chiu@intel.com
Cc: Jordan Justen jordan.l.justen@intel.com
Cc: Laszlo Ersek lersek@redhat.com
Cc: Leif Lindholm leif@nuviainc.com
Cc: Liming Gao liming.gao@intel.com
Cc: Marvin Häuser mhaeuser@outlook.de
Cc: Michael D Kinney michael.d.kinney@intel.com
Cc: Vincent Zimmer vincent.zimmer@intel.com
Cc: Zhichao Gao zhichao.gao@intel.com
Cc: Jiewen Yao jiewen.yao@intel.com
Signed-off-by: Vitaly Cheptsov vit9696@protonmail.com

Michael D Kinney (1):
  MdePkg/Test/BaseLib: Add SAFE_STRING_CONSTRAINT_CHECK unit test

Vitaly Cheptsov (1):
  MdePkg: Fix SafeString performing assertions on runtime checks

 MdePkg/Include/Library/BaseLib.h              | 111 -----------------
 MdePkg/Library/BaseLib/SafeString.c           | 115 +-----------------
 .../UnitTest/Library/BaseLib/Base64UnitTest.c |  85 +++++++++++++
 3 files changed, 88 insertions(+), 223 deletions(-)

-- 
2.21.0.windows.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-05-20 20:16 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-20  3:01 [Patch v8 0/2] Disable safe string constraint assertions Michael D Kinney
2020-05-20  3:01 ` [Patch v8 1/2] MdePkg: Fix SafeString performing assertions on runtime checks Michael D Kinney
2020-05-20  5:56   ` Vitaly Cheptsov
2020-05-20 17:18     ` [EXTERNAL] Re: [edk2-devel] " Bret Barkelew
2020-05-20 14:50   ` Liming Gao
2020-05-20  3:01 ` [Patch v8 2/2] MdePkg/Test/BaseLib: Add SAFE_STRING_CONSTRAINT_CHECK unit test Michael D Kinney
2020-05-20 19:04   ` [edk2-devel] " Sean
2020-05-20 20:11     ` Michael D Kinney
2020-05-20 20:16       ` Sean
  -- strict thread matches above, loose matches on Subject: below --
2020-05-20  3:11 [Patch v8 0/2] Disable safe string constraint assertions Michael D Kinney
2020-05-20  3:11 ` [Patch v8 2/2] MdePkg/Test/BaseLib: Add SAFE_STRING_CONSTRAINT_CHECK unit test Michael D Kinney
2020-05-20  6:07   ` Vitaly Cheptsov
2020-05-20  8:37     ` [edk2-devel] " Philippe Mathieu-Daudé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox