From: Tsillas, D. J <jts...@en...> - 2004-10-06 12:51:08
|
Using 2.6.9-rc2-mm4 with the incrementals. If CONFIG_MODE_TT is enabled and linux is run with no args. The value of argv[1] is 0 causing a crash with strlen in linux_main: 349 #ifdef CONFIG_MODE_TT 350 argv1_begin =3D argv[1]; 351 argv1_end =3D &argv[1][strlen(argv[1])]; 352 #endif BTW, I've had problems building with CONFIG_MODE_TT turned off: |
From: BlaisorBlade <bla...@ya...> - 2004-10-09 16:06:09
|
On Wednesday 06 October 2004 14:49, Tsillas, Demetrios J wrote: > Using 2.6.9-rc2-mm4 with the incrementals. > > If CONFIG_MODE_TT is enabled and linux is run with > no args. The value of argv[1] is 0 causing a crash > with strlen in linux_main: > > 349 #ifdef CONFIG_MODE_TT > 350 argv1_begin = argv[1]; > 351 argv1_end = &argv[1][strlen(argv[1])]; > 352 #endif False. Running linux with no args causes it complaining because you did not say him which root fs to use: VFS: Cannot open root device "98:0" or unknown-block(98,0) Please append a correct "root=" boot option Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(98,0) Also, more important, argv[1] is 0 and in that case strlen(argv[1]) will be 0, so argv1_end will be equal to argv1_begin. Since argv1_end is a pointer at the first byte out of argv[1], then we are safe. For instance: void set_cmdline(char *cmd) { #ifdef CONFIG_MODE_TT char *umid, *ptr; if(CHOOSE_MODE(honeypot, 0)) return; umid = get_umid(1); if(umid != NULL){ snprintf(argv1_begin, (argv1_end - argv1_begin) * sizeof(*ptr), "(%s) ", umid); ptr = &argv1_begin[strlen(argv1_begin)]; } else ptr = argv1_begin; snprintf(ptr, (argv1_end - ptr) * sizeof(*ptr), "[%s]", cmd); memset(argv1_begin + strlen(argv1_begin), '\0', argv1_end - argv1_begin - strlen(argv1_begin)); #endif } > BTW, I've had problems building with CONFIG_MODE_TT > turned off: I'm going to try myself and fix the problems. Bye -- Paolo Giarrusso, aka Blaisorblade Linux registered user n. 292729 |