Expression simplification is an important task necessary in a variety of domains, e.g., compilers, digital logic design, etc. Syntax-guided synthesis (SyGuS) with a cost function can be used for this purpose, but ordered enumeration through a large space of candidate expressions can be expensive. Equality saturation is an alternative approach which allows efficient construction and maintenance of expression equivalence classes generated by rewrite rules, but the procedure may not reach saturation, meaning global minimality cannot be confirmed. We present a new approach called rewrite-guided synthesis (ReGiS), in which a unique interplay between SyGuS and equality saturation-based rewriting helps to overcome these problems, resulting in an efficient, scalable framework for expression simplification. We demonstrate the flexibility and practicality of our approach by applying ReGiS to regular expression denial of service (ReDoS) attack prevention. Many real-world regular expression matching engines are vulnerable to these complexity-based attacks, and while much research has focused on detecting vulnerable regular expressions, we provide a way for developers to go further, by automatically transforming their regular expressions to remove vulnerabilities.
翻译:表达简化是各个领域(如汇编者、数字逻辑设计等)的一项重要任务。 具有成本功能的语法指导合成(SyGuS)可以用于此目的,但通过大量候选表达方式进行有条不紊的查点可能很昂贵。 平等饱和是一种替代办法,它允许高效地构建和维护由改写规则产生的表达等同类,但程序可能达不到饱和,意味着无法确认全球最低程度。 我们提出了一个名为改写-指导合成(ReGiS)的新方法,其中SyGuS与平等饱和重新写法之间的独特互动有助于克服这些问题,从而形成一个高效、可扩展的表达简化框架。 我们通过将ReGiS应用于定期表达拒绝服务(ReDoS)攻击预防,展示了我们的方法的灵活性和实用性。 许多真实世界的普通表达匹配引擎都易受到这些复杂攻击的影响,虽然许多研究都侧重于发现脆弱的常规表达方式,但我们为开发者提供了一条更进一步的方法,通过自动改变其常规表达方式来消除脆弱性。