Apex 安全声明

系统安全加固

用户可在运行系统配置时开启ASLR(级别2)以提高系统安全性,保护系统随机化开启。 可参考以下方式进行配置:

echo 2 > /proc/sys/kernel/randomize_va_space

因Apex-patch源码需由用户自行编译,建议用户对编译后生成的SO文件开启strip,又称移除调试符号信息,开启方式可参考以下方式:

strip -s /xxx/python3/lib/site-packages/change_data_ptr.{version}.so  # 根据apex实际安装目录替换目录前缀

运行用户建议

基于安全性考虑,建议您在执行任何命令时,不建议使用root等管理员类型账户执行,遵循权限最小化原则。

文件权限控制

  1. 建议用户在主机(包括宿主机)及容器中设置运行系统umask值为0027及以上,保障新增文件夹默认最高权限为750,新增文件默认最高权限为640。

  2. 建议用户对个人数据、商业资产、源文件、训练过程中保存的各类文件等敏感内容做好权限管控。涉及场景如apex安装目录权限管控、多用户使用共享数据集权限管控等场景,管控权限可参考文件权限参考 进行设置。

文件权限参考

类型 linux权限参考最大值
用户主目录 750(rwxr-x---)
程序文件(含脚本文件、库文件等) 550(r-xr-x---)
程序文件目录 550(r-xr-x---)
配置文件 640(rw-r-----)
配置文件目录 750(rwxr-x---)
日志文件(记录完毕或者已经归档) 440(r--r-----)
日志文件(正在记录) 640(rw-r-----)
日志文件目录 750(rwxr-x---)
Debug文件 640(rw-r-----)
Debug文件目录 750(rwxr-x---)
临时文件目录 750(rwxr-x---)
维护升级文件目录 770(rwxrwx---)
业务数据文件 640(rw-r-----)
业务数据文件目录 750(rwxr-x---)
密钥组件、私钥、证书、密文文件目录 700(rwx—----)
密钥组件、私钥、证书、加密密文 600(rw-------)
加解密接口、加解密脚本 500(r-x------)

构建安全声明

Apex-patch通过源码发布,需要用户自行编译,在编译时会下载依赖第三方库并执行构建shell脚本,在编译过程中会产生临时程序文件和编译目录。用户可根据需要自行对源代码目录内的文件进行权限管控避免安全风险。管控权限可参考文件权限参考 进行设置。

运行安全声明

建议根据运行环境资源状况编写训练脚本,如模型大小、数据集、混合精度模式等选择不当时,可能导致显存超限等情况,进一步引发错误并退出进程。

运行异常时会退出进程并打印报错信息,建议根据报错提示定位具体原因。

公网地址声明

类型 开源代码地址 文件名 公网IP地址/公网URL地址/域名/邮箱地址 用途说明
pip源 NA scripts/docker/ARM/Dockerfile https://mirrors.aliyun.com/pypi/simple pip源
pip源 NA scripts/docker/X86/Dockerfile https://mirrors.huaweicloud.com/repository/pypi/simple pip源
开源引入 https://github.com/NVIDIA/apex.git scripts/build.sh https://github.com/NVIDIA/apex.git 构建脚本中拉取原生Apex源码,结合Ascend Apex patch构建安装包
开源引入 https://github.com/NVIDIA/apex.git patch/npu.patch http://jmlr.org/papers/v12/duchi11a.html 删除公网地址的patch代码
开源引入 https://github.com/NVIDIA/apex.git patch/npu.patch https://arxiv.org/abs/1412.6980 删除公网地址的patch代码
开源引入 https://github.com/NVIDIA/apex.git patch/npu.patch https://openreview.net/forum?id=ryQu7f-RZ 删除公网地址的patch代码
开源引入 https://github.com/NVIDIA/apex.git patch/npu.patch https://arxiv.org/abs/1904.00962 删除公网地址的patch代码
开源引入 https://github.com/NVIDIA/apex.git patch/npu.patch https://nvidia.github.io/OpenSeq2Seq/html/optimizers.html#novograd 删除公网地址的patch代码
开源引入 https://github.com/NVIDIA/apex.git patch/npu.patch https://arxiv.org/abs/1904.03288 删除公网地址的patch代码
开源引入 https://github.com/NVIDIA/apex.git patch/npu.patch http://www.cs.toronto.edu/~hinton/absps/momentum.pdf 删除公网地址的patch代码
开源引入 https://github.com/NVIDIA/apex.git patch/npu.patch https://github.com/pytorch/pytorch/blob/master/torch/csrc/utils/tensor_flatten.h 删除公网地址的patch代码
开源引入 https://github.com/NVIDIA/apex.git patch/npu.patch https://github.com/NVIDIA/cutlass.git 删除公网地址的patch代码
开源引入 https://github.com/NVIDIA/apex.git patch/npu.patch https://github.com/NVIDIA/apex/issues/486 删除公网地址的patch代码
开源引入 https://github.com/NVIDIA/apex.git patch/npu.patch https://github.com/pytorch/pytorch/pull/23408 删除公网地址的patch代码
开源引入 https://github.com/NVIDIA/apex.git patch/npu.patch https://github.com/NVIDIA/apex/pull/323#discussion_r287021798 删除公网地址的patch代码
开源引入 https://github.com/NVIDIA/apex.git patch/npu.patch https://github.com/pytorch/pytorch/commit/4404762d7dd955383acee92e6f06b48144a0742e 删除公网地址的patch代码
开源引入 https://github.com/NVIDIA/apex.git patch/npu.patch https://github.com/NVIDIA/apex/issues/456 删除公网地址的patch代码
开源引入 https://github.com/NVIDIA/apex.git patch/npu.patch https://hub.docker.com/r/pytorch/pytorch 删除公网地址的patch代码
开源引入 https://github.com/NVIDIA/apex.git patch/npu.patch https://github.com/NVIDIA/apex/tree/master/examples/imagenet 删除公网地址的patch代码
开源引入 https://github.com/NVIDIA/apex.git patch/npu.patch https://github.com/NVIDIA/apex/issues/134#issuecomment-458307368 删除公网地址的patch代码
开源引入 https://github.com/NVIDIA/apex.git patch/npu.patch https://arxiv.org/abs/1904.00962 删除公网地址的patch代码
开源引入 https://github.com/NVIDIA/apex.git patch/npu.patch https://github.com/pytorch/pytorch/commit/eb7b39e02f7d75c26d8a795ea8c7fd911334da7e#diff-4632522f237f1e4e728cb824300403ac 删除公网地址的patch代码
开源引入 https://github.com/NVIDIA/apex.git patch/npu.patch https://pytorch.org/ 删除公网地址的patch代码
开源引入 https://github.com/NVIDIA/apex.git patch/npu.patch https://www.github.com/nvidia/apex 删除公网地址的patch代码
开源引入 https://github.com/NVIDIA/apex.git patch/npu.patch https://github.com/pytorch/pytorch/pull/36026 删除公网地址的patch代码
开源引入 https://github.com/NVIDIA/apex.git patch/npu.patch https://github.com/NVIDIA/apex/issues 删除公网地址的patch代码

公开接口声明

Apex-patch为Apex基于昇腾NPU的适配,接口使用继承官方Apex,可参考Apex官方文档

新增公开接口参考特性介绍,未展示接口为内部接口,不对外暴露,可能会修改或删除,不建议用户直接使用。

通信安全加固

具体内容可参考Ascend Extension for PyTorch通信安全加固

通信矩阵

具体内容可参考Ascend Extension for PyTorch通信矩阵