From a7c7ac3b2be1373854f8887da85656da860fdc4a Mon Sep 17 00:00:00 2001 From: Laura Abbott Date: Wed, 3 Jun 2015 10:10:19 -0700 Subject: Fix auditing of canonical mode (rhbz 1188695) --- kernel.spec | 9 ++++ ...-Fix-auditing-support-for-cannonical-mode.patch | 58 ++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 n_tty-Fix-auditing-support-for-cannonical-mode.patch diff --git a/kernel.spec b/kernel.spec index 1849998a..32893cd6 100644 --- a/kernel.spec +++ b/kernel.spec @@ -609,6 +609,9 @@ Patch26214: acpi_video-Add-enable_native_backlight-quirk-for-Mac.patch #rhbz 1225563 Patch26215: HID-lenovo-set-INPUT_PROP_POINTING_STICK.patch +#rhbz 1188695 +Patch26218: n_tty-Fix-auditing-support-for-cannonical-mode.patch + # END OF PATCH DEFINITIONS %endif @@ -1336,6 +1339,9 @@ ApplyPatch acpi_video-Add-enable_native_backlight-quirk-for-Mac.patch #rhbz 1225563 ApplyPatch HID-lenovo-set-INPUT_PROP_POINTING_STICK.patch +#rhbz 1188695 +ApplyPatch n_tty-Fix-auditing-support-for-cannonical-mode.patch + # END OF PATCH APPLICATIONS %endif @@ -2200,6 +2206,9 @@ fi # # %changelog +* Wed Jun 03 2015 Laura Abbott +- Fix auditing of canonical mode (rhbz 1188695) + * Wed Jun 03 2015 Josh Boyer - Fix from Ngo Than for perf build on ppc64le (rhbz 1227260) diff --git a/n_tty-Fix-auditing-support-for-cannonical-mode.patch b/n_tty-Fix-auditing-support-for-cannonical-mode.patch new file mode 100644 index 00000000..12ee48e1 --- /dev/null +++ b/n_tty-Fix-auditing-support-for-cannonical-mode.patch @@ -0,0 +1,58 @@ +From: Laura Abbott +Date: Wed, 13 May 2015 17:03:06 -0700 +Subject: [PATCH] n_tty: Fix auditing support for cannonical mode +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Commit 32f13521ca68bc624ff6effc77f308a52b038bf0 +("n_tty: Line copy to user buffer in canonical mode") +changed cannonical mode copying to use copy_to_user +but missed adding the call to the audit framework. +Add in the appropriate functions to get audit support. + +Fixes: 32f13521ca68 ("n_tty: Line copy to user buffer in canonical mode") +Reported-by: Miloslav Trmač +Signed-off-by: Laura Abbott +--- + drivers/tty/n_tty.c | 17 ++++++++++++++--- + 1 file changed, 14 insertions(+), 3 deletions(-) + +diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c +index cc57a3a6b02b..eee40b5cb025 100644 +--- a/drivers/tty/n_tty.c ++++ b/drivers/tty/n_tty.c +@@ -162,6 +162,17 @@ static inline int tty_put_user(struct tty_struct *tty, unsigned char x, + return put_user(x, ptr); + } + ++static inline int tty_copy_to_user(struct tty_struct *tty, ++ void __user *to, ++ const void *from, ++ unsigned long n) ++{ ++ struct n_tty_data *ldata = tty->disc_data; ++ ++ tty_audit_add_data(tty, to, n, ldata->icanon); ++ return copy_to_user(to, from, n); ++} ++ + /** + * n_tty_kick_worker - start input worker (if required) + * @tty: terminal +@@ -2084,12 +2095,12 @@ static int canon_copy_from_read_buf(struct tty_struct *tty, + __func__, eol, found, n, c, size, more); + + if (n > size) { +- ret = copy_to_user(*b, read_buf_addr(ldata, tail), size); ++ ret = tty_copy_to_user(tty, *b, read_buf_addr(ldata, tail), size); + if (ret) + return -EFAULT; +- ret = copy_to_user(*b + size, ldata->read_buf, n - size); ++ ret = tty_copy_to_user(tty, *b + size, ldata->read_buf, n - size); + } else +- ret = copy_to_user(*b, read_buf_addr(ldata, tail), n); ++ ret = tty_copy_to_user(tty, *b, read_buf_addr(ldata, tail), n); + + if (ret) + return -EFAULT; -- cgit