[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] Increase max cmdline to 1024 characters.
ChangeSet 1.1692, 2005/06/08 09:34:43+01:00, kaf24@xxxxxxxxxxxxxxxxxxxx Increase max cmdline to 1024 characters. Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx> linux-2.4.30-xen-sparse/arch/xen/kernel/setup.c | 2 +- linux-2.6.11-xen-sparse/arch/xen/i386/kernel/setup.c | 8 +++++--- linux-2.6.11-xen-sparse/arch/xen/x86_64/kernel/setup.c | 9 +++++---- tools/libxc/xc_linux_build.c | 4 ++-- tools/libxc/xc_plan9_build.c | 4 ++-- xen/arch/x86/domain_build.c | 13 ++----------- xen/arch/x86/setup.c | 2 +- xen/include/public/xen.h | 6 +++--- 8 files changed, 21 insertions(+), 27 deletions(-) diff -Nru a/linux-2.4.30-xen-sparse/arch/xen/kernel/setup.c b/linux-2.4.30-xen-sparse/arch/xen/kernel/setup.c --- a/linux-2.4.30-xen-sparse/arch/xen/kernel/setup.c 2005-06-08 06:02:35 -04:00 +++ b/linux-2.4.30-xen-sparse/arch/xen/kernel/setup.c 2005-06-08 06:02:35 -04:00 @@ -113,7 +113,7 @@ /* Raw start-of-day parameters from the hypervisor. */ union xen_start_info_union xen_start_info_union; -#define COMMAND_LINE_SIZE 256 +#define COMMAND_LINE_SIZE MAX_GUEST_CMDLINE static char command_line[COMMAND_LINE_SIZE]; char saved_command_line[COMMAND_LINE_SIZE]; diff -Nru a/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/setup.c b/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/setup.c --- a/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/setup.c 2005-06-08 06:02:36 -04:00 +++ b/linux-2.6.11-xen-sparse/arch/xen/i386/kernel/setup.c 2005-06-08 06:02:36 -04:00 @@ -699,12 +699,14 @@ static void __init parse_cmdline_early (char ** cmdline_p) { char c = ' ', *to = command_line, *from = saved_command_line; - int len = 0; + int len = 0, max_cmdline; int userdef = 0; - memcpy(saved_command_line, xen_start_info.cmd_line, MAX_CMDLINE); + if ((max_cmdline = MAX_GUEST_CMDLINE) > COMMAND_LINE_SIZE) + max_cmdline = COMMAND_LINE_SIZE; + memcpy(saved_command_line, xen_start_info.cmd_line, max_cmdline); /* Save unparsed command line copy for /proc/cmdline */ - saved_command_line[COMMAND_LINE_SIZE-1] = '\0'; + saved_command_line[max_cmdline-1] = '\0'; for (;;) { if (c != ' ') diff -Nru a/linux-2.6.11-xen-sparse/arch/xen/x86_64/kernel/setup.c b/linux-2.6.11-xen-sparse/arch/xen/x86_64/kernel/setup.c --- a/linux-2.6.11-xen-sparse/arch/xen/x86_64/kernel/setup.c 2005-06-08 06:02:35 -04:00 +++ b/linux-2.6.11-xen-sparse/arch/xen/x86_64/kernel/setup.c 2005-06-08 06:02:35 -04:00 @@ -318,12 +318,13 @@ static __init void parse_cmdline_early (char ** cmdline_p) { char c = ' ', *to = command_line, *from = COMMAND_LINE; - int len = 0; + int len = 0, max_cmdline; - memcpy(saved_command_line, xen_start_info.cmd_line, MAX_CMDLINE); + if ((max_cmdline = MAX_GUEST_CMDLINE) > COMMAND_LINE_SIZE) + max_cmdline = COMMAND_LINE_SIZE; + memcpy(saved_command_line, xen_start_info.cmd_line, max_cmdline); /* Save unparsed command line copy for /proc/cmdline */ - memcpy(saved_command_line, COMMAND_LINE, COMMAND_LINE_SIZE); - saved_command_line[COMMAND_LINE_SIZE-1] = '\0'; + saved_command_line[max_cmdline-1] = '\0'; for (;;) { if (c != ' ') diff -Nru a/tools/libxc/xc_linux_build.c b/tools/libxc/xc_linux_build.c --- a/tools/libxc/xc_linux_build.c 2005-06-08 06:02:36 -04:00 +++ b/tools/libxc/xc_linux_build.c 2005-06-08 06:02:36 -04:00 @@ -382,8 +382,8 @@ start_info->mod_start = vinitrd_start; start_info->mod_len = initrd_len; } - strncpy((char *)start_info->cmd_line, cmdline, MAX_CMDLINE); - start_info->cmd_line[MAX_CMDLINE-1] = '\0'; + strncpy((char *)start_info->cmd_line, cmdline, MAX_GUEST_CMDLINE); + start_info->cmd_line[MAX_GUEST_CMDLINE-1] = '\0'; munmap(start_info, PAGE_SIZE); /* shared_info page starts its life empty. */ diff -Nru a/tools/libxc/xc_plan9_build.c b/tools/libxc/xc_plan9_build.c --- a/tools/libxc/xc_plan9_build.c 2005-06-08 06:02:36 -04:00 +++ b/tools/libxc/xc_plan9_build.c 2005-06-08 06:02:36 -04:00 @@ -357,8 +357,8 @@ start_info->flags = 0; DPRINTF((" control event channel is %d\n", control_evtchn)); start_info->domain_controller_evtchn = control_evtchn; - strncpy((char *)start_info->cmd_line, cmdline, MAX_CMDLINE); - start_info->cmd_line[MAX_CMDLINE - 1] = '\0'; + strncpy((char *)start_info->cmd_line, cmdline, MAX_GUEST_CMDLINE); + start_info->cmd_line[MAX_GUEST_CMDLINE - 1] = '\0'; munmap(start_info, PAGE_SIZE); DPRINTF(("done setting up start_info\n")); diff -Nru a/xen/arch/x86/domain_build.c b/xen/arch/x86/domain_build.c --- a/xen/arch/x86/domain_build.c 2005-06-08 06:02:33 -04:00 +++ b/xen/arch/x86/domain_build.c 2005-06-08 06:02:33 -04:00 @@ -74,7 +74,6 @@ unsigned long _initrd_start, unsigned long initrd_len, char *cmdline) { - char *dst; int i, rc; unsigned long pfn, mfn; unsigned long nr_pages; @@ -580,17 +579,9 @@ si->mod_len, si->mod_start); } - dst = (char *)si->cmd_line; + memset(si->cmd_line, 0, sizeof(si->cmd_line)); if ( cmdline != NULL ) - { - for ( i = 0; i < 255; i++ ) - { - if ( cmdline[i] == '\0' ) - break; - *dst++ = cmdline[i]; - } - } - *dst = '\0'; + strncpy(si->cmd_line, cmdline, sizeof(si->cmd_line)-1); /* Reinstate the caller's page tables. */ write_ptbase(current); diff -Nru a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c --- a/xen/arch/x86/setup.c 2005-06-08 06:02:33 -04:00 +++ b/xen/arch/x86/setup.c 2005-06-08 06:02:34 -04:00 @@ -409,7 +409,7 @@ cmdline = (char *)(mod[0].string ? __va(mod[0].string) : NULL); if ( cmdline != NULL ) { - static char dom0_cmdline[256]; + static char dom0_cmdline[MAX_GUEST_CMDLINE]; /* Skip past the image name. */ while ( *cmdline == ' ' ) cmdline++; diff -Nru a/xen/include/public/xen.h b/xen/include/public/xen.h --- a/xen/include/public/xen.h 2005-06-08 06:02:36 -04:00 +++ b/xen/include/public/xen.h 2005-06-08 06:02:36 -04:00 @@ -430,7 +430,7 @@ * extended by an extra 4MB to ensure this. */ -#define MAX_CMDLINE 256 +#define MAX_GUEST_CMDLINE 1024 typedef struct { /* THE FOLLOWING ARE FILLED IN BOTH ON INITIAL BOOT AND ON RESUME. */ memory_t nr_pages; /* 0: Total pages allocated to this domain. */ @@ -451,8 +451,8 @@ _MEMORY_PADDING(F); memory_t mod_len; /* 56: Size (bytes) of pre-loaded module. */ _MEMORY_PADDING(G); - s8 cmd_line[MAX_CMDLINE]; /* 64 */ -} PACKED start_info_t; /* 320 bytes */ + s8 cmd_line[MAX_GUEST_CMDLINE]; /* 64 */ +} PACKED start_info_t; /* 1088 bytes */ /* These flags are passed in the 'flags' field of start_info_t. */ #define SIF_PRIVILEGED (1<<0) /* Is the domain privileged? */ _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |