Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1265082 > unrolled thread

[PATCH] tty: audit: Fix audit source

Started byPeter Hurley <peter@hurleysoftware.com>
First post2015-11-08 14:00 +0100
Last post2015-11-10 02:50 +0100
Articles 5 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] tty: audit: Fix audit source Peter Hurley <peter@hurleysoftware.com> - 2015-11-08 14:00 +0100
    Re: [PATCH] tty: audit: Fix audit source kbuild test robot <lkp@intel.com> - 2015-11-08 14:10 +0100
      Re: [PATCH] tty: audit: Fix audit source Peter Hurley <peter@hurleysoftware.com> - 2015-11-08 14:50 +0100
    [PATCH v2] tty: audit: Fix audit source Peter Hurley <peter@hurleysoftware.com> - 2015-11-08 15:00 +0100
      Re: [PATCH v2] tty: audit: Fix audit source Laura Abbott <labbott@redhat.com> - 2015-11-10 02:50 +0100

#1265082 — [PATCH] tty: audit: Fix audit source

FromPeter Hurley <peter@hurleysoftware.com>
Date2015-11-08 14:00 +0100
Subject[PATCH] tty: audit: Fix audit source
Message-ID<qsxJD-fn-3@gated-at.bofh.it>
The data to audit/record is in the 'from' buffer (ie., the input
read buffer).

Fixes: 72586c6061ab ("n_tty: Fix auditing support for cannonical mode")
Cc: Laura Abbott <labbott@fedoraproject.org>
Cc: Miloslav Trmač <mitr@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
---
 drivers/tty/n_tty.c     | 2 +-
 drivers/tty/tty_audit.c | 2 +-
 include/linux/tty.h     | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 1384426..ed77614 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -169,7 +169,7 @@ static inline int tty_copy_to_user(struct tty_struct *tty,
 {
 	struct n_tty_data *ldata = tty->disc_data;
 
-	tty_audit_add_data(tty, to, n, ldata->icanon);
+	tty_audit_add_data(tty, from, n, ldata->icanon);
 	return copy_to_user(to, from, n);
 }
 
diff --git a/drivers/tty/tty_audit.c b/drivers/tty/tty_audit.c
index 90ca082..3d245cd 100644
--- a/drivers/tty/tty_audit.c
+++ b/drivers/tty/tty_audit.c
@@ -265,7 +265,7 @@ static struct tty_audit_buf *tty_audit_buf_get(struct tty_struct *tty,
  *
  *	Audit @data of @size from @tty, if necessary.
  */
-void tty_audit_add_data(struct tty_struct *tty, unsigned char *data,
+void tty_audit_add_data(struct tty_struct *tty, const void *data,
 			size_t size, unsigned icanon)
 {
 	struct tty_audit_buf *buf;
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 5b04b0a..1e02fd4 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -607,7 +607,7 @@ extern void n_tty_inherit_ops(struct tty_ldisc_ops *ops);
 
 /* tty_audit.c */
 #ifdef CONFIG_AUDIT
-extern void tty_audit_add_data(struct tty_struct *tty, unsigned char *data,
+extern void tty_audit_add_data(struct tty_struct *tty, const void *data,
 			       size_t size, unsigned icanon);
 extern void tty_audit_exit(void);
 extern void tty_audit_fork(struct signal_struct *sig);
-- 
2.6.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1265085

Fromkbuild test robot <lkp@intel.com>
Date2015-11-08 14:10 +0100
Message-ID<qsxTj-yn-7@gated-at.bofh.it>
In reply to#1265082

[Multipart message — attachments visible in raw view] — view raw

Hi Peter,

[auto build test WARNING on: v4.3-rc7]
[also build test WARNING on: next-20151106]

url:    https://github.com/0day-ci/linux/commits/Peter-Hurley/tty-audit-Fix-audit-source/20151108-205330
config: x86_64-randconfig-x019-201545 (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   drivers/tty/n_tty.c: In function 'tty_copy_to_user':
>> drivers/tty/n_tty.c:172:26: warning: passing argument 2 of 'tty_audit_add_data' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
     tty_audit_add_data(tty, from, n, ldata->icanon);
                             ^
   In file included from drivers/tty/n_tty.c:40:0:
   include/linux/tty.h:616:20: note: expected 'unsigned char *' but argument is of type 'const void *'
    static inline void tty_audit_add_data(struct tty_struct *tty,
                       ^

vim +172 drivers/tty/n_tty.c

   156	static inline int tty_put_user(struct tty_struct *tty, unsigned char x,
   157				       unsigned char __user *ptr)
   158	{
   159		struct n_tty_data *ldata = tty->disc_data;
   160	
   161		tty_audit_add_data(tty, &x, 1, ldata->icanon);
   162		return put_user(x, ptr);
   163	}
   164	
   165	static inline int tty_copy_to_user(struct tty_struct *tty,
   166						void __user *to,
   167						const void *from,
   168						unsigned long n)
   169	{
   170		struct n_tty_data *ldata = tty->disc_data;
   171	
 > 172		tty_audit_add_data(tty, from, n, ldata->icanon);
   173		return copy_to_user(to, from, n);
   174	}
   175	
   176	/**
   177	 *	n_tty_kick_worker - start input worker (if required)
   178	 *	@tty: terminal
   179	 *
   180	 *	Re-schedules the flip buffer work if it may have stopped

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[toc] | [prev] | [next] | [standalone]


#1265088

FromPeter Hurley <peter@hurleysoftware.com>
Date2015-11-08 14:50 +0100
Message-ID<qsyw1-MG-1@gated-at.bofh.it>
In reply to#1265085
On 11/08/2015 08:01 AM, kbuild test robot wrote:
> Hi Peter,
> 
> [auto build test WARNING on: v4.3-rc7]
> [also build test WARNING on: next-20151106]
> 
> url:    https://github.com/0day-ci/linux/commits/Peter-Hurley/tty-audit-Fix-audit-source/20151108-205330
> config: x86_64-randconfig-x019-201545 (attached as .config)
> reproduce:
>         # save the attached .config to linux build tree
>         make ARCH=x86_64 
> 
> All warnings (new ones prefixed by >>):
> 
>    drivers/tty/n_tty.c: In function 'tty_copy_to_user':
>>> drivers/tty/n_tty.c:172:26: warning: passing argument 2 of 'tty_audit_add_data' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
>      tty_audit_add_data(tty, from, n, ldata->icanon);
>                              ^
>    In file included from drivers/tty/n_tty.c:40:0:
>    include/linux/tty.h:616:20: note: expected 'unsigned char *' but argument is of type 'const void *'
>     static inline void tty_audit_add_data(struct tty_struct *tty,

Thanks for the build report. I caused this during a manual rebase squash.
Re-testing v2 now :/

Regards,
Peter Hurley

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1265095 — [PATCH v2] tty: audit: Fix audit source

FromPeter Hurley <peter@hurleysoftware.com>
Date2015-11-08 15:00 +0100
Subject[PATCH v2] tty: audit: Fix audit source
Message-ID<qsyFI-PU-9@gated-at.bofh.it>
In reply to#1265082
The data to audit/record is in the 'from' buffer (ie., the input
read buffer).

Fixes: 72586c6061ab ("n_tty: Fix auditing support for cannonical mode")
Cc: Laura Abbott <labbott@fedoraproject.org>
Cc: Miloslav Trmač <mitr@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
---

v2: Fix rebase error, !CONFIG_AUDIT build fix

 drivers/tty/n_tty.c     | 2 +-
 drivers/tty/tty_audit.c | 2 +-
 include/linux/tty.h     | 6 +++---
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 1384426..ed77614 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -169,7 +169,7 @@ static inline int tty_copy_to_user(struct tty_struct *tty,
 {
 	struct n_tty_data *ldata = tty->disc_data;
 
-	tty_audit_add_data(tty, to, n, ldata->icanon);
+	tty_audit_add_data(tty, from, n, ldata->icanon);
 	return copy_to_user(to, from, n);
 }
 
diff --git a/drivers/tty/tty_audit.c b/drivers/tty/tty_audit.c
index 90ca082..3d245cd 100644
--- a/drivers/tty/tty_audit.c
+++ b/drivers/tty/tty_audit.c
@@ -265,7 +265,7 @@ static struct tty_audit_buf *tty_audit_buf_get(struct tty_struct *tty,
  *
  *	Audit @data of @size from @tty, if necessary.
  */
-void tty_audit_add_data(struct tty_struct *tty, unsigned char *data,
+void tty_audit_add_data(struct tty_struct *tty, const void *data,
 			size_t size, unsigned icanon)
 {
 	struct tty_audit_buf *buf;
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 5b04b0a..5e31f1b 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -607,7 +607,7 @@ extern void n_tty_inherit_ops(struct tty_ldisc_ops *ops);
 
 /* tty_audit.c */
 #ifdef CONFIG_AUDIT
-extern void tty_audit_add_data(struct tty_struct *tty, unsigned char *data,
+extern void tty_audit_add_data(struct tty_struct *tty, const void *data,
 			       size_t size, unsigned icanon);
 extern void tty_audit_exit(void);
 extern void tty_audit_fork(struct signal_struct *sig);
@@ -615,8 +615,8 @@ extern void tty_audit_tiocsti(struct tty_struct *tty, char ch);
 extern void tty_audit_push(struct tty_struct *tty);
 extern int tty_audit_push_current(void);
 #else
-static inline void tty_audit_add_data(struct tty_struct *tty,
-		unsigned char *data, size_t size, unsigned icanon)
+static inline void tty_audit_add_data(struct tty_struct *tty, const void *data,
+				      size_t size, unsigned icanon)
 {
 }
 static inline void tty_audit_tiocsti(struct tty_struct *tty, char ch)
-- 
2.6.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1266169 — Re: [PATCH v2] tty: audit: Fix audit source

FromLaura Abbott <labbott@redhat.com>
Date2015-11-10 02:50 +0100
SubjectRe: [PATCH v2] tty: audit: Fix audit source
Message-ID<qt6em-6Rb-7@gated-at.bofh.it>
In reply to#1265095
On 11/08/2015 05:52 AM, Peter Hurley wrote:
> The data to audit/record is in the 'from' buffer (ie., the input
> read buffer).
>
> Fixes: 72586c6061ab ("n_tty: Fix auditing support for cannonical mode")
> Cc: Laura Abbott <labbott@fedoraproject.org>
> Cc: Miloslav Trmač <mitr@redhat.com>
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Peter Hurley <peter@hurleysoftware.com>

Whoops, sorry about that.

Acked-by: Laura Abbott <labbott@fedoraproject.org>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web