Fix variable suppression name_not_regex.

Message ID 20200414183813.76227-1-gprocida@google.com
State Committed
Headers
Series Fix variable suppression name_not_regex. |

Commit Message

Giuliano Procida April 14, 2020, 6:38 p.m. UTC
  Kernel symbol whitelisting symbol is implemented using a regex to
suppress all function and variable names that don't match the given
list. This was completely broken for variables, resulting in all
variables being filtered out if a kernel whitelist was specified.

	* src/abg-suppression-priv.h: In get_symbol_name_not_regex
	method of variable_suppression::priv, fix typo causing
	miscompilation of regex.

Signed-off-by: Giuliano Procida <gprocida@google.com>
---
 src/abg-suppression-priv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Matthias Männich April 14, 2020, 7:49 p.m. UTC | #1
On Tue, Apr 14, 2020 at 07:38:13PM +0100, Giuliano Procida wrote:
>Kernel symbol whitelisting symbol is implemented using a regex to
>suppress all function and variable names that don't match the given
>list. This was completely broken for variables, resulting in all
>variables being filtered out if a kernel whitelist was specified.
>
>	* src/abg-suppression-priv.h: In get_symbol_name_not_regex
>	method of variable_suppression::priv, fix typo causing
>	miscompilation of regex.
>

Nice catch!

Reviewed-by: Matthias Maennich <maennich@google.com>
Tested-by: Matthias Maennich <maennich@google.com>

Cheers,
Matthias

>Signed-off-by: Giuliano Procida <gprocida@google.com>
>---
> src/abg-suppression-priv.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/src/abg-suppression-priv.h b/src/abg-suppression-priv.h
>index 71057ce1..1a9a7207 100644
>--- a/src/abg-suppression-priv.h
>+++ b/src/abg-suppression-priv.h
>@@ -680,7 +680,7 @@ struct variable_suppression::priv
>       {
> 	sptr_utils::regex_t_sptr r = sptr_utils::build_sptr<regex_t>();
> 	if (regcomp(r.get(), symbol_name_not_regex_str_.c_str(),
>-		    REG_EXTENDED == 0) == 0)
>+		    REG_EXTENDED) == 0)
> 	  symbol_name_not_regex_ = r;
>       }
>     return symbol_name_not_regex_;
>-- 
>2.26.0.110.g2183baf09c-goog
>
  
Dodji Seketeli April 15, 2020, 1:08 p.m. UTC | #2
Giuliano Procida <gprocida@google.com> a ?crit:

> Kernel symbol whitelisting symbol is implemented using a regex to
> suppress all function and variable names that don't match the given
> list. This was completely broken for variables, resulting in all
> variables being filtered out if a kernel whitelist was specified.
>
> 	* src/abg-suppression-priv.h: In get_symbol_name_not_regex
> 	method of variable_suppression::priv, fix typo causing
> 	miscompilation of regex.

Applied to master, thanks!

Cheers,
  

Patch

diff --git a/src/abg-suppression-priv.h b/src/abg-suppression-priv.h
index 71057ce1..1a9a7207 100644
--- a/src/abg-suppression-priv.h
+++ b/src/abg-suppression-priv.h
@@ -680,7 +680,7 @@  struct variable_suppression::priv
       {
 	sptr_utils::regex_t_sptr r = sptr_utils::build_sptr<regex_t>();
 	if (regcomp(r.get(), symbol_name_not_regex_str_.c_str(),
-		    REG_EXTENDED == 0) == 0)
+		    REG_EXTENDED) == 0)
 	  symbol_name_not_regex_ = r;
       }
     return symbol_name_not_regex_;