* [PATCH v2 0/3] use wincap in format_proc_cpuinfo for user_shstk
@ 2023-06-07 16:37 Brian Inglis
2023-06-07 16:37 ` [PATCH v2 1/3] wincap.h: add wincap member has_user_shstk Brian Inglis
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Brian Inglis @ 2023-06-07 16:37 UTC (permalink / raw)
To: cygwin-patches
replace Windows version tests with wincap test for AMD/Intel Control flow
Enforcement Technology user mode shadow stack support
Brian Inglis (3):
wincap.h: add wincap member has_user_shstk
wincap.cc: set wincap member has_user_shstk for 2004+
fhandler/proc.cc: use wincap.has_user_shstk
winsup/cygwin/fhandler/proc.cc | 8 ++++----
winsup/cygwin/local_includes/wincap.h | 2 ++
winsup/cygwin/wincap.cc | 10 ++++++++++
3 files changed, 16 insertions(+), 4 deletions(-)
--
2.39.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 1/3] wincap.h: add wincap member has_user_shstk
2023-06-07 16:37 [PATCH v2 0/3] use wincap in format_proc_cpuinfo for user_shstk Brian Inglis
@ 2023-06-07 16:37 ` Brian Inglis
2023-06-07 16:37 ` [PATCH v2 2/3] wincap.cc: set wincap member has_user_shstk for 2004+ Brian Inglis
2023-06-07 16:37 ` [PATCH v2 3/3] fhandler/proc.cc: use wincap.has_user_shstk Brian Inglis
2 siblings, 0 replies; 9+ messages in thread
From: Brian Inglis @ 2023-06-07 16:37 UTC (permalink / raw)
To: cygwin-patches
---
winsup/cygwin/local_includes/wincap.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/winsup/cygwin/local_includes/wincap.h b/winsup/cygwin/local_includes/wincap.h
index 29a7a63de7f6..c14872787ca2 100644
--- a/winsup/cygwin/local_includes/wincap.h
+++ b/winsup/cygwin/local_includes/wincap.h
@@ -32,6 +32,7 @@ struct wincaps
unsigned has_linux_tcp_keepalive_sockopts : 1;
unsigned has_tcp_maxrtms : 1;
unsigned has_con_broken_tabs : 1;
+ unsigned has_user_shstk : 1;
};
};
@@ -84,6 +85,7 @@ public:
bool IMPLEMENT (has_linux_tcp_keepalive_sockopts)
bool IMPLEMENT (has_tcp_maxrtms)
bool IMPLEMENT (has_con_broken_tabs)
+ bool IMPLEMENT (has_user_shstk)
void disable_case_sensitive_dirs ()
{
--
2.39.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 2/3] wincap.cc: set wincap member has_user_shstk for 2004+
2023-06-07 16:37 [PATCH v2 0/3] use wincap in format_proc_cpuinfo for user_shstk Brian Inglis
2023-06-07 16:37 ` [PATCH v2 1/3] wincap.h: add wincap member has_user_shstk Brian Inglis
@ 2023-06-07 16:37 ` Brian Inglis
2023-06-07 16:37 ` [PATCH v2 3/3] fhandler/proc.cc: use wincap.has_user_shstk Brian Inglis
2 siblings, 0 replies; 9+ messages in thread
From: Brian Inglis @ 2023-06-07 16:37 UTC (permalink / raw)
To: cygwin-patches
---
winsup/cygwin/wincap.cc | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/winsup/cygwin/wincap.cc b/winsup/cygwin/wincap.cc
index 91d5d9df8889..30d9c14e8d3b 100644
--- a/winsup/cygwin/wincap.cc
+++ b/winsup/cygwin/wincap.cc
@@ -31,6 +31,7 @@ static const wincaps wincap_8_1 = {
has_linux_tcp_keepalive_sockopts:false,
has_tcp_maxrtms:false,
has_con_broken_tabs:false,
+ has_user_shstk:false,
},
};
@@ -52,6 +53,7 @@ static const wincaps wincap_10_1507 = {
has_linux_tcp_keepalive_sockopts:false,
has_tcp_maxrtms:false,
has_con_broken_tabs:false,
+ has_user_shstk:false,
},
};
@@ -73,6 +75,7 @@ static const wincaps wincap_10_1607 = {
has_linux_tcp_keepalive_sockopts:false,
has_tcp_maxrtms:true,
has_con_broken_tabs:false,
+ has_user_shstk:false,
},
};
@@ -94,6 +97,7 @@ static const wincaps wincap_10_1703 = {
has_linux_tcp_keepalive_sockopts:false,
has_tcp_maxrtms:true,
has_con_broken_tabs:true,
+ has_user_shstk:false,
},
};
@@ -115,6 +119,7 @@ static const wincaps wincap_10_1709 = {
has_linux_tcp_keepalive_sockopts:true,
has_tcp_maxrtms:true,
has_con_broken_tabs:true,
+ has_user_shstk:false,
},
};
@@ -136,6 +141,7 @@ static const wincaps wincap_10_1803 = {
has_linux_tcp_keepalive_sockopts:true,
has_tcp_maxrtms:true,
has_con_broken_tabs:true,
+ has_user_shstk:false,
},
};
@@ -157,6 +163,7 @@ static const wincaps wincap_10_1809 = {
has_linux_tcp_keepalive_sockopts:true,
has_tcp_maxrtms:true,
has_con_broken_tabs:true,
+ has_user_shstk:false,
},
};
@@ -178,6 +185,7 @@ static const wincaps wincap_10_1903 = {
has_linux_tcp_keepalive_sockopts:true,
has_tcp_maxrtms:true,
has_con_broken_tabs:true,
+ has_user_shstk:false,
},
};
@@ -199,6 +207,7 @@ static const wincaps wincap_10_2004 = {
has_linux_tcp_keepalive_sockopts:true,
has_tcp_maxrtms:true,
has_con_broken_tabs:true,
+ has_user_shstk:true,
},
};
@@ -220,6 +229,7 @@ static const wincaps wincap_11 = {
has_linux_tcp_keepalive_sockopts:true,
has_tcp_maxrtms:true,
has_con_broken_tabs:false,
+ has_user_shstk:true,
},
};
--
2.39.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 3/3] fhandler/proc.cc: use wincap.has_user_shstk
2023-06-07 16:37 [PATCH v2 0/3] use wincap in format_proc_cpuinfo for user_shstk Brian Inglis
2023-06-07 16:37 ` [PATCH v2 1/3] wincap.h: add wincap member has_user_shstk Brian Inglis
2023-06-07 16:37 ` [PATCH v2 2/3] wincap.cc: set wincap member has_user_shstk for 2004+ Brian Inglis
@ 2023-06-07 16:37 ` Brian Inglis
2023-06-15 7:11 ` Corinna Vinschen
` (2 more replies)
2 siblings, 3 replies; 9+ messages in thread
From: Brian Inglis @ 2023-06-07 16:37 UTC (permalink / raw)
To: cygwin-patches
---
winsup/cygwin/fhandler/proc.cc | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/winsup/cygwin/fhandler/proc.cc b/winsup/cygwin/fhandler/proc.cc
index 3c79762e0fbd..2eaf436dc122 100644
--- a/winsup/cygwin/fhandler/proc.cc
+++ b/winsup/cygwin/fhandler/proc.cc
@@ -1486,12 +1486,12 @@ format_proc_cpuinfo (void *, char *&destbuf)
/* ftcprint (features1, 6, "split_lock_detect");*//* MSR_TEST_CTRL split lock */
- /* cpuid 0x00000007 ecx & Windows [20]20H1/[20]2004+ */
- if (maxf >= 0x00000007 && wincap.osname () >= "10.0"
- && wincap.build_number () >= 19041)
+ /* Windows [20]20H1/[20]2004/19041 user shadow stack */
+ if (maxf >= 0x00000007 && wincap.has_user_shstk)
{
+ /* cpuid 0x00000007 ecx CET shadow stack */
cpuid (&unused, &unused, &features1, &unused, 0x00000007, 0);
- ftcprint (features1, 7, "user_shstk"); /* "user shadow stack" */
+ ftcprint (features1, 7, "user_shstk"); /* user shadow stack */
}
/* cpuid 0x00000007:1 eax */
--
2.39.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 3/3] fhandler/proc.cc: use wincap.has_user_shstk
2023-06-07 16:37 ` [PATCH v2 3/3] fhandler/proc.cc: use wincap.has_user_shstk Brian Inglis
@ 2023-06-15 7:11 ` Corinna Vinschen
2023-06-16 0:12 ` Brian Inglis
2023-06-16 0:16 ` [PATCH v3 " Brian Inglis
2023-06-16 8:28 ` Corinna Vinschen
2 siblings, 1 reply; 9+ messages in thread
From: Corinna Vinschen @ 2023-06-15 7:11 UTC (permalink / raw)
To: Brian Inglis; +Cc: cygwin-patches
Hi Brian,
thanks, that looks good, except this single snippet:
On Jun 7 10:37, Brian Inglis wrote:
> ---
> winsup/cygwin/fhandler/proc.cc | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/winsup/cygwin/fhandler/proc.cc b/winsup/cygwin/fhandler/proc.cc
> index 3c79762e0fbd..2eaf436dc122 100644
> --- a/winsup/cygwin/fhandler/proc.cc
> +++ b/winsup/cygwin/fhandler/proc.cc
> @@ -1486,12 +1486,12 @@ format_proc_cpuinfo (void *, char *&destbuf)
>
> /* ftcprint (features1, 6, "split_lock_detect");*//* MSR_TEST_CTRL split lock */
>
> - /* cpuid 0x00000007 ecx & Windows [20]20H1/[20]2004+ */
> - if (maxf >= 0x00000007 && wincap.osname () >= "10.0"
> - && wincap.build_number () >= 19041)
> + /* Windows [20]20H1/[20]2004/19041 user shadow stack */
> + if (maxf >= 0x00000007 && wincap.has_user_shstk)
^^^^^^^^^^^^^^^^^^^^^
wincapc::has_user_shstk is a method, accessing the wincaps::has_user_shstk
member. The parens are missing. Consequentially I see an error when
trying to build it:
winsup/cygwin/fhandler/proc.cc:1490:40: error: invalid use of member ‘bool wincapc::has_user_shstk() const’ (did you forget the ‘&’ ?)
1490 | if (maxf >= 0x00000007 && wincap.has_user_shstk)
| ~~~~~~~^~~~~~~~~~~~~~
make[4]: *** [Makefile:2068: fhandler/proc.o] Error 1
Thanks,
Corinna
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2 3/3] fhandler/proc.cc: use wincap.has_user_shstk
2023-06-15 7:11 ` Corinna Vinschen
@ 2023-06-16 0:12 ` Brian Inglis
0 siblings, 0 replies; 9+ messages in thread
From: Brian Inglis @ 2023-06-16 0:12 UTC (permalink / raw)
To: cygwin-patches
On 2023-06-15 01:11, Corinna Vinschen wrote:
> Hi Brian,
>
> thanks, that looks good, except this single snippet:
>
> On Jun 7 10:37, Brian Inglis wrote:
>> ---
>> winsup/cygwin/fhandler/proc.cc | 8 ++++----
>> 1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/winsup/cygwin/fhandler/proc.cc b/winsup/cygwin/fhandler/proc.cc
>> index 3c79762e0fbd..2eaf436dc122 100644
>> --- a/winsup/cygwin/fhandler/proc.cc
>> +++ b/winsup/cygwin/fhandler/proc.cc
>> @@ -1486,12 +1486,12 @@ format_proc_cpuinfo (void *, char *&destbuf)
>>
>> /* ftcprint (features1, 6, "split_lock_detect");*//* MSR_TEST_CTRL split lock */
>>
>> - /* cpuid 0x00000007 ecx & Windows [20]20H1/[20]2004+ */
>> - if (maxf >= 0x00000007 && wincap.osname () >= "10.0"
>> - && wincap.build_number () >= 19041)
>> + /* Windows [20]20H1/[20]2004/19041 user shadow stack */
>> + if (maxf >= 0x00000007 && wincap.has_user_shstk)
> ^^^^^^^^^^^^^^^^^^^^^
>
> wincapc::has_user_shstk is a method, accessing the wincaps::has_user_shstk
> member. The parens are missing. Consequentially I see an error when
> trying to build it:
>
> winsup/cygwin/fhandler/proc.cc:1490:40: error: invalid use of member ‘bool wincapc::has_user_shstk() const’ (did you forget the ‘&’ ?)
> 1490 | if (maxf >= 0x00000007 && wincap.has_user_shstk)
> | ~~~~~~~^~~~~~~~~~~~~~
> make[4]: *** [Makefile:2068: fhandler/proc.o] Error 1
Sorry - yes - that was a thinko caught by the build, and fixed for a redo before
testing.
Then I realized I had made the v2 changes after pulling the main branch instead
of on my local cpuinfo branch, so reset and merged the changes into the
branches, to put them back to where I thought they should be.
It is likely I either failed to commit or wiped the change, before generating
patches, as some git operations still rely on SO answers.
--
Take care. Thanks, Brian Inglis Calgary, Alberta, Canada
La perfection est atteinte Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter not when there is no more to add
mais lorsqu'il n'y a plus rien à retirer but when there is no more to cut
-- Antoine de Saint-Exupéry
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v3 3/3] fhandler/proc.cc: use wincap.has_user_shstk
2023-06-07 16:37 ` [PATCH v2 3/3] fhandler/proc.cc: use wincap.has_user_shstk Brian Inglis
2023-06-15 7:11 ` Corinna Vinschen
@ 2023-06-16 0:16 ` Brian Inglis
2023-06-16 8:28 ` Corinna Vinschen
2 siblings, 0 replies; 9+ messages in thread
From: Brian Inglis @ 2023-06-16 0:16 UTC (permalink / raw)
To: cygwin-patches
---
winsup/cygwin/fhandler/proc.cc | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/winsup/cygwin/fhandler/proc.cc b/winsup/cygwin/fhandler/proc.cc
index 3c79762e0fbd..2eaf436dc122 100644
--- a/winsup/cygwin/fhandler/proc.cc
+++ b/winsup/cygwin/fhandler/proc.cc
@@ -1486,12 +1486,12 @@ format_proc_cpuinfo (void *, char *&destbuf)
/* ftcprint (features1, 6, "split_lock_detect");*//* MSR_TEST_CTRL split lock */
- /* cpuid 0x00000007 ecx & Windows [20]20H1/[20]2004+ */
- if (maxf >= 0x00000007 && wincap.osname () >= "10.0"
- && wincap.build_number () >= 19041)
+ /* Windows [20]20H1/[20]2004/19041 user shadow stack */
+ if (maxf >= 0x00000007 && wincap.has_user_shstk ())
{
+ /* cpuid 0x00000007 ecx CET shadow stack */
cpuid (&unused, &unused, &features1, &unused, 0x00000007, 0);
- ftcprint (features1, 7, "user_shstk"); /* "user shadow stack" */
+ ftcprint (features1, 7, "user_shstk"); /* user shadow stack */
}
/* cpuid 0x00000007:1 eax */
--
2.39.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3 3/3] fhandler/proc.cc: use wincap.has_user_shstk
2023-06-07 16:37 ` [PATCH v2 3/3] fhandler/proc.cc: use wincap.has_user_shstk Brian Inglis
2023-06-15 7:11 ` Corinna Vinschen
2023-06-16 0:16 ` [PATCH v3 " Brian Inglis
@ 2023-06-16 8:28 ` Corinna Vinschen
2023-06-16 8:32 ` Corinna Vinschen
2 siblings, 1 reply; 9+ messages in thread
From: Corinna Vinschen @ 2023-06-16 8:28 UTC (permalink / raw)
To: Brian Inglis; +Cc: cygwin-patches
Hi Brain,
thanks for the patch. Sorry to hassle you again, but I forget to mention
this yesterday and I'm still only partially available. So, here goes:
It would be really great if you could resend your patchset with three
changes in the commit message:
- For obvious reasons, the message text in your cover message won't make
it into the git repo. However, the commit messages in git should
reflect why the change was made, so a future interested reader has
a chance to understand why a change was made.
- As I already mentioned a couple of times on this list (but not
lately), it would be great if you could always add a "Signed-off-by:"
line.
- Also, given this patch fixes an earlier patch, it should contain
a line
Fixes: <12-digit-SHA1> ("commit headline")
In this case, patch 3 of the series should contain
Fixes: 41fdb869f998 ("fhandler/proc.cc(format_proc_cpuinfo): Add Linux 6.3 cpuinfo")
Thanks,
Corinna
On Jun 15 18:16, Brian Inglis wrote:
> ---
> winsup/cygwin/fhandler/proc.cc | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/winsup/cygwin/fhandler/proc.cc b/winsup/cygwin/fhandler/proc.cc
> index 3c79762e0fbd..2eaf436dc122 100644
> --- a/winsup/cygwin/fhandler/proc.cc
> +++ b/winsup/cygwin/fhandler/proc.cc
> @@ -1486,12 +1486,12 @@ format_proc_cpuinfo (void *, char *&destbuf)
>
> /* ftcprint (features1, 6, "split_lock_detect");*//* MSR_TEST_CTRL split lock */
>
> - /* cpuid 0x00000007 ecx & Windows [20]20H1/[20]2004+ */
> - if (maxf >= 0x00000007 && wincap.osname () >= "10.0"
> - && wincap.build_number () >= 19041)
> + /* Windows [20]20H1/[20]2004/19041 user shadow stack */
> + if (maxf >= 0x00000007 && wincap.has_user_shstk ())
> {
> + /* cpuid 0x00000007 ecx CET shadow stack */
> cpuid (&unused, &unused, &features1, &unused, 0x00000007, 0);
> - ftcprint (features1, 7, "user_shstk"); /* "user shadow stack" */
> + ftcprint (features1, 7, "user_shstk"); /* user shadow stack */
> }
>
> /* cpuid 0x00000007:1 eax */
> --
> 2.39.0
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v3 3/3] fhandler/proc.cc: use wincap.has_user_shstk
2023-06-16 8:28 ` Corinna Vinschen
@ 2023-06-16 8:32 ` Corinna Vinschen
0 siblings, 0 replies; 9+ messages in thread
From: Corinna Vinschen @ 2023-06-16 8:32 UTC (permalink / raw)
To: Brian Inglis; +Cc: cygwin-patches
On Jun 16 10:28, Corinna Vinschen wrote:
> Hi Brain,
>
>
> thanks for the patch. Sorry to hassle you again, but I forget to mention
> this yesterday and I'm still only partially available. So, here goes:
>
> It would be really great if you could resend your patchset with three
> changes in the commit message:
>
> - For obvious reasons, the message text in your cover message won't make
> it into the git repo. However, the commit messages in git should
> reflect why the change was made, so a future interested reader has
> a chance to understand why a change was made.
Along these lines, given this patch fixes another one, the message text
should ideally outline what was wrong with the original patch and that
the new method doing things fixes it.
>
> - As I already mentioned a couple of times on this list (but not
> lately), it would be great if you could always add a "Signed-off-by:"
> line.
>
> - Also, given this patch fixes an earlier patch, it should contain
> a line
>
> Fixes: <12-digit-SHA1> ("commit headline")
>
> In this case, patch 3 of the series should contain
>
> Fixes: 41fdb869f998 ("fhandler/proc.cc(format_proc_cpuinfo): Add Linux 6.3 cpuinfo")
>
>
> Thanks,
> Corinna
>
>
> On Jun 15 18:16, Brian Inglis wrote:
> > ---
> > winsup/cygwin/fhandler/proc.cc | 8 ++++----
> > 1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/winsup/cygwin/fhandler/proc.cc b/winsup/cygwin/fhandler/proc.cc
> > index 3c79762e0fbd..2eaf436dc122 100644
> > --- a/winsup/cygwin/fhandler/proc.cc
> > +++ b/winsup/cygwin/fhandler/proc.cc
> > @@ -1486,12 +1486,12 @@ format_proc_cpuinfo (void *, char *&destbuf)
> >
> > /* ftcprint (features1, 6, "split_lock_detect");*//* MSR_TEST_CTRL split lock */
> >
> > - /* cpuid 0x00000007 ecx & Windows [20]20H1/[20]2004+ */
> > - if (maxf >= 0x00000007 && wincap.osname () >= "10.0"
> > - && wincap.build_number () >= 19041)
> > + /* Windows [20]20H1/[20]2004/19041 user shadow stack */
> > + if (maxf >= 0x00000007 && wincap.has_user_shstk ())
> > {
> > + /* cpuid 0x00000007 ecx CET shadow stack */
> > cpuid (&unused, &unused, &features1, &unused, 0x00000007, 0);
> > - ftcprint (features1, 7, "user_shstk"); /* "user shadow stack" */
> > + ftcprint (features1, 7, "user_shstk"); /* user shadow stack */
> > }
> >
> > /* cpuid 0x00000007:1 eax */
> > --
> > 2.39.0
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2023-06-16 8:32 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-07 16:37 [PATCH v2 0/3] use wincap in format_proc_cpuinfo for user_shstk Brian Inglis
2023-06-07 16:37 ` [PATCH v2 1/3] wincap.h: add wincap member has_user_shstk Brian Inglis
2023-06-07 16:37 ` [PATCH v2 2/3] wincap.cc: set wincap member has_user_shstk for 2004+ Brian Inglis
2023-06-07 16:37 ` [PATCH v2 3/3] fhandler/proc.cc: use wincap.has_user_shstk Brian Inglis
2023-06-15 7:11 ` Corinna Vinschen
2023-06-16 0:12 ` Brian Inglis
2023-06-16 0:16 ` [PATCH v3 " Brian Inglis
2023-06-16 8:28 ` Corinna Vinschen
2023-06-16 8:32 ` 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).