* [PATCH] Add support for high-entropy-va flag to peflags.
@ 2021-05-15 19:17 Jeremy Drake
2021-05-17 10:54 ` Corinna Vinschen
0 siblings, 1 reply; 4+ messages in thread
From: Jeremy Drake @ 2021-05-15 19:17 UTC (permalink / raw)
To: cygwin-patches
This allows for setting, clearing, and displaying the value of the "high
entropy va" dll characteristics flag.
Signed-off-by: Jeremy Drake <github@jdrake.com>
---
I'm not sure this is the right list for this... I made this patch a while
back and it has been kicking around msys2's rebase package, figured I'd
submit it upstream.
peflags.c | 130 +++++++++++++++++++++++++++++-------------------------
1 file changed, 69 insertions(+), 61 deletions(-)
diff --git a/peflags.c b/peflags.c
index 4d22e4a..358199a 100644
--- a/peflags.c
+++ b/peflags.c
@@ -112,7 +112,7 @@ static const symbolic_flags_t pe_symbolic_flags[] = {
/*CF(0x0004, reserved_0x0004),*/
/*CF(0x0008, reserved_0x0008),*/
/*CF(0x0010, unspec_0x0010),*/
-/*CF(0x0020, unspec_0x0020),*/
+ CF(0x0020, high-entropy-va),
CF(0x0040, dynamicbase),
CF(0x0080, forceinteg),
CF(0x0100, nxcompat),
@@ -180,30 +180,31 @@ sizeof_values_t sizeof_vals[5] = {
#define pulong(struct, offset) (PULONG)((PBYTE)(struct)+(offset))
static struct option long_options[] = {
- {"dynamicbase", optional_argument, NULL, 'd'},
- {"forceinteg", optional_argument, NULL, 'f'},
- {"nxcompat", optional_argument, NULL, 'n'},
- {"no-isolation", optional_argument, NULL, 'i'},
- {"no-seh", optional_argument, NULL, 's'},
- {"no-bind", optional_argument, NULL, 'b'},
- {"wdmdriver", optional_argument, NULL, 'W'},
- {"tsaware", optional_argument, NULL, 't'},
- {"wstrim", optional_argument, NULL, 'w'},
- {"bigaddr", optional_argument, NULL, 'l'},
- {"sepdbg", optional_argument, NULL, 'S'},
- {"stack-reserve",optional_argument, NULL, 'x'},
- {"stack-commit", optional_argument, NULL, 'X'},
- {"heap-reserve", optional_argument, NULL, 'y'},
- {"heap-commit", optional_argument, NULL, 'Y'},
- {"cygwin-heap", optional_argument, NULL, 'z'},
- {"filelist", no_argument, NULL, 'T'},
- {"verbose", no_argument, NULL, 'v'},
- {"help", no_argument, NULL, 'h'},
- {"version", no_argument, NULL, 'V'},
+ {"dynamicbase", optional_argument, NULL, 'd'},
+ {"high-entropy-va", optional_argument, NULL, 'e'},
+ {"forceinteg", optional_argument, NULL, 'f'},
+ {"nxcompat", optional_argument, NULL, 'n'},
+ {"no-isolation", optional_argument, NULL, 'i'},
+ {"no-seh", optional_argument, NULL, 's'},
+ {"no-bind", optional_argument, NULL, 'b'},
+ {"wdmdriver", optional_argument, NULL, 'W'},
+ {"tsaware", optional_argument, NULL, 't'},
+ {"wstrim", optional_argument, NULL, 'w'},
+ {"bigaddr", optional_argument, NULL, 'l'},
+ {"sepdbg", optional_argument, NULL, 'S'},
+ {"stack-reserve", optional_argument, NULL, 'x'},
+ {"stack-commit", optional_argument, NULL, 'X'},
+ {"heap-reserve", optional_argument, NULL, 'y'},
+ {"heap-commit", optional_argument, NULL, 'Y'},
+ {"cygwin-heap", optional_argument, NULL, 'z'},
+ {"filelist", no_argument, NULL, 'T'},
+ {"verbose", no_argument, NULL, 'v'},
+ {"help", no_argument, NULL, 'h'},
+ {"version", no_argument, NULL, 'V'},
{NULL, no_argument, NULL, 0}
};
static const char *short_options
- = "d::f::n::i::s::b::W::t::w::l::S::x::X::y::Y::z::T:vhV";
+ = "d::e::f::n::i::s::b::W::t::w::l::S::x::X::y::Y::z::T:vhV";
static void short_usage (FILE *f);
static void help (FILE *f);
@@ -699,6 +700,11 @@ parse_args (int argc, char *argv[])
optarg,
IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE);
break;
+ case 'e':
+ handle_pe_flag_option (long_options[option_index].name,
+ optarg,
+ IMAGE_DLLCHARACTERISTICS_HIGH_ENTROPY_VA);
+ break;
case 'n':
handle_pe_flag_option (long_options[option_index].name,
optarg,
@@ -1067,45 +1073,47 @@ help (FILE *f)
"given, the specified value will be overwritten; if no argument is given, the\n"
"numerical value will be displayed in decimal and hexadecimal notation.\n"
"\n"
-" -d, --dynamicbase [BOOL] Image base address may be relocated using\n"
-" address space layout randomization (ASLR).\n"
-" -f, --forceinteg [BOOL] Code integrity checks are enforced.\n"
-" -n, --nxcompat [BOOL] Image is compatible with data execution\n"
-" prevention (DEP).\n"
-" -i, --no-isolation [BOOL] Image understands isolation but do not isolate\n"
-" the image.\n"
-" -s, --no-seh [BOOL] Image does not use structured exception handling\n"
-" (SEH). No SE handler may be called in this image.\n"
-" -b, --no-bind [BOOL] Do not bind this image.\n"
-" -W, --wdmdriver [BOOL] Driver uses the WDM model.\n"
-" -t, --tsaware [BOOL] Image is Terminal Server aware.\n"
-" -w, --wstrim [BOOL] Aggressively trim the working set.\n"
-" -l, --bigaddr [BOOL] The application can handle addresses larger\n"
-" than 2 GB.\n"
-" -S, --sepdbg [BOOL] Debugging information was removed and stored\n"
-" separately in another file.\n"
-" -x, --stack-reserve [NUM] Reserved stack size of the process in bytes.\n"
-" -X, --stack-commit [NUM] Initial commited portion of the process stack\n"
-" in bytes.\n"
-" -y, --heap-reserve [NUM] Reserved heap size of the default application\n"
-" heap in bytes. Note that this value has no\n"
-" significant meaning to Cygwin applications.\n"
-" See the -z, --cygwin-heap option instead.\n"
-" -Y, --heap-commit [NUM] Initial commited portion of the default\n"
-" application heap in bytes. Note that this value\n"
-" has no significant meaning to Cygwin applications.\n"
-" See the -z, --cygwin-heap option instead.\n"
-" -z, --cygwin-heap [NUM] Initial reserved heap size of the Cygwin\n"
-" application heap in Megabytes. This value is\n"
-" only evaluated starting with Cygwin 1.7.10.\n"
-" Useful values are between 4 and 2048. If 0,\n"
-" Cygwin uses the default heap size of 384 Megs.\n"
-" Has no meaning for non-Cygwin applications.\n"
-" -T, --filelist FILE Indicate that FILE contains a list\n"
-" of PE files to process\n"
-" -v, --verbose Display diagnostic information\n"
-" -V, --version Display version information\n"
-" -h, --help Display this help\n"
+" -d, --dynamicbase [BOOL] Image base address may be relocated using\n"
+" address space layout randomization (ASLR).\n"
+" -e, --high-entropy-va [BOOL] Image is compatible with 64-bit address space\n"
+" layout randomization (ASLR).\n"
+" -f, --forceinteg [BOOL] Code integrity checks are enforced.\n"
+" -n, --nxcompat [BOOL] Image is compatible with data execution\n"
+" prevention (DEP).\n"
+" -i, --no-isolation [BOOL] Image understands isolation but do not isolate\n"
+" the image.\n"
+" -s, --no-seh [BOOL] Image does not use structured exception handling\n"
+" (SEH). No SE handler may be called in this image.\n"
+" -b, --no-bind [BOOL] Do not bind this image.\n"
+" -W, --wdmdriver [BOOL] Driver uses the WDM model.\n"
+" -t, --tsaware [BOOL] Image is Terminal Server aware.\n"
+" -w, --wstrim [BOOL] Aggressively trim the working set.\n"
+" -l, --bigaddr [BOOL] The application can handle addresses larger\n"
+" than 2 GB.\n"
+" -S, --sepdbg [BOOL] Debugging information was removed and stored\n"
+" separately in another file.\n"
+" -x, --stack-reserve [NUM] Reserved stack size of the process in bytes.\n"
+" -X, --stack-commit [NUM] Initial commited portion of the process stack\n"
+" in bytes.\n"
+" -y, --heap-reserve [NUM] Reserved heap size of the default application\n"
+" heap in bytes. Note that this value has no\n"
+" significant meaning to Cygwin applications.\n"
+" See the -z, --cygwin-heap option instead.\n"
+" -Y, --heap-commit [NUM] Initial commited portion of the default\n"
+" application heap in bytes. Note that this value\n"
+" has no significant meaning to Cygwin applications\n"
+" See the -z, --cygwin-heap option instead.\n"
+" -z, --cygwin-heap [NUM] Initial reserved heap size of the Cygwin\n"
+" application heap in Megabytes. This value is\n"
+" only evaluated starting with Cygwin 1.7.10.\n"
+" Useful values are between 4 and 2048. If 0,\n"
+" Cygwin uses the default heap size of 384 Megs.\n"
+" Has no meaning for non-Cygwin applications.\n"
+" -T, --filelist FILE Indicate that FILE contains a list\n"
+" of PE files to process\n"
+" -v, --verbose Display diagnostic information\n"
+" -V, --version Display version information\n"
+" -h, --help Display this help\n"
"\n"
"BOOL: may be 1, true, or yes - indicates that the flag should be set\n"
" if 0, false, or no - indicates that the flag should be cleared\n"
--
2.31.1.windows.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Add support for high-entropy-va flag to peflags.
2021-05-15 19:17 [PATCH] Add support for high-entropy-va flag to peflags Jeremy Drake
@ 2021-05-17 10:54 ` Corinna Vinschen
2021-05-17 19:15 ` Jeremy Drake
0 siblings, 1 reply; 4+ messages in thread
From: Corinna Vinschen @ 2021-05-17 10:54 UTC (permalink / raw)
To: Jeremy Drake; +Cc: cygwin-patches
Hi Jeremy,
On May 15 12:17, Jeremy Drake via Cygwin-patches wrote:
> This allows for setting, clearing, and displaying the value of the "high
> entropy va" dll characteristics flag.
>
> Signed-off-by: Jeremy Drake <github@jdrake.com>
> ---
> I'm not sure this is the right list for this...
It's not, but given the low traffic, never mind that for this patch.
Thanks for the patch, but I have two nits:
- The patch doesn't apply cleanly with `git am'. Please check again.
- I would prefer a massively reduced patch size, by *not* changing
indentation on otherwise unaffected lines.
I.e., ignore the problem here:
{"dynamicbase", optional_argument, NULL, 'd'},
+ {"high-entropy-va", optional_argument, NULL, 'e'},
...and just add
" -d, --dynamicbase [BOOL] Image base address may be relocated using\n"
+" -e,
+ --high-entropy-va [BOOL] Image is compatible with 64-bit address space\n"
+" layout randomization (ASLR).\n"
With that change I'll apply it and release a new version of rebase soon.
Oh and, btw., there's some problem with DMARC munging with your email
address. Would you mind to attach the git patch instead of inlining
it? I won't accidentally forget to fix your email address in the log
message then :-P
Thanks,
Corinna
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Add support for high-entropy-va flag to peflags.
2021-05-17 10:54 ` Corinna Vinschen
@ 2021-05-17 19:15 ` Jeremy Drake
2021-05-18 7:59 ` Corinna Vinschen
0 siblings, 1 reply; 4+ messages in thread
From: Jeremy Drake @ 2021-05-17 19:15 UTC (permalink / raw)
To: cygwin-patches
[-- Attachment #1: Type: text/plain, Size: 362 bytes --]
On Mon, 17 May 2021, Corinna Vinschen wrote:
> Hi Jeremy,
>
> Thanks for the patch, but I have two nits:
>
> - The patch doesn't apply cleanly with `git am'. Please check again.
Probably got mangled in the mail. Attached this time.
>
> - I would prefer a massively reduced patch size, by *not* changing
> indentation on otherwise unaffected lines.
>
Done
[-- Attachment #2: Type: text/plain, Size: 2661 bytes --]
From 26e7d716b5ecc49cc2e8d5ab05a1586c089c75fe Mon Sep 17 00:00:00 2001
From: Jeremy Drake <cygwin@jdrake.com>
Date: Sat, 15 May 2021 12:07:26 -0700
Subject: [PATCH] Add support for high-entropy-va flag to peflags.
This allows for setting, clearing, and displaying the value of the "high
entropy va" dll characteristics flag.
Signed-off-by: Jeremy Drake <cygwin@jdrake.com>
---
peflags.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/peflags.c b/peflags.c
index 4d22e4a..bb333d7 100644
--- a/peflags.c
+++ b/peflags.c
@@ -112,7 +112,7 @@ static const symbolic_flags_t pe_symbolic_flags[] = {
/*CF(0x0004, reserved_0x0004),*/
/*CF(0x0008, reserved_0x0008),*/
/*CF(0x0010, unspec_0x0010),*/
-/*CF(0x0020, unspec_0x0020),*/
+ CF(0x0020, high-entropy-va),
CF(0x0040, dynamicbase),
CF(0x0080, forceinteg),
CF(0x0100, nxcompat),
@@ -181,6 +181,7 @@ sizeof_values_t sizeof_vals[5] = {
static struct option long_options[] = {
{"dynamicbase", optional_argument, NULL, 'd'},
+ {"high-entropy-va", optional_argument, NULL, 'e'},
{"forceinteg", optional_argument, NULL, 'f'},
{"nxcompat", optional_argument, NULL, 'n'},
{"no-isolation", optional_argument, NULL, 'i'},
@@ -203,7 +204,7 @@ static struct option long_options[] = {
{NULL, no_argument, NULL, 0}
};
static const char *short_options
- = "d::f::n::i::s::b::W::t::w::l::S::x::X::y::Y::z::T:vhV";
+ = "d::e::f::n::i::s::b::W::t::w::l::S::x::X::y::Y::z::T:vhV";
static void short_usage (FILE *f);
static void help (FILE *f);
@@ -699,6 +700,11 @@ parse_args (int argc, char *argv[])
optarg,
IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE);
break;
+ case 'e':
+ handle_pe_flag_option (long_options[option_index].name,
+ optarg,
+ IMAGE_DLLCHARACTERISTICS_HIGH_ENTROPY_VA);
+ break;
case 'n':
handle_pe_flag_option (long_options[option_index].name,
optarg,
@@ -1069,6 +1075,9 @@ help (FILE *f)
"\n"
" -d, --dynamicbase [BOOL] Image base address may be relocated using\n"
" address space layout randomization (ASLR).\n"
+" -e,\n"
+" --high-entropy-va [BOOL] Image is compatible with 64-bit address space\n"
+" layout randomization (ASLR).\n"
" -f, --forceinteg [BOOL] Code integrity checks are enforced.\n"
" -n, --nxcompat [BOOL] Image is compatible with data execution\n"
" prevention (DEP).\n"
--
2.31.1.windows.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Add support for high-entropy-va flag to peflags.
2021-05-17 19:15 ` Jeremy Drake
@ 2021-05-18 7:59 ` Corinna Vinschen
0 siblings, 0 replies; 4+ messages in thread
From: Corinna Vinschen @ 2021-05-18 7:59 UTC (permalink / raw)
To: Jeremy Drake; +Cc: cygwin-patches
On May 17 12:15, Jeremy Drake via Cygwin-patches wrote:
> On Mon, 17 May 2021, Corinna Vinschen wrote:
>
> > Hi Jeremy,
> >
> > Thanks for the patch, but I have two nits:
> >
> > - The patch doesn't apply cleanly with `git am'. Please check again.
>
> Probably got mangled in the mail. Attached this time.
>
> >
> > - I would prefer a massively reduced patch size, by *not* changing
> > indentation on otherwise unaffected lines.
> >
>
> Done
Thank you. Pushed. I'll upload a rebase 4.5.0 release to the Cygwin
distro today.
Thanks,
Corinna
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-05-18 7:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-15 19:17 [PATCH] Add support for high-entropy-va flag to peflags Jeremy Drake
2021-05-17 10:54 ` Corinna Vinschen
2021-05-17 19:15 ` Jeremy Drake
2021-05-18 7:59 ` Corinna Vinschen
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 read-only IMAP folder(s) and NNTP newsgroup(s).