Carlo Bertolli

47 papers A 1B 4C 4Misc 1Journal 12Unranked 24
YearRankTypeTitle / Venue / Authors
2024 conf
SC Workshops
Carlo Bertolli, Thorsten Blass, Lynd Stringer, Nicole Aschenbrenner, Jan-Patrick Lehr, Doru Bercea, Dhruva R. Chakrabarti, Lawrence Meadows, Ron Lieberman
2024 J jnl
CoRR
Suyash Tandon, Leopold Grinberg, Gheorghe-Teodor Bercea, Carlo Bertolli, Mark Olesen, Simone Bnà, Nicholas Malaya
2024 C conf
ISC
Suyash Tandon, Leopold Grinberg, Gheorghe-Teodor Bercea, Carlo Bertolli, Mark Olesen, Simone Bnà, Nicholas Malaya
2023 conf
SC Workshops
Dhruva R. Chakrabarti, Gregory Rodgers, Carlo Bertolli, Gheorghe-Teodor Bercea, Jan-Patrick Lehr, Lynd Stringer, Jan Leyonberg, Dan Palermo, Ron Lieberman
2020 J jnl
IBM J. Res. Dev.
Gheorghe-Teodor Bercea, Alexey Bataev, Alexandre E. Eichenberger, Carlo Bertolli, John K. O'Brien
2017 Misc conf
HiPC
Arpith Chacko Jacob, Alexandre E. Eichenberger, Hyojin Sung, Samuel F. Antão, Gheorghe-Teodor Bercea, Carlo Bertolli, Alexey Bataev, Tian Jin, Tong Chen, Zehra Sura, Georgios Rokos, Kevin O'Brien
2017 conf
IWOMP
Leopold Grinberg, Carlo Bertolli, Riyaz Haque
2017 conf
IWOMP
Leopold Grinberg, Carlo Bertolli, Riyaz Haque
2017 conf
LLVM-HPC@SC
Gheorghe-Teodor Bercea, Carlo Bertolli, Arpith C. Jacob, Alexandre E. Eichenberger, Alexey Bataev, Georgios Rokos, Hyojin Sung, Tong Chen, Kevin O'Brien
2017 J jnl
CoRR
Gheorghe-Teodor Bercea, Carlo Bertolli, Arpith C. Jacob, Alexandre E. Eichenberger, Alexey Bataev, Georgios Rokos, Hyojin Sung, Tong Chen, Kevin O'Brien
2016 J jnl
IEEE Trans. Parallel Distributed Syst.
István Z. Reguly, Gihan R. Mudalige, Carlo Bertolli, Michael B. Giles, Adam Betts, Paul H. J. Kelly, David Radford
2016 conf
IWOMP
Ian Karlin, Tom Scogland, Arpith C. Jacob, Samuel F. Antão, Gheorghe-Teodor Bercea, Carlo Bertolli, Bronis R. de Supinski, Erik W. Draeger, Alexandre E. Eichenberger, Jim Glosli, Holger Jones, Adam Kunen, David Poliakoff, David F. Richards
2016 conf
LLVM-HPC@SC
Samuel F. Antão, Alexey Bataev, Arpith C. Jacob, Gheorghe-Teodor Bercea, Alexandre E. Eichenberger, Georgios Rokos, Matt Martineau, Tian Jin, Guray Ozen, Zehra Sura, Tong Chen, Hyojin Sung, Carlo Bertolli, Kevin O'Brien
2016 conf
PMBS@SC
Matt Martineau, Simon McIntosh-Smith, Carlo Bertolli, Arpith C. Jacob, Samuel F. Antão, Alexandre E. Eichenberger, Gheorghe-Teodor Bercea, Tong Chen, Tian Jin, Kevin O'Brien, Georgios Rokos, Hyojin Sung, Zehra Sura
2015 J jnl
IBM J. Res. Dev.
Ravi Nair, Samuel Antão, Carlo Bertolli, Pradip Bose, José R. Brunheroto, Tong Chen, Chen-Yong Cher, Carlos H. A. Costa, J. Doi, Constantinos Evangelinos, Bruce M. Fleischer, Thomas W. Fox, Diego S. Gallo, Leopold Grinberg, John A. Gunnels, Arpith C. Jacob, P. Jacob, Hans M. Jacobson, Tejas Karkhanis, C. Kim, Jaime H. Moreno, John K. O'Brien, Martin Ohmacht, Yoonho Park, Daniel A. Prener, Bryan S. Rosenburg, Kyung Dong Ryu, Olivier Sallenave, Mauricio J. Serrano, P. D. M. Siegl, Krishnan Sugavanam, Zehra Sura
2015 conf
Conf. Computing Frontiers
Zehra Sura, Arpith C. Jacob, Tong Chen, Bryan S. Rosenburg, Olivier Sallenave, Carlo Bertolli, Samuel Antao, José R. Brunheroto, Yoonho Park, Kevin O'Brien, Ravi Nair
2015 conf
IWOMP
Arpith C. Jacob, Ravi Nair, Alexandre E. Eichenberger, Samuel Antão, Carlo Bertolli, Tong Chen, Zehra Sura, Kevin O'Brien, Michael Wong
2015 conf
LLVM@SC
Carlo Bertolli, Samuel Antão, Gheorghe-Teodor Bercea, Arpith C. Jacob, Alexandre E. Eichenberger, Tong Chen, Zehra Sura, Hyojin Sung, Georgios Rokos, David Appelhans, Kevin O'Brien
2015 conf
PMBS@SC
Gheorghe-Teodor Bercea, Carlo Bertolli, Samuel F. Antão, Arpith C. Jacob, Alexandre E. Eichenberger, Tong Chen, Zehra Sura, Hyojin Sung, Georgios Rokos, David Appelhans, Kevin O'Brien
2015 C conf
SBAC-PAD
Arpith C. Jacob, Ravi Nair, Tong Chen, Zehra Sura, Changhoan Kim, Carlo Bertolli, Samuel Antão, Kevin O'Brien
2014 J jnl
CoRR
István Z. Reguly, Gihan R. Mudalige, Carlo Bertolli, Michael B. Giles, Adam Betts, Paul H. J. Kelly, David Radford
2014 conf
LLVM@SC
Carlo Bertolli, Samuel Antão, Alexandre E. Eichenberger, Kevin O'Brien, Zehra Sura, Arpith C. Jacob, Tong Chen, Olivier Sallenave
2014 A conf
IPDPS
Michelle Mills Strout, Fabio Luporini, Christopher D. Krieger, Carlo Bertolli, Gheorghe-Teodor Bercea, Catherine Olschanowsky, J. Ramanujam, Paul H. J. Kelly
2013 J jnl
Parallel Comput.
Gihan R. Mudalige, Mike B. Giles, Jeyarajan Thiyagalingam, I. Z. Reguly, Carlo Bertolli, Paul H. J. Kelly, Anne E. Trefethen
2013 J jnl
J. Parallel Distributed Comput.
Mike B. Giles, Gihan R. Mudalige, B. Spencer, Carlo Bertolli, I. Z. Reguly
2013 conf
IPDPS Workshops
Christopher D. Krieger, Michelle Mills Strout, Catherine Olschanowsky, Andrew Stone, Stephen M. Guzik, Xinfeng Gao, Carlo Bertolli, Paul H. J. Kelly, Gihan R. Mudalige, Brian van Straalen, Samuel Williams
2013 C conf
ISC
Graham R. Markall, Florian Rathgeber, Lawrence Mitchell, Nicolas Loriant, Carlo Bertolli, David A. Ham, Paul H. J. Kelly
2012 conf
SC Companion
Mike B. Giles, Gihan R. Mudalige, Carlo Bertolli, Paul H. J. Kelly, Endre László, I. Z. Reguly
2012 conf
LCPC
Carlo Bertolli, Adam Betts, Nicolas Loriant, Gihan R. Mudalige, David Radford, David A. Ham, Mike B. Giles, Paul H. J. Kelly
2012 conf
Conf. Computing Frontiers
Carlo Bertolli, Adam Betts, Paul H. J. Kelly, Gihan R. Mudalige, Mike B. Giles
2012 J jnl
SIGMETRICS Perform. Evaluation Rev.
Gihan R. Mudalige, Mike B. Giles, Carlo Bertolli, Paul H. J. Kelly
2012 conf
SC Companion
Florian Rathgeber, Graham R. Markall, Lawrence Mitchell, Nicolas Loriant, David A. Ham, Carlo Bertolli, Paul H. J. Kelly
2011 conf
Euro-Par Workshops (1)
Carlo Bertolli, Gabriele Mencagli, Marco Vanneschi
2011 B conf
IWCMC
Carlo Bertolli, Gabriele Mencagli, Marco Vanneschi
2011 conf
Euro-Par Workshops (1)
Carlo Bertolli, Adam Betts, Gihan R. Mudalige, Mike B. Giles, Paul H. J. Kelly
2011 J jnl
Concurr. Comput. Pract. Exp.
Carlo Bertolli, Marco Vanneschi
2010 conf
CASEMANS@Ubicomp
Carlo Bertolli, Gabriele Mencagli, Marco Vanneschi
2010 J jnl
Int. J. Adv. Pervasive Ubiquitous Comput.
Carlo Bertolli, Daniele Buono, Gabriele Mencagli, Marco Vanneschi
2010 B conf
IWCMC
Carlo Bertolli, Daniele Tarchi, Romano Fantacci, Marco Vanneschi, Andrea Tassi
2010 C conf
PDP
Carlo Bertolli, Gabriele Mencagli, Marco Vanneschi
2010 B conf
IWCMC
Carlo Bertolli, Marco Vanneschi, Bruno Ciciani, Francesco Quaglia
2010 B conf
IWCMC
Carlo Bertolli, Daniele Buono, Gabriele Mencagli, Massimo Torquati, Marco Vanneschi, Matteo Mordacchini, Franco Maria Nardini
2009 conf
ISPAN
Carlo Bertolli, Gabriele Mencagli, Marco Vanneschi
2009 conf
Autonomics
Carlo Bertolli, Daniele Buono, Gabriele Mencagli, Marco Vanneschi
2009 J jnl
Wirel. Commun. Mob. Comput.
Romano Fantacci, Marco Vanneschi, Carlo Bertolli, Gabriele Mencagli, Daniele Tarchi
2009 conf
PARCO
Carlo Bertolli, Marco Vanneschi
2008
Carlo Bertolli
redb/extractors/macho_extractors/macho_imports.py
← Index redb/extractors/macho_extractors/macho_imports.py python
import inspect
from datetime import datetime, timezone
from typing import Any

from redb.extractors.enum import Tag
from redb.extractors.macho_extractor import MachOExtractor
from redb.models.dataclasses import MachOImport


class MachOImportExtractor(MachOExtractor):

    def __init__(
        self,
        filepath,
        log,
        exporters=None,
        index_prefix=None,
        elastic_index=None,
        known_benign=False,
        known_malicious=False,
        macho=None,
    ):
        super().__init__(
            filepath,
            log,
            exporters,
            index_prefix,
            elastic_index,
            known_benign,
            known_malicious,
            macho,
        )
        self.elastic_index = self.index_prefix + "-macho_imports"
        self.log.debug(inspect.currentframe().f_code.co_name)

    def tag(self):
        return Tag.MACHO_IMPORT.value

    def _extract_imports(self, arch_name=None):
        """Extract import information from the MachO binary for a specific architecture.

        Handles machofile v2026.2.4+ API where get_imported_functions() returns:
        Dict[str, List[Dict]] where each dict has {'name': str, 'sources': [str, ...]}
        """
        self.log.debug(inspect.currentframe().f_code.co_name)

        if not self.macho:
            return None

        try:
            # Get imported functions using API for specific architecture
            imported_functions = self.macho.get_imported_functions(arch=arch_name)
            if not imported_functions:
                return None

            # Keep the library→functions mapping (like PE does)
            library_names = []
            imports_with_mapping = []  # List of {library: [(name, source), ...]}

            for dylib_name, functions in imported_functions.items():
                # v2026.2.4+: dylib_name is already str, but handle bytes for compatibility
                if isinstance(dylib_name, bytes):
                    dylib_name = dylib_name.decode('utf-8', errors='replace')
                library_names.append(dylib_name)

                # Process function entries
                func_list = []
                for func_entry in functions:
                    # v2026.2.4+: func_entry is {'name': str, 'sources': [str, ...]}
                    if isinstance(func_entry, dict):
                        func_name = func_entry.get('name', '')
                        # Join sources if multiple, take first if single
                        sources = func_entry.get('sources', [])
                        import_source = sources[0] if sources else None
                        func_list.append((func_name, import_source))
                    else:
                        # Legacy format: func_entry is str or bytes
                        if isinstance(func_entry, bytes):
                            func_entry = func_entry.decode('utf-8', errors='replace')
                        func_list.append((func_entry, None))

                imports_with_mapping.append({dylib_name: func_list})

            # Count total functions
            total_functions = sum(len(list(d.values())[0]) for d in imports_with_mapping)

            # Create import dataclass with mapping preserved
            macho_import = MachOImport(
                macho_imports_total=total_functions,
                macho_import_libraryName=library_names if library_names else None,
                macho_import_functions=imports_with_mapping if imports_with_mapping else None
            )

            return macho_import

        except Exception as e:
            self.log.error(f"Error extracting MachO imports for arch {arch_name}: {e}")
            return None

    def extract(self):
        self.log.debug(inspect.currentframe().f_code.co_name)
        try:
            # Get architectures (macho is already parsed in base class)
            architectures = self.macho.get_architectures()
            if len(architectures) > 1:
                # FAT binary - return list of imports for each architecture
                results = []
                for arch_name in architectures:
                    imports = self._extract_imports(arch_name)
                    if imports:
                        imports.arch_identifier = arch_name
                        results.append(imports)
                return results
            else:
                # Single architecture - return single result
                return self._extract_imports(architectures[0] if architectures else None)
        except Exception as e:
            self.log.error(f"Error extracting MachO imports: {e}")
            return None

    def prepare_export_data(self, exporter_type: str) -> Any:
        if exporter_type == "ElasticsearchExporter":
            return self.extract()
        elif exporter_type == "ClickHouseExporter":
            if not self.macho:
                return None

            # Get architectures (macho is already parsed in base class)
            try:
                architectures = self.macho.get_architectures()
                is_fat = len(architectures) > 1
            except Exception as e:
                self.log.error(f"Could not get architectures: {e}")
                return None

            # Flatten the data - one row per function import (like PE imports)
            data = []
            current_time = datetime.now(timezone.utc)

            # Loop through each architecture (1 for single, multiple for FAT)
            for arch_name in architectures:
                # Get architecture-specific sha256
                try:
                    arch_general_info = self.macho.get_general_info(arch=arch_name)
                    arch_header_raw = self.macho.get_macho_header(arch=arch_name)
                    arch_sha256 = arch_general_info.get('SHA256', self.sha256)
                    arch_cputype_raw = arch_header_raw.get('cputype', 0) if arch_header_raw else 0
                except Exception as e:
                    self.log.warning(f"Could not get arch-specific data for {arch_name}: {e}")
                    arch_sha256 = self.sha256
                    arch_cputype_raw = 0

                # Get imports for this architecture
                macho_import = self._extract_imports(arch_name)
                if not macho_import or not macho_import.macho_import_functions:
                    continue

                # Flatten to one row per (library, function) pair
                for lib_funcs in macho_import.macho_import_functions:
                    for lib, funcs in lib_funcs.items():
                        for func_name, import_source in funcs:
                            data.append([
                                arch_sha256,        # sha256 (arch-specific)
                                lib,                # library_name
                                func_name,          # function_name
                                import_source,      # import_source (chained_fixups, bind_opcodes, symtab)
                                current_time,       # analysis_date
                            ])

            column_names = [
                'sha256',
                'library_name', 'function_name', 'import_source',
                'analysis_date'
            ]

            if not data:
                return None

            column_type_names = [
                'FixedString(64)',
                'LowCardinality(String)', 'LowCardinality(String)', 'LowCardinality(Nullable(String))',
                'DateTime64(3, \'UTC\')'
            ]

            return (data, column_names, column_type_names)

        return None

    def get_clickhouse_table(self) -> str:
        return "redb_macho_imports"