summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorPeilin Ye <yepeilin.cs@gmail.com>2020-09-24 09:42:22 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-10-14 09:46:21 +0200
commitd737dd43ab1a1b066ffa930a2ebd9da218701c23 (patch)
treeebe1719a1b6fa81237dfe4c63694b9567ea943e8 /include
parentca308ad621a8f0477140e39a8814d46041c843b8 (diff)
downloadlinux-stable-d737dd43ab1a1b066ffa930a2ebd9da218701c23.tar.gz
linux-stable-d737dd43ab1a1b066ffa930a2ebd9da218701c23.tar.bz2
linux-stable-d737dd43ab1a1b066ffa930a2ebd9da218701c23.zip
Fonts: Support FONT_EXTRA_WORDS macros for built-in fonts
commit 6735b4632def0640dbdf4eb9f99816aca18c4f16 upstream. syzbot has reported an issue in the framebuffer layer, where a malicious user may overflow our built-in font data buffers. In order to perform a reliable range check, subsystems need to know `FONTDATAMAX` for each built-in font. Unfortunately, our font descriptor, `struct console_font` does not contain `FONTDATAMAX`, and is part of the UAPI, making it infeasible to modify it. For user-provided fonts, the framebuffer layer resolves this issue by reserving four extra words at the beginning of data buffers. Later, whenever a function needs to access them, it simply uses the following macros: Recently we have gathered all the above macros to <linux/font.h>. Let us do the same thing for built-in fonts, prepend four extra words (including `FONTDATAMAX`) to their data buffers, so that subsystems can use these macros for all fonts, no matter built-in or user-provided. This patch depends on patch "fbdev, newport_con: Move FONT_EXTRA_WORDS macros into linux/font.h". Cc: stable@vger.kernel.org Link: https://syzkaller.appspot.com/bug?id=08b8be45afea11888776f897895aef9ad1c3ecfd Signed-off-by: Peilin Ye <yepeilin.cs@gmail.com> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: https://patchwork.freedesktop.org/patch/msgid/ef18af00c35fb3cc826048a5f70924ed6ddce95b.1600953813.git.yepeilin.cs@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/font.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/font.h b/include/linux/font.h
index 0a3639a00b3a..f85e70bd4793 100644
--- a/include/linux/font.h
+++ b/include/linux/font.h
@@ -65,4 +65,9 @@ extern const struct font_desc *get_default_font(int xres, int yres,
#define FONT_EXTRA_WORDS 4
+struct font_data {
+ unsigned int extra[FONT_EXTRA_WORDS];
+ const unsigned char data[];
+} __packed;
+
#endif /* _VIDEO_FONT_H */