## 7 Conclusions  
In this paper, we proposed MATANA, a framework that allows the design and integration of a flexible runtime attack detector for different classes of attacks that exhibit specific footprints on the microarchitecture. The detection is based on the fine-grained observation and analysis of different microarchitectural signals, obtained by inserting probes in the target component. The flexibility of the detection is provided by the Detection Module composed of reconfigurable hardware and software, which allow for updating of detection logics at any moment if necessary. Different data transmission techniques have been proposed to preserve high information throughput and timing information, even with the presence of frequency discrepancies between reconfigurable hardware and the target component. Our iterative methodology allows the design of different detection logics according to experiment results in real environments. An open-source system prototype has been implemented on FPGA, including a RISC-V processor Rocket and running Linux 4.15. Two use cases are presented, in which we describe how we were able to build suited detection logics for CSCAs and ROP attacks. These two use cases demonstrate that MATANA can be used for attacks of a different nature, and that the built detector exhibits satisfying false positive and false negative detection rates with quite simple heuristics, even with frequency differences. Our study shows that hardware security does not have to be limited to static solutions that cannot be modified after manufacturing or to solutions that only include a few programmable configuration bits. The security of systems over their lifetime can be enhanced by reconfigurable hardware equipped with attack detection logics based on analysis of microarchitectural signals. We believe this is particularly valuable today, when hardware lifetime is relatively long compared with the evolution speed of software attacks, and the fact that software attacks are able to target hardware vulnerabilities. Hardware component or system designers should be aware of this possibility and consider including this adaptable security into their design. Researchers can use MATANA's tools and methodology to design and evaluate new attack detection algorithms on hardware and software, understanding microarchitectural behavior, without being limited by information provided by existing hardware. As for future work, we first plan to enrich our detection campaigns by submitting other use cases of attacks to MATANA--such as Spectre/Meltdown for example. We also think that it would be interesting to make MATANA more automatic and easy to use by the research community. For example, automatically selecting signals based on the hardware's source code, or generating patterns that analyze the attack's characteristic or the correlation between signals and secret based on some formal description of the attack, could provide useful and relevant enhancements. We also plan to investigate more complex detection logics to estimate their cost in term of area footprint and execution time. Indeed, even if the experiments we carried out so far tend to show that quite simple detection logics are sufficient to exhibit satisfying detection rates, we think it interesting to investigate the implementation of complex detection algorithms (such as Machine Learning algorithms) in order to evaluate to what extent it is possible to implement such algorithms in MATANA, both in hardware and software, to optimize the detection efficiency as well as the area footprint on the reconfigurable fabric. Conceptualization, Y.M., V.M. and V.N. ; methodology, Y.M. and V.M. ; software, Y.M. ; validation, Y.M. and V.M. ; formal analysis, Y.M. and V.M. ; investigation, Y.M. ; data curation, Y.M. ; writing--original draft preparation, Y.M., V.M. and V.N. ; writing--review and editing, Y.M., V.M. and V.N. ; visualization, Y.M. and V.M. ; supervision, V.M. and V.N. All authors have read and agreed to the published version of the manuscript.