cve: Add checker for cve-2019-0155
Subsystems (2)
PATCH 1/1 cve: Add checker for cve-2019-0155
Add vulnerability checker for cve-2019-0155
v2: sync, bailout early if no parser (Chris)
Cc: Chris Wilson <[email protected]>
Cc: Jon Bloomfield <[email protected]>
Cc: Joonas Lahtinen <[email protected]>
References: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-0155
References: https://www.intel.com/content/www/us/en/security-center/advisory/intel-sa-00242.html
--- Makefile.am | 2 +- configure.ac | 1 + cve/Makefile.am | 14 ++ cve/Makefile.sources | 5 + cve/cve-2019-0155.c | 470 +++++++++++++++++++++++++++++++++++++++++++ cve/meson.build | 12 ++ meson.build | 1 + 7 files changed, 504 insertions(+), 1 deletion(-) create mode 100644 cve/Makefile.am create mode 100644 cve/Makefile.sources create mode 100644 cve/cve-2019-0155.c create mode 100644 cve/meson.build
Makefile.am +1 -1
@@ -21,7 +21,7 @@ ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} -I m4 -SUBDIRS = lib tools scripts benchmarks +SUBDIRS = lib tools scripts benchmarks cve if BUILD_TESTS SUBDIRS += tests
configure.ac +1 -0
@@ -311,6 +311,7 @@ AC_CONFIG_FILES([ tools/null_state_gen/Makefile tools/registers/Makefile overlay/Makefile + cve/Makefile ]) AC_CONFIG_FILES([tools/intel_aubdump], [chmod +x tools/intel_aubdump])
cve/Makefile.am new file +14 -0
@@ -0,0 +1,14 @@ +include Makefile.sources + +cve_PROGRAMS = $(cve_prog_list) + +AM_CPPFLAGS = \ + -I$(top_srcdir) \ + -I$(top_srcdir)/include/drm-uapi \ + -I$(top_srcdir)/lib \ + -I$(top_srcdir)/lib/stubs/syscalls + +AM_CFLAGS = -I$(top_srcdir)/include/drm-uapi \ + $(DRM_CFLAGS) $(CWARNFLAGS) $(CAIRO_CFLAGS) $(LIBUNWIND_CFLAGS) \ + $(WERROR_CFLAGS) -D_GNU_SOURCE +LDADD = $(top_builddir)/lib/libintel_tools.la
cve/Makefile.sources new file +5 -0
@@ -0,0 +1,5 @@ +cvedir=$(libexecdir)/igt-gpu-tools/cve + +cve_prog_list = \ + cve-2019-0155 + $(NULL)
cve/cve-2019-0155.c new file +470 -0
470 lines not on this page · raw message
cve/meson.build new file +12 -0
@@ -0,0 +1,12 @@ +cve_progs = [ + 'cve-2019-0155', +] + +cvedir = join_paths(libexecdir, 'cve') + +foreach prog : cve_progs + executable(prog, prog + '.c', + install : true, + install_dir : cvedir, + dependencies : igt_deps) +endforeach
meson.build +1 -0
@@ -302,6 +302,7 @@ if libdrm_intel.found() endif subdir('overlay') subdir('man') +subdir('cve') gtk_doc = dependency('gtk-doc', required : build_docs) python3 = find_program('python3', required : build_docs)
Signature · 6 lines
2.17.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoting Mika Kuoppala (2019-11-21 15:19:30)
cve/cve-2019-0155.c line 28
Quoted 4 lines
cve/cve-2019-0155.c new file +4
-0+/* +* Can be compiled with: +* gcc -Wall -static -o cve-2019-0155 cve-2019-0155.c +*/
-pedantic ? :)
-Chris
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Quoted 7 lines · Chris Wilson
Quoting Mika Kuoppala (2019-11-21 15:19:30)
cve/cve-2019-0155.c line 28
Quoted 4 lines
cve/cve-2019-0155.c new file +4
-0+/* +* Can be compiled with: +* gcc -Wall -static -o cve-2019-0155 cve-2019-0155.c +*/ -pedantic ? :)
Seems to work if that's your thing! :)
-Mika
Quoted 1 line
-Chris
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Quoting Mika Kuoppala (2019-11-21 15:19:30)
cve/cve-2019-0155.c line 327
Quoted 4 lines
cve/cve-2019-0155.c new file +4
-0+static int is_platform_gen9 (void ) +{ +const char *const id_file = +"/sys/bus/pci/drivers/i915/0000:00:02.0/device" ;
I still suggest we use I915_PARAM_CHIPSET_ID to avoid reliance on sysfs here.
Quoted 9 lines
cve/cve-2019-0155.c new file +9
-0+char idstr[32 ] = {0 , }; +uint32_t id =0 ; +int fd, ret, i; + + fd =open (id_file,O_RDONLY ); +if (fd ==-1 ) +return -1 ; + + ret =read (fd, idstr,6 );
cve/cve-2019-0155.c line 346
Quoted 10 lines
cve/cve-2019-0155.c new file +10
-0+if (ret !=6 ) +return -1 ; + +close (fd); + + idstr[6 ] =0 ; + + id =strtol (idstr,NULL ,16 ); + +for (i =0 ; i <sizeof (gen9_ids)/sizeof (uint32_t ); i++)
sizeof(gen9_ids) / sizeof(gen9_ids[0])
Quoted 50 lines
cve/cve-2019-0155.c new file +50
-0+if (id == gen9_ids[i]) +return 1 ; + +return 0 ; +} + +static int is_fd_safe (const int fd) +{ +int parser_version =-1 ; +int write_block =0 ; + + parser_version =cmd_parser_version (fd); +printf (" Command parser version: %d\n" , parser_version); +if (parser_version >=10 ) { +printf (" Command parsing for blt engine supported\n" ); + }else if (!CHECK_WRITE_BLOCK_WITHOUT_PARSER ) { +printf (" There is no blitter command parser\n" ); +return 0 ; + } + + write_block =is_write_blocked (fd); + +printf (" Unsafe write %s\n" , write_block ?"blocked" :"possible!" ); + +return write_block; +} + +struct stats { +int checked; +int safe; +int failed; +}; + +static void check_path (const char *path,struct stats *stats) +{ +int fd; +int is_safe; + + fd =open (path,O_RDWR ); +if (fd ==-1 ) { +if (errno !=ENOENT ) { +printf ("Opening %s failed with %s (%d)\n" , + path,strerror (errno), errno); + stats->failed++; + } + +return ; + } + +if (!is_driver_i915 (fd)) {
cve/cve-2019-0155.c line 406
Quoted 10 lines
cve/cve-2019-0155.c new file +10
-0+close (fd); +return ; + } + +printf ("Checking %s:\n" , path); + + is_safe =is_fd_safe (fd); +printf (" Device %s : %s\n\n" , path, is_safe ?"SAFE" :"VULNERABLE" ); +if (is_safe) + stats->safe++;
I would go through and do a pass of errors => stderr, and suppressing anything else that is not "SAFE" vs "UNSAFE" (usual #define DBG tricks) -Chris
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI[igt-dev] ✗ GitLab.Pipeline: warning for cve: Add checker for cve-2019-0155
In reply to Mika Kuoppala== Series Details ==
== Series Details ==
Series: cve: Add checker for cve-2019-0155
URL : https://patchwork.freedesktop.org/series/69837/
State : warning
== Summary ==
Did not get list of undocumented tests for this run, something is wrong!
Other than that, pipeline status: FAILED.
see https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/pipelines/81432 for the overview.
build:tests-debian-meson-armhf has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/994860):
[4/9] Linking target runner/igt_resume.
[5/9] Linking target runner/igt_results.
[6/9] Linking target runner/runner_test.
[7/9] Linking target runner/runner_json_test.
[8/9] Compiling C object 'cve/3d5d2f7@@cve-2019-0155@exe/cve-2019-0155.c.o'.
FAILED: cve/3d5d2f7@@cve-2019-0155@exe/cve-2019-0155.c.o
/usr/bin/arm-linux-gnueabihf-gcc -Icve/3d5d2f7@@cve-2019-0155@exe -Icve -I../cve -I../include/drm-uapi -Ilib -I../lib -I../lib/stubs/syscalls -I. -I../ -I../lib/stubs/drm -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libdrm -I/usr/include/valgrind -I/usr/include/alsa -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -O2 -g -D_GNU_SOURCE -include config.h -D_FORTIFY_SOURCE=2 -Wbad-function-cast -Wdeclaration-after-statement -Wformat=2 -Wlogical-op -Wmissing-declarations -Wmissing-format-attribute -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wuninitialized -Wunused -Wno-clobbered -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-pointer-arith -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter -Wno-unused-result -Werror=address -Werror=array-bounds -Werror=implicit -Werror=init-self -Werror=int-to-pointer-cast -Werror=main -Werror=missing-braces -Werror=nonnull -Werror=pointer-to-int-cast -Werror=return-type -Werror=sequence-point -Werror=trigraphs -Werror=write-strings -fno-builtin-malloc -fno-builtin-calloc -pthread -MD -MQ 'cve/3d5d2f7@@cve-2019-0155@exe/cve-2019-0155.c.o' -MF 'cve/3d5d2f7@@cve-2019-0155@exe/cve-2019-0155.c.o.d' -o 'cve/3d5d2f7@@cve-2019-0155@exe/cve-2019-0155.c.o' -c ../cve/cve-2019-0155.c ../cve/cve-2019-0155.c: In function ‘cmd_parser_version’:
../cve/cve-2019-0155.c:98:3: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
(uint64_t)&version };
^ cc1: some warnings being treated as errors
ninja: build stopped: subcommand failed. section_end:1574351962:build_script [0Ksection_start:1574351962:after_script [0Ksection_end:1574351965:after_script [0Ksection_start:1574351965:upload_artifacts_on_failure [0Ksection_end:1574351967:upload_artifacts_on_failure [0K[31;1mERROR: Job failed: exit code 1
[0;m
build:tests-debian-meson-mips has failed (https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/-/jobs/994862):
ninja: build stopped: subcommand failed.
ninja: Entering directory `build'
[1/349] Generating version.h with a custom command.
[2/4] Linking target runner/runner_test.
[3/4] Compiling C object 'cve/3d5d2f7@@cve-2019-0155@exe/cve-2019-0155.c.o'.
FAILED: cve/3d5d2f7@@cve-2019-0155@exe/cve-2019-0155.c.o
/usr/bin/mips-linux-gnu-gcc -Icve/3d5d2f7@@cve-2019-0155@exe -Icve -I../cve -I../include/drm-uapi -Ilib -I../lib -I../lib/stubs/syscalls -I. -I../ -I../lib/stubs/drm -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/mips-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/libdrm -I/usr/include/valgrind -I/usr/include/alsa -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -std=gnu11 -O2 -g -D_GNU_SOURCE -include config.h -D_FORTIFY_SOURCE=2 -Wbad-function-cast -Wdeclaration-after-statement -Wformat=2 -Wlogical-op -Wmissing-declarations -Wmissing-format-attribute -Wmissing-noreturn -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith -Wredundant-decls -Wshadow -Wstrict-prototypes -Wuninitialized -Wunused -Wno-clobbered -Wno-maybe-uninitialized -Wno-missing-field-initializers -Wno-pointer-arith -Wno-sign-compare -Wno-type-limits -Wno-unused-parameter -Wno-unused-result -Werror=address -Werror=array-bounds -Werror=implicit -Werror=init-self -Werror=int-to-pointer-cast -Werror=main -Werror=missing-braces -Werror=nonnull -Werror=pointer-to-int-cast -Werror=return-type -Werror=sequence-point -Werror=trigraphs -Werror=write-strings -fno-builtin-malloc -fno-builtin-calloc -pthread -MD -MQ 'cve/3d5d2f7@@cve-2019-0155@exe/cve-2019-0155.c.o' -MF 'cve/3d5d2f7@@cve-2019-0155@exe/cve-2019-0155.c.o.d' -o 'cve/3d5d2f7@@cve-2019-0155@exe/cve-2019-0155.c.o' -c ../cve/cve-2019-0155.c ../cve/cve-2019-0155.c: In function ‘cmd_parser_version’:
../cve/cve-2019-0155.c:98:3: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
(uint64_t)&version };
^ cc1: some warnings being treated as errors
ninja: build stopped: subcommand failed. section_end:1574352101:build_script [0Ksection_start:1574352101:after_script [0Ksection_end:1574352102:after_script [0Ksection_start:1574352102:upload_artifacts_on_failure [0Ksection_end:1574352103:upload_artifacts_on_failure [0K[31;1mERROR: Job failed: exit code 1
[0;m
== Logs ==
For more details see: https://gitlab.freedesktop.org/gfx-ci/igt-ci-tags/pipelines/81432
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Patchwork
CI[igt-dev] ✓ Fi.CI.BAT: success for cve: Add checker for cve-2019-0155
In reply to Mika Kuoppala== Series Details ==
== Series Details ==
Series: cve: Add checker for cve-2019-0155
URL : https://patchwork.freedesktop.org/series/69837/
State : success
== Summary ==
CI Bug Log - changes from CI_DRM_7400 -> IGTPW_3743
====================================================
Summary
-------
**SUCCESS**
No regressions found.
External URL: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3743/index.html
Known issues
------------
Here are the changes found in IGTPW_3743 that come from known issues:
### IGT changes ###
#### Issues hit ####
* igt@i915_selftest@live_blt:
- fi-hsw-peppy: [PASS][1] -> [DMESG-FAIL][2] ([fdo#112147])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7400/fi-hsw-peppy/igt@i915_selftest@live_blt.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3743/fi-hsw-peppy/igt@i915_selftest@live_blt.html
* igt@kms_chamelium@dp-edid-read:
- fi-icl-u2: [PASS][3] -> [FAIL][4] ([fdo#106766])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7400/fi-icl-u2/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3743/fi-icl-u2/igt@[email protected]
#### Possible fixes ####
* igt@i915_module_load@reload-no-display:
- fi-skl-lmem: [DMESG-WARN][5] ([fdo#112261]) -> [PASS][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7400/fi-skl-lmem/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3743/fi-skl-lmem/igt@[email protected]
* igt@kms_chamelium@dp-crc-fast:
- fi-kbl-7500u: [DMESG-WARN][7] ([fdo#106107]) -> [PASS][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7400/fi-kbl-7500u/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3743/fi-kbl-7500u/igt@[email protected]
#### Warnings ####
* igt@kms_chamelium@hdmi-hpd-fast:
- fi-kbl-7500u: [FAIL][9] ([fdo#111045] / [fdo#111096]) -> [FAIL][10] ([fdo#111407])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7400/fi-kbl-7500u/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3743/fi-kbl-7500u/igt@[email protected]
[fdo#106107]: https://bugs.freedesktop.org/show_bug.cgi?id=106107
[fdo#106766]: https://bugs.freedesktop.org/show_bug.cgi?id=106766
[fdo#111045]: https://bugs.freedesktop.org/show_bug.cgi?id=111045
[fdo#111096]: https://bugs.freedesktop.org/show_bug.cgi?id=111096
[fdo#111407]: https://bugs.freedesktop.org/show_bug.cgi?id=111407
[fdo#112147]: https://bugs.freedesktop.org/show_bug.cgi?id=112147
[fdo#112261]: https://bugs.freedesktop.org/show_bug.cgi?id=112261
Participating hosts (50 -> 44)
------------------------------
Additional (1): fi-tgl-u
Missing (7): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-byt-clapper fi-bdw-samus
Build changes
-------------
* CI: CI-20190529 -> None
* IGT: IGT_5299 -> IGTPW_3743
CI-20190529: 20190529
CI_DRM_7400: 353c51b7f47ae247ea02b231dc173ba7cfdeb484 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_3743: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3743/index.html
IGT_5299: 65fed6a79adea14f7bef6d55530da47d7731d370 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3743/index.html
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Quoted 10 lines · Mika Kuoppala
Add vulnerability checker for cve-2019-0155
v2: sync, bailout early if no parser (Chris)
Cc: Chris Wilson <[email protected]>
Cc: Jon Bloomfield <[email protected]>
Cc: Joonas Lahtinen <[email protected]>
References: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-0155
References: https://www.intel.com/content/www/us/en/security-center/advisory/intel-sa-00242.htmlSigned-off-by Mika Kuoppala <[email protected]>
Quoted 8 lines
--- Makefile.am | 2 +- configure.ac | 1 + cve/Makefile.am | 14 ++ cve/Makefile.sources | 5 + cve/cve-2019-0155.c | 470 +++++++++++++++++++++++++++++++++++++++++++ cve/meson.build | 12 ++ meson.build | 1 +
Why do we need a new source directory and new install directory for this? Can't this be in tools/?
Signature · 5 lines
Petri Latvala _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoting Petri Latvala (2019-11-22 09:14:07)
Quoted 20 lines · Mika Kuoppala
Quoted 10 lines
Add vulnerability checker for cve-2019-0155
v2: sync, bailout early if no parser (Chris)
Cc: Chris Wilson <[email protected]>
Cc: Jon Bloomfield <[email protected]>
Cc: Joonas Lahtinen <[email protected]>
References: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-0155
References: https://www.intel.com/content/www/us/en/security-center/advisory/intel-sa-00242.htmlSigned-off-by Mika Kuoppala <[email protected]>Quoted 8 lines
--- Makefile.am | 2 +- configure.ac | 1 + cve/Makefile.am | 14 ++ cve/Makefile.sources | 5 + cve/cve-2019-0155.c | 470 +++++++++++++++++++++++++++++++++++++++++++ cve/meson.build | 12 ++ meson.build | 1 +
Quoted 2 lines
Why do we need a new source directory and new install directory for this? Can't this be in
tools/?
Because we would like to carve out a niche for these. If Google asks for a verifier for every single bug we encounter, it's going to be a huge directory.
-Chris
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
Quoted 21 lines · Chris Wilson
Quoting Petri Latvala (2019-11-22 09:14:07)
Quoted 20 lines · Mika Kuoppala
Quoted 18 lines
Add vulnerability checker for cve-2019-0155
v2: sync, bailout early if no parser (Chris)
Cc: Chris Wilson <[email protected]>
Cc: Jon Bloomfield <[email protected]>
Cc: Joonas Lahtinen <[email protected]>
References: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-0155
References: https://www.intel.com/content/www/us/en/security-center/advisory/intel-sa-00242.htmlSigned-off-by Mika Kuoppala <[email protected]>--- Makefile.am | 2 +- configure.ac | 1 + cve/Makefile.am | 14 ++ cve/Makefile.sources | 5 + cve/cve-2019-0155.c | 470 +++++++++++++++++++++++++++++++++++++++++++ cve/meson.build | 12 ++ meson.build | 1 +
Quoted 6 lines
Quoted 2 lines
Why do we need a new source directory and new install directory for this? Can't this be in
tools/?Because we would like to carve out a niche for these. If Google asks for a verifier for every single bug we encounter, it's going to be a huge directory.
Ok.
Signature · 5 lines
Petri Latvala _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx