scripts/leaking_addresses.pl

Source file repositories/reference/linux-study-clean/scripts/leaking_addresses.pl

File Facts

System
Linux kernel
Corpus path
scripts/leaking_addresses.pl
Extension
.pl
Size
14937 bytes
Lines
707
Domain
Support Tooling And Documentation
Bucket
scripts
Inferred role
Support Tooling And Documentation: scripts
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

if ($addr_text !~ /^0/) {
			# TODO: Why is hex() so impossibly slow?
			my $addr = hex($addr_text);
			my $symbol = $entry[2];
			# Only keep kernel text addresses.
			my $long = pack("J", $addr);
			my $entry = [$long, $symbol];
			push @kallsyms, $entry;
		}
	}
	close $fh;
}

parse_dmesg();
walk(@DIRS);

exit 0;

sub dprint
{
	printf(STDERR @_) if $debug;
}

sub is_supported_architecture
{
	return (is_x86_64() or is_ppc64() or is_ix86_32());
}

sub is_32bit
{
	# Allow --32-bit or --page-offset-32-bit to override
	if ($opt_32bit or $page_offset_32bit) {
		return 1;
	}

	return is_ix86_32();
}

sub is_ix86_32
{
       state $arch = `uname -m`;

       chomp $arch;
       if ($arch =~ m/i[3456]86/) {
               return 1;
       }
       return 0;
}

sub is_arch
{
       my ($desc) = @_;
       my $arch = `uname -m`;

       chomp $arch;
       if ($arch eq $desc) {
               return 1;
       }
       return 0;
}

sub is_x86_64
{
	state $is = is_arch('x86_64');
	return $is;
}

sub is_ppc64
{
	state $is = is_arch('ppc64');

Annotation

Implementation Notes