Lines Matching +full:sub +full:- +full:system

2 # SPDX-License-Identifier: GPL-2.0-only
7 # - Scans dmesg output.
8 # - Walks directory tree and parses each file (for each directory in @DIRS).
10 # Use --debug to output path before parsing, this is useful to find files that
14 # When the system is idle it is likely that most files under /proc/PID will be
41 # Kernel addresses vary by architecture. We can only auto-detect the following
42 # architectures (using `uname -m`). (flag --32-bit overrides auto-detection.)
55 my $opt_32bit = 0; # Scan 32-bit kernel.
56 my $page_offset_32bit = 0; # Page offset for 32-bit kernel.
61 '/proc/device-tree',
80 sub help
90 -o, --output-raw=<file> Save results for future processing.
91 -i, --input-raw=<file> Read results from file instead of scanning.
92 --raw Show raw results (default).
93 --suppress-dmesg Do not show dmesg results.
94 --squash-by-path Show one result per unique path.
95 --squash-by-filename Show one result per unique filename.
96 --kernel-config-file=<file> Kernel configuration file (e.g /boot/config)
97 --32-bit Scan 32-bit kernel.
98 --page-offset-32-bit=o Page offset (for 32-bit kernel 0xABCD1234).
99 -d, --debug Display debugging output.
100 -h, --help Display this help and exit.
111 'o|output-raw=s' => \$output_raw,
112 'i|input-raw=s' => \$input_raw,
113 'suppress-dmesg' => \$suppress_dmesg,
114 'squash-by-path' => \$squash_by_path,
115 'squash-by-filename' => \$squash_by_filename,
117 'kernel-config-file=s' => \$kernel_config_file,
118 '32-bit' => \$opt_32bit,
119 'page-offset-32-bit=o' => \$page_offset_32bit,
130 printf "\nSummary reporting only available with --input-raw=<file>\n";
131 printf "(First run scan with --output-raw=<file>.)\n";
143 printf("If you are running a 32-bit architecture you may use:\n");
144 printf("\n\t--32-bit or --page-offset-32-bit=<page offset>\n\n");
146 my $archname = `uname -m`;
147 printf("Machine hardware name (`uname -m`): %s\n", $archname);
162 sub dprint
167 sub is_supported_architecture
172 sub is_32bit
174 # Allow --32-bit or --page-offset-32-bit to override
182 sub is_ix86_32
184 state $arch = `uname -m`;
193 sub is_arch
196 my $arch = `uname -m`;
205 sub is_x86_64
211 sub is_ppc64
219 sub get_kernel_config_option
226 # Allow --kernel-config-file to override.
229 } elsif (-R "/proc/config.gz") {
232 if (system("gunzip < /proc/config.gz > $tmp_file")) {
233 dprint("system(gunzip < /proc/config.gz) failed\n");
239 my $file = '/boot/config-' . `uname -r`;
253 system("rm -f $tmp_file");
260 sub option_from_file
279 sub is_false_positive
301 sub is_false_positive_32bit
318 sub get_page_offset
323 # Allow --page-offset-32bit to override.
335 sub is_in_vsyscall_memory_region
347 sub may_leak_address
374 sub get_address_re
385 sub get_x86_64_re
399 sub parse_dmesg
401 open my $cmd, '-|', 'dmesg';
411 sub skip
427 sub timed_parse_file
432 local $SIG{ALRM} = sub { die "alarm\n" }; # NB: \n required.
444 sub parse_file
448 if (! -R $file) {
452 if (! -T $file) {
467 sub check_path_for_leaks
477 sub walk
490 next if (-l $path);
493 next if (($path =~ /^\/proc\/[0-9]+$/) &&
500 if (-d $path) {
511 sub format_output
538 sub dump_raw_output
554 sub parse_raw_file
579 sub print_dmesg
597 sub squash_by
610 my $lines = $ref->{$_};
616 sub cache_path
627 sub cache_filename
639 sub add_to_cache
643 if (!$cache->{$key}) {
644 $cache->{$key} = ();
646 push @{$cache->{$key}}, $value;