Skip to content

Commit 10cc0e3

Browse files
committed
[SYCL][Devops] Fix remaining AVD-DS-0002 issues
See https://avd.aquasec.com/misconfig/ds002 Made it so our docker files have at least one `USER` command which is not `root`.
1 parent 15a7c6a commit 10cc0e3

File tree

4 files changed

+44
-0
lines changed

4 files changed

+44
-0
lines changed

devops/containers/ubuntu2204_intel_drivers.Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,16 @@ RUN --mount=type=secret,id=github_token \
2525

2626
COPY scripts/drivers_entrypoint.sh /drivers_entrypoint.sh
2727

28+
# By default Ubuntu sets an arbitrary UID value, that is different from host
29+
# system. When CI passes default UID value of 1001, some of LLVM tools fail to
30+
# discover user home directory and fail a few LIT tests. Fixes UID and GID to
31+
# 1001, that is used as default by GitHub Actions.
32+
RUN groupadd -g 1001 sycl && useradd sycl -u 1001 -g 1001 -m -s /bin/bash
33+
# Add sycl user to video/irc groups so that it can access GPU
34+
RUN usermod -aG video sycl
35+
RUN usermod -aG irc sycl
36+
37+
USER sycl
38+
2839
ENTRYPOINT ["/bin/bash", "/drivers_entrypoint.sh"]
2940

devops/containers/ubuntu2204_preinstalled.Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,16 @@ ADD sycl_linux.tar.gz /opt/sycl/
1010
ENV PATH /opt/sycl/bin:$PATH
1111
ENV LD_LIBRARY_PATH /opt/sycl/lib:$LD_LIBRARY_PATH
1212

13+
# By default Ubuntu sets an arbitrary UID value, that is different from host
14+
# system. When CI passes default UID value of 1001, some of LLVM tools fail to
15+
# discover user home directory and fail a few LIT tests. Fixes UID and GID to
16+
# 1001, that is used as default by GitHub Actions.
17+
RUN groupadd -g 1001 sycl && useradd sycl -u 1001 -g 1001 -m -s /bin/bash
18+
# Add sycl user to video/irc groups so that it can access GPU
19+
RUN usermod -aG video sycl
20+
RUN usermod -aG irc sycl
21+
22+
USER sycl
23+
1324
ENTRYPOINT ["/bin/bash", "/drivers_entrypoint.sh"]
1425

devops/containers/ubuntu2404_intel_drivers.Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,16 @@ RUN --mount=type=secret,id=github_token \
2525

2626
COPY scripts/drivers_entrypoint.sh /drivers_entrypoint.sh
2727

28+
# By default Ubuntu sets an arbitrary UID value, that is different from host
29+
# system. When CI passes default UID value of 1001, some of LLVM tools fail to
30+
# discover user home directory and fail a few LIT tests. Fixes UID and GID to
31+
# 1001, that is used as default by GitHub Actions.
32+
RUN groupadd -g 1001 sycl && useradd sycl -u 1001 -g 1001 -m -s /bin/bash
33+
# Add sycl user to video/irc groups so that it can access GPU
34+
RUN usermod -aG video sycl
35+
RUN usermod -aG irc sycl
36+
37+
USER sycl
38+
2839
ENTRYPOINT ["/bin/bash", "/drivers_entrypoint.sh"]
2940

devops/containers/ubuntu2404_intel_drivers_igc_dev.Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,16 @@ RUN --mount=type=secret,id=github_token \
2020

2121
COPY scripts/drivers_entrypoint.sh /drivers_entrypoint.sh
2222

23+
# By default Ubuntu sets an arbitrary UID value, that is different from host
24+
# system. When CI passes default UID value of 1001, some of LLVM tools fail to
25+
# discover user home directory and fail a few LIT tests. Fixes UID and GID to
26+
# 1001, that is used as default by GitHub Actions.
27+
RUN groupadd -g 1001 sycl && useradd sycl -u 1001 -g 1001 -m -s /bin/bash
28+
# Add sycl user to video/irc groups so that it can access GPU
29+
RUN usermod -aG video sycl
30+
RUN usermod -aG irc sycl
31+
32+
USER sycl
33+
2334
ENTRYPOINT ["/bin/bash", "/drivers_entrypoint.sh"]
2435

0 commit comments

Comments
 (0)