diff options
author | CoprDistGit <infra@openeuler.org> | 2024-08-03 06:28:41 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2024-08-03 06:28:41 +0000 |
commit | d20db0561a6a36f914fde030512503b114ef9a0c (patch) | |
tree | d4e5e3494d95c269a1cee6195f11bf3201bcadbf /elf-ld.so-prohibit-multiple-i-options-and-do-not-allow-i-speci.patch | |
parent | 016343d99b1b269d7246ef1e143d4b54914433d4 (diff) |
automatic import of glibcopeneuler22.03_LTS_SP4openeuler22.03_LTS_SP3openeuler20.03
Diffstat (limited to 'elf-ld.so-prohibit-multiple-i-options-and-do-not-allow-i-speci.patch')
-rw-r--r-- | elf-ld.so-prohibit-multiple-i-options-and-do-not-allow-i-speci.patch | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/elf-ld.so-prohibit-multiple-i-options-and-do-not-allow-i-speci.patch b/elf-ld.so-prohibit-multiple-i-options-and-do-not-allow-i-speci.patch new file mode 100644 index 0000000..0422a5c --- /dev/null +++ b/elf-ld.so-prohibit-multiple-i-options-and-do-not-allow-i-speci.patch @@ -0,0 +1,54 @@ + +From f46625e444f2bbab110e217a34abd0898a242c11 Mon Sep 17 00:00:00 2001 +From: chenziyang <chenziyang4@huawei.com> +Date: Sun, 5 Mar 2023 17:04:09 +0800 +Subject: [PATCH 2/2] prohibit multiple -i options and do not allow -i specify non + PT_LOAD segment + +Signed-off-by: Chen Ziyang<chenziyang4@huawei.com> + +--- + elf/hugepageedit.c | 13 ++++++++++++- + 1 file changed, 12 insertions(+), 1 deletion(-) + +diff --git a/elf/hugepageedit.c b/elf/hugepageedit.c +index 0a44ece6..38b4db70 100644 +--- a/elf/hugepageedit.c ++++ b/elf/hugepageedit.c +@@ -75,7 +75,7 @@ int main(int argc, char *argv[]) + size_t length; + int exit_status = -1; + int i, opt, delete = 0, exec_only = 0, index_set = 0; +- long index = -1; ++ long index = -1, index_count = 0; + while ((opt = getopt(argc, argv, "dxi:")) != -1) + { + switch (opt) +@@ -91,6 +91,11 @@ int main(int argc, char *argv[]) + index_set = 1; + if (index < 0) + return -1; ++ index_count++; ++ if (index_count > 1) { ++ fprintf(stderr, "too many -i options in command line\n"); ++ return -1; ++ } + break; + default: + print_usage(); +@@ -150,6 +155,12 @@ int main(int argc, char *argv[]) + continue; + phdr[i].p_flags |= PF_HUGEPAGE; + } ++ } else { ++ if (index_set && index == i) { ++ fprintf(stderr, "Index %ld in -i %s option is not a PT_LOAD segment\n", ++ index, argv[optind]); ++ goto unmap; ++ } + } + } + exit_status = 0; +-- +2.33.0 + |