Hello community, here is the log from the commit of package linuxrc for openSUSE:Factory checked in at 2020-10-29 09:22:20 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/linuxrc (Old) and /work/SRC/openSUSE:Factory/.linuxrc.new.3463 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "linuxrc" Thu Oct 29 09:22:20 2020 rev:287 rq:844638 version:7.0.21 Changes: -------- --- /work/SRC/openSUSE:Factory/linuxrc/linuxrc.changes 2020-06-27 23:22:09.449738880 +0200 +++ /work/SRC/openSUSE:Factory/.linuxrc.new.3463/linuxrc.changes 2020-10-29 09:22:22.630691834 +0100 @@ -1,0 +2,23 @@ +Wed Oct 28 16:00:05 UTC 2020 - [email protected] + +- merge gh#openSUSE/linuxrc#232 +- fix linuxrc module option parsing +- 7.0.21 + +-------------------------------------------------------------------- +Wed Oct 28 15:21:50 UTC 2020 - [email protected] + +- merge gh#openSUSE/linuxrc#231 +- add insmod.pre option to linuxrc (bsc#1174912) +- fix potential buffer overflow (correctly detected by gcc) +- don't use modprobe before modprobe config files are available +- 7.0.20 + +-------------------------------------------------------------------- +Fri Oct 23 11:22:25 UTC 2020 - [email protected] + +- merge gh#openSUSE/linuxrc#230 +- add rfc2132 keyword to ifcfg option (jsc#SLE-15770, jsc#SLE-15488) +- 7.0.19 + +-------------------------------------------------------------------- Old: ---- linuxrc-7.0.18.tar.xz New: ---- linuxrc-7.0.21.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ linuxrc.spec ++++++ --- /var/tmp/diff_new_pack.OuNnvh/_old 2020-10-29 09:22:23.350692525 +0100 +++ /var/tmp/diff_new_pack.OuNnvh/_new 2020-10-29 09:22:23.354692528 +0100 @@ -17,7 +17,7 @@ Name: linuxrc -Version: 7.0.18 +Version: 7.0.21 Release: 0 Summary: SUSE Installation Program License: GPL-3.0+ ++++++ linuxrc-7.0.18.tar.xz -> linuxrc-7.0.21.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-7.0.18/VERSION new/linuxrc-7.0.21/VERSION --- old/linuxrc-7.0.18/VERSION 2020-06-24 14:01:57.000000000 +0200 +++ new/linuxrc-7.0.21/VERSION 2020-10-28 17:00:05.000000000 +0100 @@ -1 +1 @@ -7.0.18 +7.0.21 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-7.0.18/changelog new/linuxrc-7.0.21/changelog --- old/linuxrc-7.0.18/changelog 2020-06-24 14:01:57.000000000 +0200 +++ new/linuxrc-7.0.21/changelog 2020-10-28 17:00:05.000000000 +0100 @@ -1,3 +1,17 @@ +2020-10-28: 7.0.21 + - merge gh#openSUSE/linuxrc#232 + - fix linuxrc module option parsing + +2020-10-28: 7.0.20 + - merge gh#openSUSE/linuxrc#231 + - add insmod.pre option to linuxrc (bsc#1174912) + - fix potential buffer overflow (correctly detected by gcc) + - don't use modprobe before modprobe config files are available + +2020-10-23: 7.0.19 + - merge gh#openSUSE/linuxrc#230 + - add rfc2132 keyword to ifcfg option (jsc#SLE-15770, jsc#SLE-15488) + 2020-06-24: 7.0.18 - merge gh#openSUSE/linuxrc#225 - s390: set rd.zdev=no-auto if auto-config has been turned off diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-7.0.18/file.c new/linuxrc-7.0.21/file.c --- old/linuxrc-7.0.18/file.c 2020-06-24 14:01:57.000000000 +0200 +++ new/linuxrc-7.0.21/file.c 2020-10-28 17:00:05.000000000 +0100 @@ -77,6 +77,7 @@ { key_language, "lang", kf_cfg + kf_cmd }, { key_rebootmsg, "RebootMsg", kf_yast }, { key_insmod, "Insmod", kf_cfg + kf_cmd1 }, + { key_insmod_pre, "InsmodPre", kf_cfg + kf_cmd0 }, { key_display, "Display", kf_cfg + kf_cmd }, { key_ip, "IP", kf_none }, { key_netmask, "Netmask", kf_cfg + kf_cmd + kf_dhcp }, @@ -641,6 +642,7 @@ switch(f->key) { case key_insmod: + case key_insmod_pre: file_module_load(f->value); break; @@ -1325,25 +1327,36 @@ if(*f->value) str_copy(&config.rootimage2, f->value); break; - case key_none: case key_is_ptoption: - if((flags & (kf_cmd + kf_cfg))) { - for(sl = config.ptoptions; sl; sl = sl->next) { - if(!strcasecmpignorestrich(sl->key, f->key_str)) { - str_copy(&sl->value, f->value); - f->key = key_is_ptoption; - break; - } + // store option value + for(sl = config.ptoptions; sl; sl = sl->next) { + if(!strcasecmpignorestrich(sl->key, f->key_str)) { + str_copy(&sl->value, f->value); + break; } } + break; + + case key_none: + /* + * Do interpretation of module.foo=bar in command line only once + * (with kf_cmd_early) - the outcome would not change doing it again. + */ + if(!(flags & kf_cmd_early)) break; - /* was user defined option */ - if(f->key == key_is_ptoption) break; + /* it must not look like any of the linuxrc options */ + if(file_str2key(f->key_str, kf_all) != key_none) break; - /* assume kernel module option if it can be parsed as 'module.option' */ + log_debug("parser: =0x%02x= =%d:%s= =%s= >%s<\n", flags, f->key, f->key_str, f->value, f->unparsed); - /* Note: f->unparsed is only set when we read from cmdline/argv *NOT* from files. */ - if((flags & kf_cmd_early) && (s1 = f->unparsed)) { + /* + * Assume it is a kernel module option if it can be parsed as + * 'module.option'. + * + * Note: f->unparsed is only set when reading from cmdline/argv, not + * from files. + */ + if((s1 = f->unparsed)) { i = strlen(f->unparsed); if(s1[0] == '"' && s1[i - 1] == '"') { s1[i - 1] = 0; @@ -1358,7 +1371,7 @@ break; } - /* continue with key_options */ + /* fall through to key_options */ case key_options: if(*f->value) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-7.0.18/file.h new/linuxrc-7.0.21/file.h --- old/linuxrc-7.0.18/file.h 2020-06-24 14:01:57.000000000 +0200 +++ new/linuxrc-7.0.21/file.h 2020-10-28 17:00:05.000000000 +0100 @@ -57,10 +57,11 @@ key_nanny, key_vlanid, key_sshkey, key_systemboot, key_sethostname, key_debugshell, key_self_update, key_ibft_devices, key_linuxrc_core, key_norepo, key_auto_assembly, key_autoyast_parse, - key_device_auto_config, key_autoyast_passurl, key_rd_zdev + key_device_auto_config, key_autoyast_passurl, key_rd_zdev, key_insmod_pre } file_key_t; typedef enum { + kf_all = -1, kf_none = 0, kf_cfg = 1 << 0, /**< /linuxrc.config & /info */ kf_cmd = 1 << 1, /**< /proc/cmdline, after info */ @@ -69,10 +70,11 @@ kf_dhcp = 1 << 4, /**< dhcp info file */ kf_mem = 1 << 5, /**< /proc/meminfo */ kf_boot = 1 << 6, /**< things the boot loader used */ - kf_cmd1 = 1 << 7, /**< between cmd_early and start of hw detection */ + kf_cmd1 = 1 << 7, /**< between starting udevd and starting hw detection */ kf_ibft = 1 << 8, /**< ibft values (iSCSI BIOS) */ kf_cont = 1 << 9, /**< 'content' file */ - kf_comma = 1 << 10 /**< accept commas as option separator (in command line syntax) */ + kf_comma = 1 << 10, /**< accept commas as option separator (in command line syntax) */ + kf_cmd0 = 1 << 11, /**< between cmd_early and starting udevd */ } file_key_flag_t; typedef struct file_s { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-7.0.18/global.h new/linuxrc-7.0.21/global.h --- old/linuxrc-7.0.18/global.h 2020-06-24 14:01:57.000000000 +0200 +++ new/linuxrc-7.0.21/global.h 2020-10-28 17:00:05.000000000 +0100 @@ -320,6 +320,7 @@ unsigned pattern:1; ///< 'device' is shell glob unsigned ptp:1; ///< ptp config, gw is ptp peer unsigned search:1; ///< whether "try" feature is enabled for this ifcfg + unsigned rfc2132:1; ///< set DHCLIENT_CREATE_CID=rfc2132 int netmask_prefix; ///< prefix given via netmask option and only used if an ip doen't have one char *vlan; ///< vlan id, if any char *ip; ///< list of ip addresses, space separated @@ -611,6 +612,7 @@ driver_t *drivers; /**< list of extra drive info */ unsigned disks:1; /**< automatically ask for module disks */ slist_t *options; /**< potential module parameters */ + unsigned modprobe_ok:1; /**< if set, using modprobe is possible */ } module; struct { /**< Note: all memory sizes are now in bytes */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-7.0.18/install.c new/linuxrc-7.0.21/install.c --- old/linuxrc-7.0.18/install.c 2020-06-24 14:01:57.000000000 +0200 +++ new/linuxrc-7.0.21/install.c 2020-10-28 17:00:05.000000000 +0100 @@ -474,7 +474,9 @@ char **items3, **values3; char *type; slist_t *sl; - char buf[256], *dev; + // buf[] must be able to hold a command (of fixed known length) + filename[256], + // so make a bit larger than 256 + char buf[512], *dev; int found = 0, item_mk_part = 0, item_mk_file = 0; char *s, *tmp = NULL; static char *last_part = NULL; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-7.0.18/linuxrc.c new/linuxrc-7.0.21/linuxrc.c --- old/linuxrc-7.0.18/linuxrc.c 2020-06-24 14:01:57.000000000 +0200 +++ new/linuxrc-7.0.21/linuxrc.c 2020-10-28 17:00:05.000000000 +0100 @@ -854,6 +854,9 @@ lxrc_add_parts(); } + // modprobe config files exist from here on + config.module.modprobe_ok = 1; + config.platform_name=get_platform_name(); util_get_releasever(); @@ -959,6 +962,12 @@ gm->tm_year + 1900, gm->tm_mon + 1, gm->tm_mday, gm->tm_hour, gm->tm_min, gm->tm_sec ); + /* + * Do what has to be done before udevd starts; atm this is just the + * insmod.pre option. + */ + file_read_info_file("cmdline", kf_cmd0); + if(!config.test) { log_show("Starting udev... "); util_run_script("udev_setup"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-7.0.18/module.c new/linuxrc-7.0.21/module.c --- old/linuxrc-7.0.18/module.c 2020-06-24 14:01:57.000000000 +0200 +++ new/linuxrc-7.0.21/module.c 2020-10-28 17:00:05.000000000 +0100 @@ -692,10 +692,20 @@ if(mod_is_loaded(module)) return 0; - buf_len = sprintf(buf, "insmod %s", config.forceinsmod ? "-f " : ""); + /* + * When loading a module before linuxrc's module loading framework has + * been initialized, use modprobe instead of insmod as module deps are not + * yet known to linuxrc. + */ + unsigned use_modprobe = config.module.modprobe_ok && (config.module.list ? 0 : 1); - if (util_check_exist(module)) { - /* wow, user provided a _path_ */ + buf_len = sprintf(buf, "%s %s", + use_modprobe ? "modprobe" : "insmod", + config.forceinsmod ? "-f " : "" + ); + + /* insmod expects a full path as argument, modprobe not */ + if (use_modprobe || util_check_exist(module)) { strcpy(buf + buf_len, module); } else { if(!mod_find_module(config.module.dir, module, buf + buf_len)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/linuxrc-7.0.18/net.c new/linuxrc-7.0.21/net.c --- old/linuxrc-7.0.18/net.c 2020-06-24 14:01:57.000000000 +0200 +++ new/linuxrc-7.0.21/net.c 2020-10-28 17:00:05.000000000 +0100 @@ -2070,6 +2070,10 @@ sl = slist_append_str(&sl_ifcfg, "ETHERDEVICE"); str_copy(&sl->value, device); } + if(ifcfg->rfc2132) { + sl = slist_append_str(&sl_ifcfg, "DHCLIENT_CREATE_CID"); + str_copy(&sl->value, "rfc2132"); + } } // 2. create ifcfg entries @@ -2387,7 +2391,11 @@ slist_t *sl, *sl0, *slx; ifcfg_t *ifcfg; char *s, *t; - int try_shift = 0; // try keyword is optional, so position of following params can vary + /* + * optional keywords "dhcp", "dhcp4", "dhcp6", "try", "rfc2132" move the + * position of following params + */ + int option_shift = 0; if(!str) return NULL; @@ -2422,38 +2430,53 @@ str_copy(&ifcfg->device, s); } - s = slist_key(sl0, 1); - if(s && (strncmp(s, "try", sizeof "try" -1) == 0)) - { - log_debug("Will try to detect interface with access to installation"); + // parse optional keywords (in any order) + while((s = slist_key(sl0, 1 + option_shift))) { + if(!strcmp(s, "dhcp") || !strcmp(s, "dhcp4") || !strcmp(s, "dhcp6")) { + str_copy(&ifcfg->type, s); + ifcfg->dhcp = 1; - ifcfg->search = 1; - try_shift = 1; + option_shift++; + continue; + } - s = slist_key(sl0, 2); - } + if(!strcmp(s, "try")) { + log_debug("Will try to detect interface with access to installation"); + ifcfg->search = 1; + + option_shift++; + continue; + } - if(s && !strncmp(s, "dhcp", sizeof "dhcp" - 1)) { - str_copy(&ifcfg->type, s); - ifcfg->dhcp = 1; + if(!strcmp(s, "rfc2132")) { + ifcfg->rfc2132 = 1; + + option_shift++; + continue; + } + + break; } - else { + + // if not dhcp, get static config options + if(!ifcfg->dhcp) { str_copy(&ifcfg->type, "static"); t = NULL; if(s && *s && !(t = strchr(s, '='))) str_copy(&ifcfg->ip, s); - s = slist_key(sl0, 2 + try_shift); + s = slist_key(sl0, 2 + option_shift); if(!t && s && *s && !(t = strchr(s, '='))) str_copy(&ifcfg->gw, s); - s = slist_key(sl0, 3 + try_shift); + s = slist_key(sl0, 3 + option_shift); if(!t && s && *s && !(t = strchr(s, '='))) str_copy(&ifcfg->ns, s); - s = slist_key(sl0, 4 + try_shift); + s = slist_key(sl0, 4 + option_shift); if(!t && s && *s && !(t = strchr(s, '='))) str_copy(&ifcfg->domain, s); } + // get anything in the form of FOO=bar to be put directly into ifcfg file for(sl = sl0->next; sl; sl = sl->next) { if((t = strchr(sl->key, '='))) { *t++ = 0; @@ -2465,6 +2488,7 @@ slist_free(sl0); + // decide if device spec refers to a device name or a pattern to match if(ifcfg->device) { for(s = ifcfg->device; *s; s++) { if(!isalnum(*s) && *s != '_') { @@ -2526,10 +2550,10 @@ if(ifcfg->vlan) strprintf(&buf, "%s vlan = %s\n", buf, ifcfg->vlan); if(ifcfg->type) strprintf(&buf, "%s type = %s\n", buf, ifcfg->type); strprintf(&buf, - "%s dhcp = %u, pattern = %u, used = %u, prefix = %d, ptp = %u, search = %u\n", + "%s dhcp = %u, pattern = %u, used = %u, prefix = %d, ptp = %u, search = %u, rfc2132 = %u\n", buf, ifcfg->dhcp, ifcfg->pattern, ifcfg->used, - ifcfg->netmask_prefix, ifcfg->ptp, ifcfg->search + ifcfg->netmask_prefix, ifcfg->ptp, ifcfg->search, ifcfg->rfc2132 ); if(ifcfg->ip) strprintf(&buf, "%s ip = %s\n", buf, ifcfg->ip); if(ifcfg->gw) strprintf(&buf, "%s gw = %s\n", buf, ifcfg->gw);
