Skip to contentSkip to conversation

libxl: update flex output files

PATCH In review Wei Liu 2 participants 3 messages Aug 26, 2016 – Aug 30, 2016

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

PATCH 1/1 libxl: update flex output files

Libxl ships output files from flex (libxlu_*_l.{c,h}). We use the flex shipped in Debian to generate those files. Debian just patched their flex (DSA 3653-1) to fix CVE-2016-6354, which is a buffer overrun bug.

Note that libxl is _NOT_ vulnerable to that CVE. See below for Ian's analysis to security@xen.

It would still be nice that we update our shipped flex output files to avoid confusion.

===QUOTE===

The bug is that with input >16K[1] flex would usually fail to resize the input buffer, and then overrun it.

I have read the code in libxlu_cfg_l.c to try to understand the implications for libxl.

AFAICT
- libxl always does config file reading _from the file_ itself, and provides flex with a string or buffer.
- so we always call whatever_yy_scan_bytes, not any other flex setup function to set up a `buffer' (as flex calls it)
- yy_scan_bytes calls yy_scan_buffer to set up the buffer
- yy_scan_buffer sets b->yy_fill_buffer
- The effect of this is that yy_get_next_buffer will always return early, rather than continuing on to the vulnerable code.

So I think libxl is not vulnerable, regardless of the contents of the configuration file.

[1] the default buffer size, or whatever other buffer size is configured (but we don't change it)

===ENDQUOTE===

---
Cc: Ian Jackson <[email protected]>

---
 tools/libxl/libxlu_cfg_l.c  |   2 +-
 tools/libxl/libxlu_disk_l.c | 906 +++++++++++++++++++++++++-------------------
 tools/libxl/libxlu_disk_l.h |   2 +-
 3 files changed, 519 insertions(+), 391 deletions(-)
tools/libxl/libxlu_cfg_l.c +1 -1
index 2d2be39..7fedd41 100644
@@ -1173,7 +1173,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
 
 	else
 		{
-			yy_size_t num_to_read =
+			int num_to_read =
 			YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
 
 		while ( num_to_read <= 0 )
tools/libxl/libxlu_disk_l.c +517 -389

1,169 lines not on this page · raw message

tools/libxl/libxlu_disk_l.h +1 -1
index 496f208..794274f 100644
@@ -348,7 +348,7 @@ extern int xlu__disk_yylex (yyscan_t yyscanner);
 #undef YY_DECL
 #endif
 
-#line 258 "libxlu_disk_l.l"
+#line 277 "libxlu_disk_l.l"
 
 #line 354 "libxlu_disk_l.h"
 #undef xlu__disk_yyIN_HEADER
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Acked-by on v1 1/1
#1 lore raw

Wei Liu writes ("[PATCH] libxl: update flex output files"):

Quoted 9 lines

Libxl ships output files from flex (libxlu_*_l.{c,h}). We use the flex shipped in Debian to generate those files. Debian just patched their flex (DSA 3653-1) to fix CVE-2016-6354, which is a buffer overrun bug.

Note that libxl is _NOT_ vulnerable to that CVE. See below for Ian's analysis to security@xen.

It would still be nice that we update our shipped flex output files to avoid confusion.

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#2 lore raw
Quoted 5 lines · Ian Jackson

Wei Liu writes ("[PATCH] libxl: update flex output files"):

Quoted 4 lines

Libxl ships output files from flex (libxlu_*_l.{c,h}). We use the flex shipped in Debian to generate those files. Debian just patched their flex (DSA 3653-1) to fix CVE-2016-6354, which is a buffer overrun bug.

Quoted 8 lines
Quoted 5 lines

Note that libxl is _NOT_ vulnerable to that CVE. See below for Ian's analysis to security@xen.

It would still be nice that we update our shipped flex output files to avoid confusion.

Thanks. Now pushed.

Quoted 1 line

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel