-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added new CPUs and instructions according to ISE (Intel Architecture Instruction Set Extensions and Future Features) rev-049, June 2023. Added: - Added new chips: Arrow-Lake and Lunar-Lake - Added new instructions: AVX-VNNI-INT16, SHA512, SM3, SM4 and PBNDKB - Updated SRF with UINTR and ENQCMD support
- Loading branch information
Showing
26 changed files
with
1,213 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
#!/usr/bin/env python | ||
# -*- python -*- | ||
#BEGIN_LEGAL | ||
# | ||
#Copyright (c) 2023 Intel Corporation | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
#END_LEGAL | ||
|
||
from pathlib import Path | ||
import platform | ||
import re | ||
import sys | ||
import os | ||
import utils | ||
import argparse | ||
|
||
def setup(): | ||
"""This function sets up the script env according to cmd line knobs.""" | ||
parser = argparse.ArgumentParser(description='anti-virus scan argument parser') | ||
parser.add_argument('--path', | ||
dest='av_path', | ||
help='Path to anti-virus scan', | ||
type=Path, | ||
default='') | ||
env = vars(parser.parse_args()) | ||
return env | ||
|
||
def get_infected_files(avscan_path: Path) -> int: | ||
""" | ||
Returns the number of possibly infected files | ||
Args: | ||
avscan_path (Path): a path to malware scan results file | ||
""" | ||
with open(avscan_path, 'r') as f: | ||
lines = f.readlines() | ||
|
||
pattern = r"Possibly Infected:.............\s+(\d+)$" | ||
|
||
for line in lines: | ||
line = " ".join(line.split()) | ||
match = re.match(pattern, line) | ||
if match: | ||
return int(match.group(1)) | ||
|
||
assert False, 'Malware scan summary not found.' # normally shouldn't get here | ||
|
||
|
||
if __name__ == '__main__': | ||
|
||
env = setup() | ||
|
||
os.makedirs('logs', exist_ok=True) | ||
avscan_res_path = Path('logs', 'avscan.txt') | ||
avscan_sum_path = Path('logs', 'antivirus_summary.txt') | ||
# delete previous anti-virus scan results and summary | ||
if avscan_res_path.exists(): os.remove(avscan_res_path) | ||
if avscan_sum_path.exists(): os.remove(avscan_sum_path) | ||
|
||
os = platform.system() | ||
|
||
assert os == 'Linux', 'Anti-virus scan is currently only supported on Linux' | ||
|
||
avargs = '--VERBOSE --RECURSIVE --SUMMARY' | ||
av_scan_cmd = f"{env['av_path']} {avargs} {Path('./')} > {avscan_res_path}" | ||
retval, retlines = utils.run_subprocess(av_scan_cmd) | ||
|
||
# the summary yields number of suspicious files | ||
infected_files = get_infected_files(avscan_res_path) | ||
|
||
with open(avscan_sum_path, 'w') as f: | ||
f.write(f'{infected_files} possibly infected files.') | ||
|
||
sys.exit(retval) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
v2023.06.07 | ||
v2023.07.09 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#BEGIN_LEGAL | ||
# | ||
#Copyright (c) 2023 Intel Corporation | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
#END_LEGAL | ||
|
||
ARROW_LAKE: \ | ||
ALL_OF(ALDER_LAKE) \ | ||
AVX_IFMA \ | ||
AVX_VNNI_INT8 \ | ||
AVX_NE_CONVERT \ | ||
CMPCCXADD \ | ||
UINTR \ | ||
AVX_VNNI_INT16 \ | ||
SM3 \ | ||
SM4 \ | ||
SHA512 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#BEGIN_LEGAL | ||
# | ||
#Copyright (c) 2023 Intel Corporation | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
#END_LEGAL | ||
|
||
chip-models: arrow-lake-chips.txt | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#BEGIN_LEGAL | ||
# | ||
#Copyright (c) 2023 Intel Corporation | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
#END_LEGAL | ||
#XTYPE TYPE BITS-PER-ELEM | ||
2i16 INT 32 | ||
2u16 UINT 32 | ||
|
||
|
Oops, something went wrong.