* [PATCH] Don't export scsi kernel variables in userspace headers.
@ 2009-07-25 2:10 Dave Jones
2009-07-26 22:14 ` Matthew Wilcox
2009-07-27 7:44 ` Christoph Hellwig
0 siblings, 2 replies; 5+ messages in thread
From: Dave Jones @ 2009-07-25 2:10 UTC (permalink / raw)
To: Linux Kernel; +Cc: linux-scsi
Found with make headers_check
/usr/include/scsi/scsi.h:159: userspace cannot call function or variable defined in the kernel
/usr/include/scsi/scsi.h:285: userspace cannot call function or variable defined in the kernel
Signed-off-by: Dave Jones <davej@redhat.com>
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index 084478e..689570e 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -156,7 +156,9 @@ scsi_varlen_cdb_length(const void *hdr)
return ((struct scsi_varlen_cdb_hdr *)hdr)->additional_cdb_length + 8;
}
+#ifdef __KERNEL__
extern const unsigned char scsi_command_size_tbl[8];
+#endif
#define COMMAND_SIZE(opcode) scsi_command_size_tbl[((opcode) >> 5) & 7]
static inline unsigned
@@ -281,8 +283,10 @@ enum scsi_protocol {
SCSI_PROTOCOL_UNSPEC = 0xf, /* No specific protocol */
};
+#ifdef __KERNEL__
/* Returns a human-readable name for the device */
extern const char * scsi_device_type(unsigned type);
+#endif
/*
* standard mode-select header prepended to all mode-select commands
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] Don't export scsi kernel variables in userspace headers.
2009-07-25 2:10 [PATCH] Don't export scsi kernel variables in userspace headers Dave Jones
@ 2009-07-26 22:14 ` Matthew Wilcox
2009-07-27 7:44 ` Christoph Hellwig
1 sibling, 0 replies; 5+ messages in thread
From: Matthew Wilcox @ 2009-07-26 22:14 UTC (permalink / raw)
To: Dave Jones, Linux Kernel, linux-scsi
On Fri, Jul 24, 2009 at 10:10:26PM -0400, Dave Jones wrote:
> +++ b/include/scsi/scsi.h
> @@ -156,7 +156,9 @@ scsi_varlen_cdb_length(const void *hdr)
> return ((struct scsi_varlen_cdb_hdr *)hdr)->additional_cdb_length + 8;
> }
>
> +#ifdef __KERNEL__
> extern const unsigned char scsi_command_size_tbl[8];
> +#endif
> #define COMMAND_SIZE(opcode) scsi_command_size_tbl[((opcode) >> 5) & 7]
>
> static inline unsigned
Probably should move that #endif down -- it's not like userspace can
use the COMMAND_SIZE macro (should headers_check also check for this?)
Also scsi_command_size() isn't usable by userspace either, since it uses
COMMAND_SIZE.
--
Matthew Wilcox Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Don't export scsi kernel variables in userspace headers.
2009-07-25 2:10 [PATCH] Don't export scsi kernel variables in userspace headers Dave Jones
2009-07-26 22:14 ` Matthew Wilcox
@ 2009-07-27 7:44 ` Christoph Hellwig
2009-07-27 8:26 ` Sam Ravnborg
1 sibling, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2009-07-27 7:44 UTC (permalink / raw)
To: Dave Jones, Linux Kernel, linux-scsi
On Fri, Jul 24, 2009 at 10:10:26PM -0400, Dave Jones wrote:
> Found with make headers_check
>
> /usr/include/scsi/scsi.h:159: userspace cannot call function or variable defined in the kernel
> /usr/include/scsi/scsi.h:285: userspace cannot call function or variable defined in the kernel
The headers shouldn't be exported at all because scsi/ headers are
exported from glibc.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Don't export scsi kernel variables in userspace headers.
2009-07-27 7:44 ` Christoph Hellwig
@ 2009-07-27 8:26 ` Sam Ravnborg
2009-07-27 8:37 ` Boaz Harrosh
0 siblings, 1 reply; 5+ messages in thread
From: Sam Ravnborg @ 2009-07-27 8:26 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Dave Jones, Linux Kernel, linux-scsi
On Mon, Jul 27, 2009 at 03:44:18AM -0400, Christoph Hellwig wrote:
> On Fri, Jul 24, 2009 at 10:10:26PM -0400, Dave Jones wrote:
> > Found with make headers_check
> >
> > /usr/include/scsi/scsi.h:159: userspace cannot call function or variable defined in the kernel
> > /usr/include/scsi/scsi.h:285: userspace cannot call function or variable defined in the kernel
>
> The headers shouldn't be exported at all because scsi/ headers are
> exported from glibc.
Where does glibc get these headers from?
If glibc have their own private copy then the headers should indeed be exported
so we avoid such mess.
Sam
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Don't export scsi kernel variables in userspace headers.
2009-07-27 8:26 ` Sam Ravnborg
@ 2009-07-27 8:37 ` Boaz Harrosh
0 siblings, 0 replies; 5+ messages in thread
From: Boaz Harrosh @ 2009-07-27 8:37 UTC (permalink / raw)
To: Sam Ravnborg; +Cc: Christoph Hellwig, Dave Jones, Linux Kernel, linux-scsi
On 07/27/2009 11:26 AM, Sam Ravnborg wrote:
> On Mon, Jul 27, 2009 at 03:44:18AM -0400, Christoph Hellwig wrote:
>> On Fri, Jul 24, 2009 at 10:10:26PM -0400, Dave Jones wrote:
>>> Found with make headers_check
>>>
>>> /usr/include/scsi/scsi.h:159: userspace cannot call function or variable defined in the kernel
>>> /usr/include/scsi/scsi.h:285: userspace cannot call function or variable defined in the kernel
>> The headers shouldn't be exported at all because scsi/ headers are
>> exported from glibc.
> Where does glibc get these headers from?
>
> If glibc have their own private copy then the headers should indeed be exported
> so we avoid such mess.
>
> Sam
We never had a Kbuild file in include/scsi. It was only added recently by the fcoe patchset.
scsi.h is not the only problem. All of /usr/include/scsi/* come from glibc private snapshot.
I agree with Sam that this is a complete mess, and that Kernel should take control back.
But someone should do it in an orderly manner. Clean up all the headers to be safe for
user mode and send notifications/patches to glibc, and the distributions must know that
they might be geting same files from two packages for a while.
Would we want a Kconfig option for a while, like SCSI_EXPORT_HEADERS so it can be turned
off?
Boaz
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-07-27 8:37 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-25 2:10 [PATCH] Don't export scsi kernel variables in userspace headers Dave Jones
2009-07-26 22:14 ` Matthew Wilcox
2009-07-27 7:44 ` Christoph Hellwig
2009-07-27 8:26 ` Sam Ravnborg
2009-07-27 8:37 ` Boaz Harrosh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox