linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/9] strict user copy checks on x86_64
@ 2011-05-12 23:50 Stephen Boyd
  2011-05-12 23:50 ` [PATCH 3/9] [SCSI] lpfc: Silence DEBUG_STRICT_USER_COPY_CHECKS=y warning Stephen Boyd
  2011-05-24 21:29 ` [PATCH 0/9] strict user copy checks on x86_64 Stephen Boyd
  0 siblings, 2 replies; 5+ messages in thread
From: Stephen Boyd @ 2011-05-12 23:50 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-wireless, netdev, Intel Linux Wireless, linux-scsi, x86,
	Andrew Morton

It turns out that strict user copy checks (also known as
CONFIG_DEBUG_STRICT_USER_COPY_CHECKS) isn't actually implemented
on x86_64 and thus we aren't catching potential security holes
at compile time.

This series adds support for strict user copy checks on x86_64
and silences all the benign warnings in the x86_64 allyesconfig.

The final patch consolidates the config option as its duplicated
across mutliple arches. I don't know what tree this series should
go through so I tried to send the individual driver patches to the
respective maintainers.

Stephen Boyd (9):
  iwlegacy: Silence DEBUG_STRICT_USER_COPY_CHECKS=y warning
  iwlwifi: Silence DEBUG_STRICT_USER_COPY_CHECKS=y warning
  [SCSI] lpfc: Silence DEBUG_STRICT_USER_COPY_CHECKS=y warning
  debugfs: Silence DEBUG_STRICT_USER_COPY_CHECKS=y warning
  kprobes: Silence DEBUG_STRICT_USER_COPY_CHECKS=y warning
  Bluetooth: Silence DEBUG_STRICT_USER_COPY_CHECKS=y warning
  ASoC: Silence DEBUG_STRICT_USER_COPY_CHECKS=y warning
  x86: Implement strict user copy checks for x86_64
  Consolidate CONFIG_DEBUG_STRICT_USER_COPY_CHECKS

 arch/parisc/Kconfig                         |    1 +
 arch/parisc/Kconfig.debug                   |   14 --------------
 arch/s390/Kconfig                           |    1 +
 arch/s390/Kconfig.debug                     |   14 --------------
 arch/s390/lib/Makefile                      |    1 -
 arch/s390/lib/usercopy.c                    |    8 --------
 arch/sparc/lib/Makefile                     |    1 -
 arch/sparc/lib/usercopy.c                   |    8 --------
 arch/tile/Kconfig                           |    8 +-------
 arch/tile/include/asm/uaccess.h             |    7 ++++++-
 arch/tile/lib/uaccess.c                     |    8 --------
 arch/x86/Kconfig                            |    1 +
 arch/x86/Kconfig.debug                      |   14 --------------
 arch/x86/include/asm/uaccess_64.h           |   12 +++++++++---
 arch/x86/lib/usercopy_32.c                  |    6 ------
 drivers/net/wireless/iwlegacy/iwl-4965-rs.c |    2 +-
 drivers/net/wireless/iwlwifi/iwl-agn-rs.c   |    2 +-
 drivers/scsi/lpfc/lpfc_debugfs.c            |    3 ++-
 fs/debugfs/file.c                           |    2 +-
 kernel/kprobes.c                            |    2 +-
 lib/Kconfig.debug                           |   18 ++++++++++++++++++
 lib/Makefile                                |    1 +
 lib/usercopy.c                              |    8 ++++++++
 net/bluetooth/rfcomm/sock.c                 |    3 ++-
 sound/soc/soc-core.c                        |    2 +-
 25 files changed, 55 insertions(+), 92 deletions(-)
 delete mode 100644 arch/s390/lib/usercopy.c
 delete mode 100644 arch/sparc/lib/usercopy.c
 create mode 100644 lib/usercopy.c

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 3/9] [SCSI] lpfc: Silence DEBUG_STRICT_USER_COPY_CHECKS=y warning
  2011-05-12 23:50 [PATCH 0/9] strict user copy checks on x86_64 Stephen Boyd
@ 2011-05-12 23:50 ` Stephen Boyd
  2011-05-24 13:32   ` James Smart
  2011-05-24 21:29 ` [PATCH 0/9] strict user copy checks on x86_64 Stephen Boyd
  1 sibling, 1 reply; 5+ messages in thread
From: Stephen Boyd @ 2011-05-12 23:50 UTC (permalink / raw)
  To: James E.J. Bottomley; +Cc: linux-kernel, linux-scsi, James Smart

Enabling DEBUG_STRICT_USER_COPY_CHECKS causes the following
warning:

In file included from arch/x86/include/asm/uaccess.h:573,
                 from include/linux/uaccess.h:5,
                 from include/linux/highmem.h:7,
                 from include/linux/pagemap.h:10,
                 from include/linux/blkdev.h:12,
                 from drivers/scsi/lpfc/lpfc_debugfs.c:21:
In function 'copy_from_user':
arch/x86/include/asm/uaccess_64.h:65:
warning: call to 'copy_from_user_overflow' declared with
attribute warning: copy_from_user() buffer size is not provably
correct

presumably due to buf_size being signed causing GCC to fail to
see that buf_size can't become negative.

Cc: James Smart <james.smart@emulex.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
---
 drivers/scsi/lpfc/lpfc_debugfs.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c
index 3d96774..0af53a6 100644
--- a/drivers/scsi/lpfc/lpfc_debugfs.c
+++ b/drivers/scsi/lpfc/lpfc_debugfs.c
@@ -1305,7 +1305,8 @@ static int lpfc_idiag_cmd_get(const char __user *buf, size_t nbytes,
 {
 	char mybuf[64];
 	char *pbuf, *step_str;
-	int bsize, i;
+	int i;
+	size_t bsize;
 
 	/* Protect copy from user */
 	if (!access_ok(VERIFY_READ, buf, nbytes))
-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 3/9] [SCSI] lpfc: Silence DEBUG_STRICT_USER_COPY_CHECKS=y warning
  2011-05-12 23:50 ` [PATCH 3/9] [SCSI] lpfc: Silence DEBUG_STRICT_USER_COPY_CHECKS=y warning Stephen Boyd
@ 2011-05-24 13:32   ` James Smart
  0 siblings, 0 replies; 5+ messages in thread
From: James Smart @ 2011-05-24 13:32 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: James E.J. Bottomley, linux-kernel@vger.kernel.org,
	linux-scsi@vger.kernel.org, Iannicelli, Alex

Acked-by: James Smart <james.smart@emulex.com>

Thanks

-- james


On 5/12/2011 7:50 PM, Stephen Boyd wrote:
> Enabling DEBUG_STRICT_USER_COPY_CHECKS causes the following
> warning:
>
> In file included from arch/x86/include/asm/uaccess.h:573,
>                   from include/linux/uaccess.h:5,
>                   from include/linux/highmem.h:7,
>                   from include/linux/pagemap.h:10,
>                   from include/linux/blkdev.h:12,
>                   from drivers/scsi/lpfc/lpfc_debugfs.c:21:
> In function 'copy_from_user':
> arch/x86/include/asm/uaccess_64.h:65:
> warning: call to 'copy_from_user_overflow' declared with
> attribute warning: copy_from_user() buffer size is not provably
> correct
>
> presumably due to buf_size being signed causing GCC to fail to
> see that buf_size can't become negative.
>
> Cc: James Smart<james.smart@emulex.com>
> Signed-off-by: Stephen Boyd<sboyd@codeaurora.org>
> ---
>   drivers/scsi/lpfc/lpfc_debugfs.c |    3 ++-
>   1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c
> index 3d96774..0af53a6 100644
> --- a/drivers/scsi/lpfc/lpfc_debugfs.c
> +++ b/drivers/scsi/lpfc/lpfc_debugfs.c
> @@ -1305,7 +1305,8 @@ static int lpfc_idiag_cmd_get(const char __user *buf, size_t nbytes,
>   {
>   	char mybuf[64];
>   	char *pbuf, *step_str;
> -	int bsize, i;
> +	int i;
> +	size_t bsize;
>
>   	/* Protect copy from user */
>   	if (!access_ok(VERIFY_READ, buf, nbytes))

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/9] strict user copy checks on x86_64
  2011-05-12 23:50 [PATCH 0/9] strict user copy checks on x86_64 Stephen Boyd
  2011-05-12 23:50 ` [PATCH 3/9] [SCSI] lpfc: Silence DEBUG_STRICT_USER_COPY_CHECKS=y warning Stephen Boyd
@ 2011-05-24 21:29 ` Stephen Boyd
  2011-05-24 23:33   ` H. Peter Anvin
  1 sibling, 1 reply; 5+ messages in thread
From: Stephen Boyd @ 2011-05-24 21:29 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-kernel, linux-wireless, netdev, Intel Linux Wireless,
	linux-scsi, x86, Ingo Molnar

Hi Andrew,

(I don't know who to pick on sorry)

On 05/12/2011 04:50 PM, Stephen Boyd wrote:
> It turns out that strict user copy checks (also known as
> CONFIG_DEBUG_STRICT_USER_COPY_CHECKS) isn't actually implemented
> on x86_64 and thus we aren't catching potential security holes
> at compile time.
>
> This series adds support for strict user copy checks on x86_64
> and silences all the benign warnings in the x86_64 allyesconfig.
>
> The final patch consolidates the config option as its duplicated
> across mutliple arches. I don't know what tree this series should
> go through so I tried to send the individual driver patches to the
> respective maintainers.
>
> Stephen Boyd (9):
>   iwlegacy: Silence DEBUG_STRICT_USER_COPY_CHECKS=y warning
>   iwlwifi: Silence DEBUG_STRICT_USER_COPY_CHECKS=y warning
>   [SCSI] lpfc: Silence DEBUG_STRICT_USER_COPY_CHECKS=y warning
>   debugfs: Silence DEBUG_STRICT_USER_COPY_CHECKS=y warning
>   kprobes: Silence DEBUG_STRICT_USER_COPY_CHECKS=y warning
>   Bluetooth: Silence DEBUG_STRICT_USER_COPY_CHECKS=y warning
>   ASoC: Silence DEBUG_STRICT_USER_COPY_CHECKS=y warning
>   x86: Implement strict user copy checks for x86_64
>   Consolidate CONFIG_DEBUG_STRICT_USER_COPY_CHECKS

It looks like 1, 2, 4, 6, and 7 got picked up. Should I resend the left
over patches with appropriate acked-bys and tags? Would it be
appropriate to push this through your tree?

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/9] strict user copy checks on x86_64
  2011-05-24 21:29 ` [PATCH 0/9] strict user copy checks on x86_64 Stephen Boyd
@ 2011-05-24 23:33   ` H. Peter Anvin
  0 siblings, 0 replies; 5+ messages in thread
From: H. Peter Anvin @ 2011-05-24 23:33 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Andrew Morton, linux-kernel, linux-wireless, netdev,
	Intel Linux Wireless, linux-scsi, x86, Ingo Molnar

On 05/24/2011 02:29 PM, Stephen Boyd wrote:
> 
> It looks like 1, 2, 4, 6, and 7 got picked up. Should I resend the left
> over patches with appropriate acked-bys and tags? Would it be
> appropriate to push this through your tree?
> 

I was first going to think I'd pick up 8 and 9 in tip, but since 9 is
cross-architecture, Andrew's tree might be better.

Acked-by: H. Peter Anvin <hpa@zytor.com>

	-hpa

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-05-24 23:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-12 23:50 [PATCH 0/9] strict user copy checks on x86_64 Stephen Boyd
2011-05-12 23:50 ` [PATCH 3/9] [SCSI] lpfc: Silence DEBUG_STRICT_USER_COPY_CHECKS=y warning Stephen Boyd
2011-05-24 13:32   ` James Smart
2011-05-24 21:29 ` [PATCH 0/9] strict user copy checks on x86_64 Stephen Boyd
2011-05-24 23:33   ` H. Peter Anvin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).