* [2.6 patch] unexport uts_sem @ 2008-05-05 18:29 Adrian Bunk 2008-05-20 17:16 ` Frank Ch. Eigler 0 siblings, 1 reply; 12+ messages in thread From: Adrian Bunk @ 2008-05-05 18:29 UTC (permalink / raw) To: linux-kernel; +Cc: David S. Miller, Andrew Morton With the removal of the Solaris binary emulation the export of uts_sem became unused. Signed-off-by: Adrian Bunk <bunk@kernel.org> Acked-by: David S. Miller <davem@davemloft.net> --- This patch has been sent on: - 23 Apr 2008 e15db7b262fd8c3d9000e7d5e7a2b1d720fba8de diff --git a/kernel/sys.c b/kernel/sys.c index 6a0cc71..773d4a5 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -1331,8 +1331,6 @@ EXPORT_SYMBOL(in_egroup_p); DECLARE_RWSEM(uts_sem); -EXPORT_SYMBOL(uts_sem); - asmlinkage long sys_newuname(struct new_utsname __user * name) { int errno = 0; ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [2.6 patch] unexport uts_sem 2008-05-05 18:29 [2.6 patch] unexport uts_sem Adrian Bunk @ 2008-05-20 17:16 ` Frank Ch. Eigler 2008-05-20 17:27 ` Christoph Hellwig 0 siblings, 1 reply; 12+ messages in thread From: Frank Ch. Eigler @ 2008-05-20 17:16 UTC (permalink / raw) To: Adrian Bunk; +Cc: linux-kernel, David S. Miller, Andrew Morton, systemtap Adrian Bunk <bunk@kernel.org> writes: > With the removal of the Solaris binary emulation the export of > uts_sem became unused. [...] > > -EXPORT_SYMBOL(uts_sem); Am I correct that this would makes it invalid for modules to call utsname() (since the protective semaphore is now hidden)? Systemtap has been using them in order to validate the modules it builds against possible kernel vs. kernel-devel differences. - FChE ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [2.6 patch] unexport uts_sem 2008-05-20 17:16 ` Frank Ch. Eigler @ 2008-05-20 17:27 ` Christoph Hellwig 2008-05-20 18:38 ` Frank Ch. Eigler 0 siblings, 1 reply; 12+ messages in thread From: Christoph Hellwig @ 2008-05-20 17:27 UTC (permalink / raw) To: Frank Ch. Eigler Cc: Adrian Bunk, linux-kernel, David S. Miller, Andrew Morton, systemtap On Tue, May 20, 2008 at 01:16:19PM -0400, Frank Ch. Eigler wrote: > Am I correct that this would makes it invalid for modules to call > utsname() (since the protective semaphore is now hidden)? Yesm they should never had done that anyway. The module support does it's own version checking already. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [2.6 patch] unexport uts_sem 2008-05-20 17:27 ` Christoph Hellwig @ 2008-05-20 18:38 ` Frank Ch. Eigler 2008-05-21 12:37 ` Christoph Hellwig 0 siblings, 1 reply; 12+ messages in thread From: Frank Ch. Eigler @ 2008-05-20 18:38 UTC (permalink / raw) To: Christoph Hellwig Cc: Adrian Bunk, linux-kernel, David S. Miller, Andrew Morton, systemtap Hi - On Tue, May 20, 2008 at 01:27:30PM -0400, Christoph Hellwig wrote: > > Am I correct that this would makes it invalid for modules to call > > utsname() (since the protective semaphore is now hidden)? > > Yesm they should never had done that anyway. The module support > does it's own version checking already. Sorry, I misspoke - this check is intended not to cross-check kernel-devel and the kernel itself, but the debuginfo or similar data that is given to describe target of a systemtap script. I guess for new enough kernels we'll just do that using buildid hash codes. By the way, there do appear to be a few suspect in-tree users of utsname() without uts_sem locking (usb/storage/usb.c, cifs/connect.c, char/random.cc, fs/lockd/clntproc.c, ...). If these need to be fixed, then wouldn't uts_sem need to come back exported? - FChE ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [2.6 patch] unexport uts_sem 2008-05-20 18:38 ` Frank Ch. Eigler @ 2008-05-21 12:37 ` Christoph Hellwig 2008-05-21 14:48 ` Steve French (smfltc) 2008-05-21 17:51 ` [PATCH] usb-storage: don't call utsname() Alan Stern 0 siblings, 2 replies; 12+ messages in thread From: Christoph Hellwig @ 2008-05-21 12:37 UTC (permalink / raw) To: Frank Ch. Eigler Cc: Christoph Hellwig, Adrian Bunk, linux-kernel, David S. Miller, Andrew Morton, systemtap, usb-storage, linux-cifs-client, linux-nfs On Tue, May 20, 2008 at 02:38:02PM -0400, Frank Ch. Eigler wrote: > Sorry, I misspoke - this check is intended not to cross-check > kernel-devel and the kernel itself, but the debuginfo or similar data > that is given to describe target of a systemtap script. I guess for > new enough kernels we'll just do that using buildid hash codes. > > By the way, there do appear to be a few suspect in-tree users of > utsname() without uts_sem locking (usb/storage/usb.c Just a debug printk. Note sure why this particular one needs to print the version, but if it really wants to do it it should rather use UTS_RELEASE. > cifs/connect.c, This one is quite fishy. Not sure what it needs the name for but the kernel utsname is probably a bad choise. And yes, this one actually is racy because the host name can change. > char/random.c, random.c is always built-in and utsname is called during the single-threaded kernel initialization phase, so this is safe. > fs/lockd/clntproc.c, ...). Yes, this one is racy. Should probably be fixed by starting lockd with CLONE_NEWUTS so that it never changed during it's lifetime. It's probably not a good idea when it changes with outstanding lockd request anyway. > If these need to be fixed, > then wouldn't uts_sem need to come back exported? ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Re: [2.6 patch] unexport uts_sem 2008-05-21 12:37 ` Christoph Hellwig @ 2008-05-21 14:48 ` Steve French (smfltc) 2008-05-21 17:51 ` [PATCH] usb-storage: don't call utsname() Alan Stern 1 sibling, 0 replies; 12+ messages in thread From: Steve French (smfltc) @ 2008-05-21 14:48 UTC (permalink / raw) To: Christoph Hellwig Cc: Frank Ch. Eigler, Adrian Bunk, linux-kernel, David S. Miller, Andrew Morton, linux-cifs-client Christoph Hellwig wrote: > On Tue, May 20, 2008 at 02:38:02PM -0400, Frank Ch. Eigler wrote: > >> Sorry, I misspoke - this check is intended not to cross-check >> kernel-devel and the kernel itself, but the debuginfo or similar data >> that is given to describe target of a systemtap script. I guess for >> new enough kernels we'll just do that using buildid hash codes. >> >> By the way, there do appear to be a few suspect in-tree users of >> utsname() without uts_sem locking > > >> cifs/connect.c, >> > > This one is quite fishy. Not sure what it needs the name for but the > kernel utsname is probably a bad choise. And yes, this one actually > is racy because the host name can change. > CIFS in fs/cifs/sess.c uses utsname()->version because the cifs protocol requires that the server and client report their native operating system version during session setup (not just their "network operating system" or network file system version). The other uses of utsname()->version in connect.c will be removed (they are used in an older implementation of session_setup which is disabled by default). CIFS in fs/cifs/connect.c uses utsname()->nodename to get the default hostname during mount. For RFC1001 connections and for NTLMSSP, if no RFC1001 name for the client is supplied on the mount, the TCP host name must be used to identify the client in those packets. ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] usb-storage: don't call utsname() 2008-05-21 12:37 ` Christoph Hellwig 2008-05-21 14:48 ` Steve French (smfltc) @ 2008-05-21 17:51 ` Alan Stern 2008-05-21 18:09 ` Greg KH 1 sibling, 1 reply; 12+ messages in thread From: Alan Stern @ 2008-05-21 17:51 UTC (permalink / raw) To: Greg KH, Matthew Dharm Cc: Christoph Hellwig, Frank Ch. Eigler, Adrian Bunk, USB Storage list, Kernel development list, David S. Miller, systemtap, Andrew Morton, linux-cifs-client, linux-nfs This patch (as1100) replaces the core-kernel function call to utsname() in usb-storage with the UTS_RELEASE macro. It's used only for warning about extra unusual_devs entries. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> --- Index: usb-2.6/drivers/usb/storage/usb.c =================================================================== --- usb-2.6.orig/drivers/usb/storage/usb.c +++ usb-2.6/drivers/usb/storage/usb.c @@ -53,7 +53,7 @@ #include <linux/slab.h> #include <linux/kthread.h> #include <linux/mutex.h> -#include <linux/utsname.h> +#include <linux/utsrelease.h> #include <scsi/scsi.h> #include <scsi/scsi_cmnd.h> @@ -531,8 +531,8 @@ static int get_device_info(struct us_dat if (msg >= 0 && !(us->fflags & US_FL_NEED_OVERRIDE)) printk(KERN_NOTICE USB_STORAGE "This device " "(%04x,%04x,%04x S %02x P %02x)" - " has %s in unusual_devs.h (kernel" - " %s)\n" + " has %s in unusual_devs.h (kernel " + UTS_RELEASE ")\n" " Please send a copy of this message to " "<linux-usb@vger.kernel.org> and " "<usb-storage@lists.one-eyed-alien.net>\n", @@ -541,8 +541,7 @@ static int get_device_info(struct us_dat le16_to_cpu(ddesc->bcdDevice), idesc->bInterfaceSubClass, idesc->bInterfaceProtocol, - msgs[msg], - utsname()->release); + msgs[msg]); } return 0; ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] usb-storage: don't call utsname() 2008-05-21 17:51 ` [PATCH] usb-storage: don't call utsname() Alan Stern @ 2008-05-21 18:09 ` Greg KH 2008-05-21 18:19 ` Steve French (smfltc) 2008-05-21 18:52 ` Christoph Hellwig 0 siblings, 2 replies; 12+ messages in thread From: Greg KH @ 2008-05-21 18:09 UTC (permalink / raw) To: Alan Stern Cc: Matthew Dharm, Christoph Hellwig, Frank Ch. Eigler, Adrian Bunk, USB Storage list, Kernel development list, David S. Miller, systemtap, Andrew Morton, linux-cifs-client, linux-nfs On Wed, May 21, 2008 at 01:51:17PM -0400, Alan Stern wrote: > This patch (as1100) replaces the core-kernel function call to utsname() > in usb-storage with the UTS_RELEASE macro. It's used only for warning > about extra unusual_devs entries. > > Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Why? With this change, if you change the version number, the file will have to be rebuilt. Without the change, the file will not need to be rebuilt, right? I thought that was why this change was made a while ago, to prevent things from having to be rebuilt that didn't need to be. thanks, greg k-h ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Re: [PATCH] usb-storage: don't call utsname() 2008-05-21 18:09 ` Greg KH @ 2008-05-21 18:19 ` Steve French (smfltc) 2008-05-21 18:52 ` Christoph Hellwig 1 sibling, 0 replies; 12+ messages in thread From: Steve French (smfltc) @ 2008-05-21 18:19 UTC (permalink / raw) To: Greg KH Cc: Alan Stern, Matthew Dharm, Christoph Hellwig, Frank Ch. Eigler, Adrian Bunk, USB Storage list, Kernel development list, David S. Miller, systemtap, Andrew Morton, linux-cifs-client, linux-nfs Greg KH wrote: > On Wed, May 21, 2008 at 01:51:17PM -0400, Alan Stern wrote: > >> This patch (as1100) replaces the core-kernel function call to utsname() >> in usb-storage with the UTS_RELEASE macro. It's used only for warning >> about extra unusual_devs entries. >> >> Signed-off-by: Alan Stern <stern@rowland.harvard.edu> >> > > Why? With this change, if you change the version number, the file will > have to be rebuilt. Without the change, the file will not need to be > rebuilt, right? > > I thought that was why this change was made a while ago, to prevent > things from having to be rebuilt that didn't need to be > I agree - what was wrong with utsname->release ... it seems odd to statically build the kernel's version number into a module - it should be something we should be able to query (and it shouldn't change without reboot so accessing it is not racy). Access to other fields in the structure (nodename, domainname etc.) might need to be included in a macro but I didn't see one in utsname.h for this. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] usb-storage: don't call utsname() 2008-05-21 18:09 ` Greg KH 2008-05-21 18:19 ` Steve French (smfltc) @ 2008-05-21 18:52 ` Christoph Hellwig 2008-05-21 19:35 ` Greg KH 1 sibling, 1 reply; 12+ messages in thread From: Christoph Hellwig @ 2008-05-21 18:52 UTC (permalink / raw) To: Greg KH Cc: Alan Stern, Matthew Dharm, Christoph Hellwig, Frank Ch. Eigler, Adrian Bunk, USB Storage list, Kernel development list, David S. Miller, systemtap, Andrew Morton, linux-cifs-client, linux-nfs On Wed, May 21, 2008 at 11:09:57AM -0700, Greg KH wrote: > Why? With this change, if you change the version number, the file will > have to be rebuilt. Without the change, the file will not need to be > rebuilt, right? Because thanks to the container patches it utsname fields other than hostname can actually change at runtime now and you'll get races looking at them. And probably not the output you want if someone in your container changes the kernel version to trick applications. ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] usb-storage: don't call utsname() 2008-05-21 18:52 ` Christoph Hellwig @ 2008-05-21 19:35 ` Greg KH 2008-05-21 21:01 ` Steve French (smfltc) 0 siblings, 1 reply; 12+ messages in thread From: Greg KH @ 2008-05-21 19:35 UTC (permalink / raw) To: Christoph Hellwig Cc: Alan Stern, Matthew Dharm, Frank Ch. Eigler, Adrian Bunk, USB Storage list, Kernel development list, David S. Miller, systemtap, Andrew Morton, linux-cifs-client, linux-nfs On Wed, May 21, 2008 at 02:52:51PM -0400, Christoph Hellwig wrote: > On Wed, May 21, 2008 at 11:09:57AM -0700, Greg KH wrote: > > Why? With this change, if you change the version number, the file will > > have to be rebuilt. Without the change, the file will not need to be > > rebuilt, right? > > Because thanks to the container patches it utsname fields other than > hostname can actually change at runtime now and you'll get races looking > at them. And probably not the output you want if someone in your > container changes the kernel version to trick applications. So, do we now go and rip out all usages of utsname()->release and put back the #define just because of the loonacy of containers? No kernel should have to change it's version number to trick an application, why would an application care about the version number to start with? In the "enterprise kernel" world, version numbers have little to no relevance on the functionality or features of the kernel, so any check of something like this is sure to be wrong to start with. thanks, greg k-h ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Re: [PATCH] usb-storage: don't call utsname() 2008-05-21 19:35 ` Greg KH @ 2008-05-21 21:01 ` Steve French (smfltc) 0 siblings, 0 replies; 12+ messages in thread From: Steve French (smfltc) @ 2008-05-21 21:01 UTC (permalink / raw) To: Greg KH Cc: Christoph Hellwig, Alan Stern, Matthew Dharm, Frank Ch. Eigler, Adrian Bunk, USB Storage list, Kernel development list, David S. Miller, systemtap, Andrew Morton, linux-cifs-client, linux-nfs Greg KH wrote: > On Wed, May 21, 2008 at 02:52:51PM -0400, Christoph Hellwig wrote: > >> On Wed, May 21, 2008 at 11:09:57AM -0700, Greg KH wrote: >> >>> Why? With this change, if you change the version number, the file will >>> have to be rebuilt. Without the change, the file will not need to be >>> rebuilt, right? >>> >> Because thanks to the container patches it utsname fields other than >> hostname can actually change at runtime now and you'll get races looking >> at them. And probably not the output you want if someone in your >> container changes the kernel version to trick applications. >> > > So, do we now go and rip out all usages of utsname()->release and put > back the #define just because of the loonacy of containers? > > No kernel should have to change it's version number to trick an > application, why would an application care about the version number to > The version number (of the OS not just of the SMB/CIFS implementation, both of which are exchanged by client and server) has sometimes been useful in debugging problems that I and others and the Samba team look at (you can see it in wireshark/tcpdump traces, and it can be logged easily on either end as well). If containers are crazy enough to change the version number, not just the hostname, why don't we simply define a three line macro for retrieving this which is safe and put it in utsname.h? ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2008-05-21 21:01 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-05-05 18:29 [2.6 patch] unexport uts_sem Adrian Bunk 2008-05-20 17:16 ` Frank Ch. Eigler 2008-05-20 17:27 ` Christoph Hellwig 2008-05-20 18:38 ` Frank Ch. Eigler 2008-05-21 12:37 ` Christoph Hellwig 2008-05-21 14:48 ` Steve French (smfltc) 2008-05-21 17:51 ` [PATCH] usb-storage: don't call utsname() Alan Stern 2008-05-21 18:09 ` Greg KH 2008-05-21 18:19 ` Steve French (smfltc) 2008-05-21 18:52 ` Christoph Hellwig 2008-05-21 19:35 ` Greg KH 2008-05-21 21:01 ` Steve French (smfltc)
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).