linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] udev - safer string handling - part two
@ 2004-02-26  0:31 Kay Sievers
  2004-02-26  2:22 ` [PATCH] udev - safer string handling - part three Kay Sievers
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: Kay Sievers @ 2004-02-26  0:31 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 555 bytes --]

As promised, here is the next round. We provide in addition to the
already used macros:

  strfieldcpy(to, from)
  strfieldcat(to, from)

the corresponding friends, if the size of the target is not known and
must be provided by the caller:

  strnfieldcpy(to, from, maxsize)
  strnfieldcat(to, from, maxsize)

and switch nearly all possibly unsafe users of strcat(), strncat(),
strcpy() and strncpy() to these safer macros.

The last known remaining issue seems the use of sprintf() and
snprintf(). I will take on it later today or tomorrow.

thanks,
Kay

[-- Attachment #2: 05-stringfield-next-round.patch --]
[-- Type: text/plain, Size: 4202 bytes --]

diff -Nru a/namedev.c b/namedev.c
--- a/namedev.c	Thu Feb 26 01:26:53 2004
+++ b/namedev.c	Thu Feb 26 01:26:53 2004
@@ -209,7 +209,9 @@
 	return -1;
 }
 
-static void apply_format(struct udevice *udev, unsigned char *string, struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device)
+static void apply_format(struct udevice *udev, char *string, size_t maxsize,
+			 struct sysfs_class_device *class_dev,
+			 struct sysfs_device *sysfs_device)
 {
 	char temp[NAME_SIZE];
 	char temp1[NAME_SIZE];
@@ -245,19 +247,19 @@
 		case 'b':
 			if (strlen(udev->bus_id) == 0)
 				break;
-			strcat(pos, udev->bus_id);
+			strnfieldcat(pos, udev->bus_id, maxsize);
 			dbg("substitute bus_id '%s'", udev->bus_id);
 			break;
 		case 'k':
 			if (strlen(udev->kernel_name) == 0)
 				break;
-			strcat(pos, udev->kernel_name);
+			strnfieldcat(pos, udev->kernel_name, maxsize);
 			dbg("substitute kernel name '%s'", udev->kernel_name);
 			break;
 		case 'n':
 			if (strlen(udev->kernel_number) == 0)
 				break;
-			strcat(pos, udev->kernel_number);
+			strnfieldcat(pos, udev->kernel_number, maxsize);
 			dbg("substitute kernel number '%s'", udev->kernel_number);
 				break;
 		case 'm':
@@ -287,11 +289,11 @@
 					}
 				}
 				if (pos3) {
-					strcat(pos, pos3);
+					strnfieldcat(pos, pos3, maxsize);
 					dbg("substitute part of result string '%s'", pos3);
 				}
 			} else {
-				strcat(pos, udev->program_result);
+				strnfieldcat(pos, udev->program_result, maxsize);
 				dbg("substitute result string '%s'", udev->program_result);
 			}
 			break;
@@ -302,20 +304,20 @@
 					dbg("sysfa attribute '%s' not found", attr);
 					break;
 				}
-				strcpy(pos, tmpattr->value);
+				strnfieldcpy(pos, tmpattr->value, maxsize);
 				dbg("substitute sysfs value '%s'", tmpattr->value);
 			} else {
 				dbg("missing attribute");
 			}
 			break;
 		case '%':
-			strcat(pos, "%");
+			strnfieldcat(pos, "%", maxsize);
 			break;
 		default:
 			dbg("unknown substitution type '%%%c'", c);
 			break;
 		}
-		strcat(pos, tail);
+		strnfieldcat(pos, tail, maxsize);
 	}
 }
 
@@ -452,7 +454,7 @@
 				strncpy(value, buffer, len);
 				pos = value + strlen(value)-1;
 				if (pos[0] == '\n')
-				pos[0] = '\0';
+					pos[0] = '\0';
 				dbg("result is '%s'", value);
 			}
 		}
@@ -724,7 +726,8 @@
 		/* execute external program */
 		if (dev->program[0] != '\0') {
 			dbg("check " FIELD_PROGRAM);
-			apply_format(udev, dev->program, class_dev, sysfs_device);
+			apply_format(udev, dev->program, sizeof(dev->program),
+				     class_dev, sysfs_device);
 			if (execute_program(dev->program, udev->program_result, NAME_SIZE) != 0) {
 				dbg(FIELD_PROGRAM " returned nozero");
 				goto try_parent;
@@ -816,8 +819,10 @@
 
 found:
 	/* substitute placeholder */
-	apply_format(udev, udev->name, class_dev, sysfs_device);
-	apply_format(udev, udev->symlink, class_dev, sysfs_device);
+	apply_format(udev, udev->name, sizeof(udev->name),
+		     class_dev, sysfs_device);
+	apply_format(udev, udev->symlink, sizeof(udev->symlink),
+		     class_dev, sysfs_device);
 	udev->partitions = dev->partitions;
 done:
 	perm = find_perm(udev->name);
diff -Nru a/udev.h b/udev.h
--- a/udev.h	Thu Feb 26 01:26:53 2004
+++ b/udev.h	Thu Feb 26 01:26:53 2004
@@ -64,7 +64,19 @@
 #define strfieldcat(to, from) \
 do { \
 	to[sizeof(to)-1] = '\0'; \
-	strncat(to, from, sizeof(to) - strlen(to) -1); \
+	strncat(to, from, sizeof(to) - strlen(to)-1); \
+} while (0)
+
+#define strnfieldcpy(to, from, maxsize) \
+do { \
+	to[maxsize-1] = '\0'; \
+	strncpy(to, from, maxsize-1); \
+} while (0)
+
+#define strnfieldcat(to, from, maxsize) \
+do { \
+	to[maxsize-1] = '\0'; \
+	strncat(to, from, maxsize - strlen(to)-1); \
 } while (0)
 
 extern int udev_add_device(char *path, char *subsystem, int fake);
diff -Nru a/udev_config.c b/udev_config.c
--- a/udev_config.c	Thu Feb 26 01:26:53 2004
+++ b/udev_config.c	Thu Feb 26 01:26:53 2004
@@ -81,7 +81,7 @@
 #define set_var(_name, _var)				\
 	if (strcasecmp(variable, _name) == 0) {		\
 		dbg_parse("%s = '%s'", _name, value);	\
-		strncpy(_var, value, sizeof(_var));	\
+		strnfieldcpy(_var, value, sizeof(_var));\
 	}
 
 #define set_bool(_name, _var)				\

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

* [PATCH] udev - safer string handling - part three
  2004-02-26  0:31 [PATCH] udev - safer string handling - part two Kay Sievers
@ 2004-02-26  2:22 ` Kay Sievers
  2004-02-26  4:26 ` [PATCH] udev - safer string handling - part four Kay Sievers
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Kay Sievers @ 2004-02-26  2:22 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 420 bytes --]

Here we truncate our input strings from the environment to our
defined limit. It's a bit theroretical but better check for it.

It cleans up some magic length definitions and removes the code
duplication in udev, udevtest and udevsend.

udevd needs to be killed after installation, cause the message size
is changed with this patch.
Should we do this with the 'make install', like we do with the '.udevdb'?

thanks,
Kay

[-- Attachment #2: 06-truncate-input-strings.patch --]
[-- Type: text/plain, Size: 4664 bytes --]

diff -Nru a/namedev.c b/namedev.c
--- a/namedev.c	Thu Feb 26 03:09:18 2004
+++ b/namedev.c	Thu Feb 26 03:09:18 2004
@@ -405,7 +405,7 @@
 	int fds[2];
 	pid_t pid;
 	int value_set = 0;
-	char buffer[256];
+	char buffer[255];
 	char *pos;
 
 	retval = pipe(fds);
diff -Nru a/udev.c b/udev.c
--- a/udev.c	Thu Feb 26 03:09:18 2004
+++ b/udev.c	Thu Feb 26 03:09:18 2004
@@ -43,7 +43,7 @@
 unsigned char logname[42];
 void log_message (int level, const char *format, ...)
 {
-	va_list	args;
+	va_list args;
 
 	if (!udev_log)
 		return;
@@ -67,30 +67,6 @@
 	}
 }
 
-static inline char *get_action(void)
-{
-	char *action;
-
-	action = getenv("ACTION");
-	return action;
-}
-
-static inline char *get_devpath(void)
-{
-	char *devpath;
-
-	devpath = getenv("DEVPATH");
-	return devpath;
-}
-
-static inline char *get_seqnum(void)
-{
-	char *seqnum;
-
-	seqnum = getenv("SEQNUM");
-	return seqnum;
-}
-
 static char *subsystem_blacklist[] = {
 	"net",
 	"scsi_host",
@@ -130,7 +106,7 @@
 	}
 
 	/* skip blacklisted subsystems */
-	subsystem = argv[1];
+	subsystem = get_subsystem(argv[1]);
 	if (!subsystem) {
 		dbg("no subsystem?");
 		goto exit;
@@ -200,5 +176,3 @@
 
 	return udev_hotplug(argc, argv);
 }
-
-
diff -Nru a/udev.h b/udev.h
--- a/udev.h	Thu Feb 26 03:09:18 2004
+++ b/udev.h	Thu Feb 26 03:09:18 2004
@@ -23,6 +23,8 @@
 #ifndef UDEV_H
 #define UDEV_H
 
+#include <stdlib.h>
+#include <string.h>
 #include <sysfs/libsysfs.h>
 #include <stddef.h>
 #include <sys/param.h>
@@ -34,6 +36,10 @@
 #define GROUP_SIZE	30
 #define MODE_SIZE	8
 
+#define ACTION_SIZE	30
+#define DEVPATH_SIZE	255
+#define SUBSYSTEM_SIZE	30
+
 /* length of public data */
 #define UDEVICE_LEN (offsetof(struct udevice, bus_id))
 
@@ -78,6 +84,45 @@
 	to[maxsize-1] = '\0'; \
 	strncat(to, from, maxsize - strlen(to)-1); \
 } while (0)
+
+static inline char *get_action(void)
+{
+	char *action;
+
+	action = getenv("ACTION");
+	if (strlen(action) > ACTION_SIZE)
+		action[ACTION_SIZE-1] = '\0';
+
+	return action;
+}
+
+static inline char *get_devpath(void)
+{
+	char *devpath;
+
+	devpath = getenv("DEVPATH");
+	if (strlen(devpath) > DEVPATH_SIZE)
+		devpath[DEVPATH_SIZE-1] = '\0';
+
+	return devpath;
+}
+
+static inline char *get_seqnum(void)
+{
+	char *seqnum;
+
+	seqnum = getenv("SEQNUM");
+
+	return seqnum;
+}
+
+static inline char *get_subsystem(char *subsystem)
+{
+	if (strlen(subsystem) > SUBSYSTEM_SIZE)
+		subsystem[SUBSYSTEM_SIZE-1] = '\0';
+
+	return subsystem;
+}
 
 extern int udev_add_device(char *path, char *subsystem, int fake);
 extern int udev_remove_device(char *path, char *subsystem);
diff -Nru a/udevd.c b/udevd.c
--- a/udevd.c	Thu Feb 26 03:09:18 2004
+++ b/udevd.c	Thu Feb 26 03:09:18 2004
@@ -119,8 +119,8 @@
 static void udev_run(struct hotplug_msg *msg)
 {
 	pid_t pid;
-	char action[32];
-	char devpath[256];
+	char action[ACTION_SIZE];
+	char devpath[DEVPATH_SIZE];
 	char *env[] = { action, devpath, NULL };
 
 	snprintf(action, sizeof(action), "ACTION=%s", msg->action);
diff -Nru a/udevd.h b/udevd.h
--- a/udevd.h	Thu Feb 26 03:09:18 2004
+++ b/udevd.h	Thu Feb 26 03:09:18 2004
@@ -35,7 +35,7 @@
 	pid_t pid;
 	int seqnum;
 	time_t queue_time;
-	char action[8];
-	char devpath[128];
-	char subsystem[16];
+	char action[ACTION_SIZE];
+	char devpath[DEVPATH_SIZE];
+	char subsystem[SUBSYSTEM_SIZE];
 };
diff -Nru a/udevsend.c b/udevsend.c
--- a/udevsend.c	Thu Feb 26 03:09:18 2004
+++ b/udevsend.c	Thu Feb 26 03:09:18 2004
@@ -52,30 +52,6 @@
 }
 #endif
 
-static inline char *get_action(void)
-{
-	char *action;
-
-	action = getenv("ACTION");
-	return action;
-}
-
-static inline char *get_devpath(void)
-{
-	char *devpath;
-
-	devpath = getenv("DEVPATH");
-	return devpath;
-}
-
-static inline char *get_seqnum(void)
-{
-	char *seqnum;
-
-	seqnum = getenv("SEQNUM");
-	return seqnum;
-}
-
 static int build_hotplugmsg(struct hotplug_msg *msg, char *action,
 			    char *devpath, char *subsystem, int seqnum)
 {
@@ -144,7 +120,7 @@
 #endif
 	dbg("version %s", UDEV_VERSION);
 
-	subsystem = argv[1];
+	subsystem = get_subsystem(argv[1]);
 	if (subsystem == NULL) {
 		dbg("no subsystem");
 		goto exit;
diff -Nru a/udevtest.c b/udevtest.c
--- a/udevtest.c	Thu Feb 26 03:09:18 2004
+++ b/udevtest.c	Thu Feb 26 03:09:18 2004
@@ -66,30 +66,6 @@
 	}
 }
 
-static inline char *get_action(void)
-{
-	char *action;
-
-	action = getenv("ACTION");
-	return action;
-}
-
-static inline char *get_devpath(void)
-{
-	char *devpath;
-
-	devpath = getenv("DEVPATH");
-	return devpath;
-}
-
-static inline char *get_seqnum(void)
-{
-	char *seqnum;
-
-	seqnum = getenv("SEQNUM");
-	return seqnum;
-}
-
 static char *subsystem_blacklist[] = {
 	"net",
 	"scsi_host",

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

* [PATCH] udev - safer string handling - part four
  2004-02-26  0:31 [PATCH] udev - safer string handling - part two Kay Sievers
  2004-02-26  2:22 ` [PATCH] udev - safer string handling - part three Kay Sievers
@ 2004-02-26  4:26 ` Kay Sievers
  2004-02-26 20:56 ` [PATCH] udev - safer string handling - part two Greg KH
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Kay Sievers @ 2004-02-26  4:26 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 346 bytes --]

Mainly a cleanup of the earlier patches with a few missing pieces
and some cosmetical changes.

I've moved the udev_init_config() to very early init, otherwise we
don't get any logging for the processing of the input. What would I
do without gdb :)

Greg, it's the 7th patch in your box to apply. I will stop now and
wait for you :)

thanks,
Kay

[-- Attachment #2: 07-cleanup-earlier-changes.patch --]
[-- Type: text/plain, Size: 4964 bytes --]

diff -Nru a/logging.h b/logging.h
--- a/logging.h	Thu Feb 26 05:14:04 2004
+++ b/logging.h	Thu Feb 26 05:14:04 2004
@@ -37,14 +37,14 @@
 #undef info
 #define info(format, arg...)								\
 	do {										\
-		log_message (LOG_INFO , format , ## arg);				\
+		log_message(LOG_INFO , format , ## arg);				\
 	} while (0)
 
 #ifdef DEBUG
 #undef dbg
 #define dbg(format, arg...)								\
 	do {										\
-		log_message (LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg);	\
+		log_message(LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg);	\
 	} while (0)
 #endif
 
@@ -53,11 +53,11 @@
 #undef dbg_parse
 #define dbg_parse(format, arg...)							\
 	do {										\
-		log_message (LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg);	\
+		log_message(LOG_DEBUG , "%s: " format , __FUNCTION__ , ## arg);	\
 	} while (0)
 #endif
 
-extern void log_message (int level, const char *format, ...)
+extern void log_message(int level, const char *format, ...)
 	__attribute__ ((format (printf, 2, 3)));
 
 /* each program that uses syslog must declare this variable somewhere */
diff -Nru a/namedev.c b/namedev.c
--- a/namedev.c	Thu Feb 26 05:14:04 2004
+++ b/namedev.c	Thu Feb 26 05:14:04 2004
@@ -228,7 +228,7 @@
 	pos = string;
 
 	while (1) {
-		pos = strchr(pos, '%');
+		pos = strchr(string, '%');
 		if (pos != NULL) {
 			pos[0] = '\0';
 			tail = pos+1;
@@ -247,19 +247,19 @@
 		case 'b':
 			if (strlen(udev->bus_id) == 0)
 				break;
-			strnfieldcat(pos, udev->bus_id, maxsize);
+			strnfieldcat(string, udev->bus_id, maxsize);
 			dbg("substitute bus_id '%s'", udev->bus_id);
 			break;
 		case 'k':
 			if (strlen(udev->kernel_name) == 0)
 				break;
-			strnfieldcat(pos, udev->kernel_name, maxsize);
+			strnfieldcat(string, udev->kernel_name, maxsize);
 			dbg("substitute kernel name '%s'", udev->kernel_name);
 			break;
 		case 'n':
 			if (strlen(udev->kernel_number) == 0)
 				break;
-			strnfieldcat(pos, udev->kernel_number, maxsize);
+			strnfieldcat(string, udev->kernel_number, maxsize);
 			dbg("substitute kernel number '%s'", udev->kernel_number);
 				break;
 		case 'm':
@@ -289,11 +289,11 @@
 					}
 				}
 				if (pos3) {
-					strnfieldcat(pos, pos3, maxsize);
+					strnfieldcat(string, pos3, maxsize);
 					dbg("substitute part of result string '%s'", pos3);
 				}
 			} else {
-				strnfieldcat(pos, udev->program_result, maxsize);
+				strnfieldcat(string, udev->program_result, maxsize);
 				dbg("substitute result string '%s'", udev->program_result);
 			}
 			break;
@@ -304,20 +304,20 @@
 					dbg("sysfa attribute '%s' not found", attr);
 					break;
 				}
-				strnfieldcpy(pos, tmpattr->value, maxsize);
+				strnfieldcat(string, tmpattr->value, maxsize);
 				dbg("substitute sysfs value '%s'", tmpattr->value);
 			} else {
 				dbg("missing attribute");
 			}
 			break;
 		case '%':
-			strnfieldcat(pos, "%", maxsize);
+			strnfieldcat(string, "%", maxsize);
 			break;
 		default:
 			dbg("unknown substitution type '%%%c'", c);
 			break;
 		}
-		strnfieldcat(pos, tail, maxsize);
+		strnfieldcat(string, tail, maxsize);
 	}
 }
 
diff -Nru a/udev.c b/udev.c
--- a/udev.c	Thu Feb 26 05:14:04 2004
+++ b/udev.c	Thu Feb 26 05:14:04 2004
@@ -41,7 +41,7 @@
 
 #ifdef LOG
 unsigned char logname[42];
-void log_message (int level, const char *format, ...)
+void log_message(int level, const char *format, ...)
 {
 	va_list args;
 
@@ -76,7 +76,7 @@
 	"",
 };
 
-static int udev_hotplug(int argc, char **argv)
+static int udev_hotplug(void)
 {
 	char *action;
 	char *devpath;
@@ -106,7 +106,7 @@
 	}
 
 	/* skip blacklisted subsystems */
-	subsystem = get_subsystem(argv[1]);
+	subsystem = get_subsystem(main_argv[1]);
 	if (!subsystem) {
 		dbg("no subsystem?");
 		goto exit;
@@ -123,9 +123,6 @@
 	/* connect to the system message bus */
 	sysbus_connect();
 
-	/* initialize our configuration */
-	udev_init_config();
-
 	/* initialize udev database */
 	retval = udevdb_init(UDEVDB_DEFAULT);
 	if (retval != 0) {
@@ -172,7 +169,11 @@
 	main_envp = envp;
 
 	init_logging("udev");
+
+	/* initialize our configuration */
+	udev_init_config();
+
 	dbg("version %s", UDEV_VERSION);
 
-	return udev_hotplug(argc, argv);
+	return udev_hotplug();
 }
diff -Nru a/udev.h b/udev.h
--- a/udev.h	Thu Feb 26 05:14:04 2004
+++ b/udev.h	Thu Feb 26 05:14:04 2004
@@ -90,7 +90,7 @@
 	char *action;
 
 	action = getenv("ACTION");
-	if (strlen(action) > ACTION_SIZE)
+	if (action != NULL && strlen(action) > ACTION_SIZE)
 		action[ACTION_SIZE-1] = '\0';
 
 	return action;
@@ -101,7 +101,7 @@
 	char *devpath;
 
 	devpath = getenv("DEVPATH");
-	if (strlen(devpath) > DEVPATH_SIZE)
+	if (devpath != NULL && strlen(devpath) > DEVPATH_SIZE)
 		devpath[DEVPATH_SIZE-1] = '\0';
 
 	return devpath;
@@ -118,7 +118,7 @@
 
 static inline char *get_subsystem(char *subsystem)
 {
-	if (strlen(subsystem) > SUBSYSTEM_SIZE)
+	if (subsystem != NULL && strlen(subsystem) > SUBSYSTEM_SIZE)
 		subsystem[SUBSYSTEM_SIZE-1] = '\0';
 
 	return subsystem;

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

* Re: [PATCH] udev - safer string handling - part two
  2004-02-26  0:31 [PATCH] udev - safer string handling - part two Kay Sievers
  2004-02-26  2:22 ` [PATCH] udev - safer string handling - part three Kay Sievers
  2004-02-26  4:26 ` [PATCH] udev - safer string handling - part four Kay Sievers
@ 2004-02-26 20:56 ` Greg KH
  2004-02-26 20:56 ` [PATCH] udev - safer string handling - part three Greg KH
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Greg KH @ 2004-02-26 20:56 UTC (permalink / raw)
  To: linux-hotplug

On Thu, Feb 26, 2004 at 01:31:00AM +0100, Kay Sievers wrote:
> As promised, here is the next round. We provide in addition to the
> already used macros:
> 
>   strfieldcpy(to, from)
>   strfieldcat(to, from)
> 
> the corresponding friends, if the size of the target is not known and
> must be provided by the caller:
> 
>   strnfieldcpy(to, from, maxsize)
>   strnfieldcat(to, from, maxsize)
> 
> and switch nearly all possibly unsafe users of strcat(), strncat(),
> strcpy() and strncpy() to these safer macros.
> 
> The last known remaining issue seems the use of sprintf() and
> snprintf(). I will take on it later today or tomorrow.


Applied, thanks.

greg k-h



-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

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

* Re: [PATCH] udev - safer string handling - part three
  2004-02-26  0:31 [PATCH] udev - safer string handling - part two Kay Sievers
                   ` (2 preceding siblings ...)
  2004-02-26 20:56 ` [PATCH] udev - safer string handling - part two Greg KH
@ 2004-02-26 20:56 ` Greg KH
  2004-02-26 20:57 ` [PATCH] udev - safer string handling - part four Greg KH
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Greg KH @ 2004-02-26 20:56 UTC (permalink / raw)
  To: linux-hotplug

On Thu, Feb 26, 2004 at 03:22:45AM +0100, Kay Sievers wrote:
> Here we truncate our input strings from the environment to our
> defined limit. It's a bit theroretical but better check for it.
> 
> It cleans up some magic length definitions and removes the code
> duplication in udev, udevtest and udevsend.

Applied.

> udevd needs to be killed after installation, cause the message size
> is changed with this patch.
> Should we do this with the 'make install', like we do with the '.udevdb'?

That might not be a bad idea, just to be safe.

thanks,

greg k-h


-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

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

* Re: [PATCH] udev - safer string handling - part four
  2004-02-26  0:31 [PATCH] udev - safer string handling - part two Kay Sievers
                   ` (3 preceding siblings ...)
  2004-02-26 20:56 ` [PATCH] udev - safer string handling - part three Greg KH
@ 2004-02-26 20:57 ` Greg KH
  2004-02-26 22:42 ` Kay Sievers
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Greg KH @ 2004-02-26 20:57 UTC (permalink / raw)
  To: linux-hotplug

On Thu, Feb 26, 2004 at 05:26:06AM +0100, Kay Sievers wrote:
> Mainly a cleanup of the earlier patches with a few missing pieces
> and some cosmetical changes.
> 
> I've moved the udev_init_config() to very early init, otherwise we
> don't get any logging for the processing of the input. What would I
> do without gdb :)

Applied, thanks.

> Greg, it's the 7th patch in your box to apply. I will stop now and
> wait for you :)

Caught up with most of yours now, still have a bunch more from other
people to go.  That's what I get for having to do real work for a few
days... :)

thanks,

greg k-h


-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

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

* Re: [PATCH] udev - safer string handling - part four
  2004-02-26  0:31 [PATCH] udev - safer string handling - part two Kay Sievers
                   ` (4 preceding siblings ...)
  2004-02-26 20:57 ` [PATCH] udev - safer string handling - part four Greg KH
@ 2004-02-26 22:42 ` Kay Sievers
  2004-03-18 14:24 ` [PATCH] udev - safer string handling - part three Harald Hoyer
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Kay Sievers @ 2004-02-26 22:42 UTC (permalink / raw)
  To: linux-hotplug

On Thu, Feb 26, 2004 at 12:57:36PM -0800, Greg KH wrote:
> On Thu, Feb 26, 2004 at 05:26:06AM +0100, Kay Sievers wrote:
> > Mainly a cleanup of the earlier patches with a few missing pieces
> > and some cosmetical changes.
> > 
> > I've moved the udev_init_config() to very early init, otherwise we
> > don't get any logging for the processing of the input. What would I
> > do without gdb :)
> 
> Applied, thanks.
> 
> > Greg, it's the 7th patch in your box to apply. I will stop now and
> > wait for you :)
> 
> Caught up with most of yours now, still have a bunch more from other
> people to go.  That's what I get for having to do real work for a few
> days... :)

Yes, people get what they deserve.
Maybe it's too nice to work with you. :)

I'm glad to see what we all have accomplished together during the last
weeks.

thanks again,
Kay


-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

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

* Re: [PATCH] udev - safer string handling - part three
  2004-02-26  0:31 [PATCH] udev - safer string handling - part two Kay Sievers
                   ` (5 preceding siblings ...)
  2004-02-26 22:42 ` Kay Sievers
@ 2004-03-18 14:24 ` Harald Hoyer
  2004-03-18 14:39 ` Kay Sievers
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Harald Hoyer @ 2004-03-18 14:24 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 230 bytes --]

Kay Sievers wrote:
> udevd needs to be killed after installation, cause the message size
> is changed with this patch.
> Should we do this with the 'make install', like we do with the '.udevdb'?

Not a good idea in build systems!

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

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

* Re: [PATCH] udev - safer string handling - part three
  2004-02-26  0:31 [PATCH] udev - safer string handling - part two Kay Sievers
                   ` (6 preceding siblings ...)
  2004-03-18 14:24 ` [PATCH] udev - safer string handling - part three Harald Hoyer
@ 2004-03-18 14:39 ` Kay Sievers
  2004-03-18 15:01 ` Harald Hoyer
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Kay Sievers @ 2004-03-18 14:39 UTC (permalink / raw)
  To: linux-hotplug

On Thu, 2004-03-18 at 15:24, Harald Hoyer wrote:
> Kay Sievers wrote:
> > udevd needs to be killed after installation, cause the message size
> > is changed with this patch.
> > Should we do this with the 'make install', like we do with the '.udevdb'?
> 
> Not a good idea in build systems!

Oh, I like this style of posts :)
It's not killed, if you install it with a DESTDIR.

thanks,
Kay



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id\x1470&alloc_id638&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

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

* Re: [PATCH] udev - safer string handling - part three
  2004-02-26  0:31 [PATCH] udev - safer string handling - part two Kay Sievers
                   ` (7 preceding siblings ...)
  2004-03-18 14:39 ` Kay Sievers
@ 2004-03-18 15:01 ` Harald Hoyer
  2004-03-26 22:41 ` Kay Sievers
  2004-03-29  8:09 ` Harald Hoyer
  10 siblings, 0 replies; 12+ messages in thread
From: Harald Hoyer @ 2004-03-18 15:01 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 1442 bytes --]

Kay Sievers wrote:
> On Thu, 2004-03-18 at 15:24, Harald Hoyer wrote:
> 
>>Kay Sievers wrote:
>>
>>>udevd needs to be killed after installation, cause the message size
>>>is changed with this patch.
>>>Should we do this with the 'make install', like we do with the '.udevdb'?
>>
>>Not a good idea in build systems!
> 
> 
> Oh, I like this style of posts :)
> It's not killed, if you install it with a DESTDIR.
> 
> thanks,
> Kay
> 

well, well... take care ...
%makeinstall
on RedHat/Fedora rpmbuild does not use DESTDIR, though I wish it would...


/usr/lib/rpm/redhat/macros:
%makeinstall \
   make \\\
         prefix=%{?buildroot:%{buildroot}}%{_prefix} \\\
         exec_prefix=%{?buildroot:%{buildroot}}%{_exec_prefix} \\\
         bindir=%{?buildroot:%{buildroot}}%{_bindir} \\\
         sbindir=%{?buildroot:%{buildroot}}%{_sbindir} \\\
         sysconfdir=%{?buildroot:%{buildroot}}%{_sysconfdir} \\\
         datadir=%{?buildroot:%{buildroot}}%{_datadir} \\\
         includedir=%{?buildroot:%{buildroot}}%{_includedir} \\\
         libdir=%{?buildroot:%{buildroot}}%{_libdir} \\\
         libexecdir=%{?buildroot:%{buildroot}}%{_libexecdir} \\\
         localstatedir=%{?buildroot:%{buildroot}}%{_localstatedir} \\\
         sharedstatedir=%{?buildroot:%{buildroot}}%{_sharedstatedir} \\\
         mandir=%{?buildroot:%{buildroot}}%{_mandir} \\\
         infodir=%{?buildroot:%{buildroot}}%{_infodir} \\\
   install

cheers
Harald

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

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

* Re: [PATCH] udev - safer string handling - part three
  2004-02-26  0:31 [PATCH] udev - safer string handling - part two Kay Sievers
                   ` (8 preceding siblings ...)
  2004-03-18 15:01 ` Harald Hoyer
@ 2004-03-26 22:41 ` Kay Sievers
  2004-03-29  8:09 ` Harald Hoyer
  10 siblings, 0 replies; 12+ messages in thread
From: Kay Sievers @ 2004-03-26 22:41 UTC (permalink / raw)
  To: linux-hotplug

On Thu, Mar 18, 2004 at 04:01:28PM +0100, Harald Hoyer wrote:
> Kay Sievers wrote:
> >On Thu, 2004-03-18 at 15:24, Harald Hoyer wrote:
> >
> >>Kay Sievers wrote:
> >>
> >>>udevd needs to be killed after installation, cause the message size
> >>>is changed with this patch.
> >>>Should we do this with the 'make install', like we do with the '.udevdb'?
> >>
> >>Not a good idea in build systems!
> >
> >
> >Oh, I like this style of posts :)
> >It's not killed, if you install it with a DESTDIR.
> >
> >thanks,
> >Kay
> >
> 
> well, well... take care ...
> %makeinstall
> on RedHat/Fedora rpmbuild does not use DESTDIR, though I wish it would...
> 
> 
> /usr/lib/rpm/redhat/macros:
> %makeinstall \
>   make \\\
>         prefix=%{?buildroot:%{buildroot}}%{_prefix} \\\
>         exec_prefix=%{?buildroot:%{buildroot}}%{_exec_prefix} \\\
>         bindir=%{?buildroot:%{buildroot}}%{_bindir} \\\
>         sbindir=%{?buildroot:%{buildroot}}%{_sbindir} \\\
>         sysconfdir=%{?buildroot:%{buildroot}}%{_sysconfdir} \\\
>         datadir=%{?buildroot:%{buildroot}}%{_datadir} \\\
>         includedir=%{?buildroot:%{buildroot}}%{_includedir} \\\
>         libdir=%{?buildroot:%{buildroot}}%{_libdir} \\\
>         libexecdir=%{?buildroot:%{buildroot}}%{_libexecdir} \\\
>         localstatedir=%{?buildroot:%{buildroot}}%{_localstatedir} \\\
>         sharedstatedir=%{?buildroot:%{buildroot}}%{_sharedstatedir} \\\
>         mandir=%{?buildroot:%{buildroot}}%{_mandir} \\\
>         infodir=%{?buildroot:%{buildroot}}%{_infodir} \\\
>   install

Is there something changed in the meantime?
I get the following on FC2 and it doesn't kill udevd while building:

  Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.28298
  + umask 022
  + cd /usr/src/redhat/BUILD
  + cd udev-023
  + make DESTDIR=/var/tmp/udev-023-1-root install 'EXTRAS  extras/scsi_id  '
  sed -e "s:@udevdir@:/udev:" < etc/udev/udev.conf.in > etc/udev/udev.conf
  /usr/bin/install -c -d /var/tmp/udev-023-1-root/etc/udev/

thanks,
Kay


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id\x1470&alloc_id638&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

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

* Re: [PATCH] udev - safer string handling - part three
  2004-02-26  0:31 [PATCH] udev - safer string handling - part two Kay Sievers
                   ` (9 preceding siblings ...)
  2004-03-26 22:41 ` Kay Sievers
@ 2004-03-29  8:09 ` Harald Hoyer
  10 siblings, 0 replies; 12+ messages in thread
From: Harald Hoyer @ 2004-03-29  8:09 UTC (permalink / raw)
  To: linux-hotplug

Kay Sievers wrote:
> Is there something changed in the meantime?
> I get the following on FC2 and it doesn't kill udevd while building:
> 
>   Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.28298
>   + umask 022
>   + cd /usr/src/redhat/BUILD
>   + cd udev-023
>   + make DESTDIR=/var/tmp/udev-023-1-root install 'EXTRAS>   extras/scsi_id  '
>   sed -e "s:@udevdir@:/udev:" < etc/udev/udev.conf.in > etc/udev/udev.conf
>   /usr/bin/install -c -d /var/tmp/udev-023-1-root/etc/udev/
> 
> thanks,
> Kay
> 

No, nothing changed... We use DESTDIR in the spec-file which is IMHO a 
"good thing" :)

I was just raising concerns, that sometimes it is not the way it is 
meant to be.


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id\x1470&alloc_id638&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

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

end of thread, other threads:[~2004-03-29  8:09 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-26  0:31 [PATCH] udev - safer string handling - part two Kay Sievers
2004-02-26  2:22 ` [PATCH] udev - safer string handling - part three Kay Sievers
2004-02-26  4:26 ` [PATCH] udev - safer string handling - part four Kay Sievers
2004-02-26 20:56 ` [PATCH] udev - safer string handling - part two Greg KH
2004-02-26 20:56 ` [PATCH] udev - safer string handling - part three Greg KH
2004-02-26 20:57 ` [PATCH] udev - safer string handling - part four Greg KH
2004-02-26 22:42 ` Kay Sievers
2004-03-18 14:24 ` [PATCH] udev - safer string handling - part three Harald Hoyer
2004-03-18 14:39 ` Kay Sievers
2004-03-18 15:01 ` Harald Hoyer
2004-03-26 22:41 ` Kay Sievers
2004-03-29  8:09 ` Harald Hoyer

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).