Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1393138 > unrolled thread
| Started by | tip-bot for Stas Sergeev <tipbot@zytor.com> |
|---|---|
| First post | 2016-05-03 10:00 +0200 |
| Last post | 2016-05-03 18:50 +0200 |
| Articles | 4 — 3 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[tip:core/signals] signals/sigaltstack: Prepare to add new SS_xxx flags tip-bot for Stas Sergeev <tipbot@zytor.com> - 2016-05-03 10:00 +0200
Re: [tip:core/signals] signals/sigaltstack: Prepare to add new SS_xxx flags Borislav Petkov <bp@alien8.de> - 2016-05-03 12:00 +0200
Re: [tip:core/signals] signals/sigaltstack: Prepare to add new SS_xxx flags Andy Lutomirski <luto@amacapital.net> - 2016-05-03 18:20 +0200
Re: [tip:core/signals] signals/sigaltstack: Prepare to add new SS_xxx flags Andy Lutomirski <luto@amacapital.net> - 2016-05-03 18:50 +0200
| From | tip-bot for Stas Sergeev <tipbot@zytor.com> |
|---|---|
| Date | 2016-05-03 10:00 +0200 |
| Subject | [tip:core/signals] signals/sigaltstack: Prepare to add new SS_xxx flags |
| Message-ID | <ruDpo-3Rg-13@gated-at.bofh.it> |
Commit-ID: 407bc16ad1769f5cb8ad9555611cb198187ef4cd
Gitweb: http://git.kernel.org/tip/407bc16ad1769f5cb8ad9555611cb198187ef4cd
Author: Stas Sergeev <stsp@list.ru>
AuthorDate: Thu, 14 Apr 2016 23:20:03 +0300
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 3 May 2016 08:37:59 +0200
signals/sigaltstack: Prepare to add new SS_xxx flags
This patch adds SS_FLAG_BITS - the mask that splits sigaltstack
mode values and bit-flags. Since there is no bit-flags yet, the
mask is defined to 0. The flags are added by subsequent patches.
With every new flag, the mask should have the appropriate bit cleared.
This makes sure if some flag is tried on a kernel that doesn't
support it, the -EINVAL error will be returned, because such a
flag will be treated as an invalid mode rather than the bit-flag.
That way the existence of the particular features can be probed
at run-time.
This change was suggested by Andy Lutomirski:
https://lkml.org/lkml/2016/3/6/158
Signed-off-by: Stas Sergeev <stsp@list.ru>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Amanieu d'Antras <amanieu@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Pavel Emelyanov <xemul@parallels.com>
Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Richard Weinberger <richard@nod.at>
Cc: Sasha Levin <sasha.levin@oracle.com>
Cc: Shuah Khan <shuahkh@osg.samsung.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Vladimir Davydov <vdavydov@parallels.com>
Cc: linux-api@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Link: http://lkml.kernel.org/r/1460665206-13646-3-git-send-email-stsp@list.ru
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
include/uapi/linux/signal.h | 3 +++
kernel/signal.c | 16 ++++++----------
2 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/include/uapi/linux/signal.h b/include/uapi/linux/signal.h
index e1bd50c2..7c73165 100644
--- a/include/uapi/linux/signal.h
+++ b/include/uapi/linux/signal.h
@@ -7,4 +7,7 @@
#define SS_ONSTACK 1
#define SS_DISABLE 2
+/* mask for all SS_xxx flags */
+#define SS_FLAG_BITS 0
+
#endif /* _UAPI_LINUX_SIGNAL_H */
diff --git a/kernel/signal.c b/kernel/signal.c
index aa9bf00..b1c6eb4 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -3104,7 +3104,8 @@ do_sigaltstack (const stack_t __user *uss, stack_t __user *uoss, unsigned long s
if (uss) {
void __user *ss_sp;
size_t ss_size;
- int ss_flags;
+ unsigned ss_flags;
+ int ss_mode;
error = -EFAULT;
if (!access_ok(VERIFY_READ, uss, sizeof(*uss)))
@@ -3119,18 +3120,13 @@ do_sigaltstack (const stack_t __user *uss, stack_t __user *uoss, unsigned long s
if (on_sig_stack(sp))
goto out;
+ ss_mode = ss_flags & ~SS_FLAG_BITS;
error = -EINVAL;
- /*
- * Note - this code used to test ss_flags incorrectly:
- * old code may have been written using ss_flags==0
- * to mean ss_flags==SS_ONSTACK (as this was the only
- * way that worked) - this fix preserves that older
- * mechanism.
- */
- if (ss_flags != SS_DISABLE && ss_flags != SS_ONSTACK && ss_flags != 0)
+ if (ss_mode != SS_DISABLE && ss_mode != SS_ONSTACK &&
+ ss_mode != 0)
goto out;
- if (ss_flags == SS_DISABLE) {
+ if (ss_mode == SS_DISABLE) {
ss_size = 0;
ss_sp = NULL;
} else {
[toc] | [next] | [standalone]
| From | Borislav Petkov <bp@alien8.de> |
|---|---|
| Date | 2016-05-03 12:00 +0200 |
| Subject | Re: [tip:core/signals] signals/sigaltstack: Prepare to add new SS_xxx flags |
| Message-ID | <ruFhw-5Sv-25@gated-at.bofh.it> |
| In reply to | #1393138 |
On Tue, May 03, 2016 at 12:50:06AM -0700, tip-bot for Stas Sergeev wrote:
> Commit-ID: 407bc16ad1769f5cb8ad9555611cb198187ef4cd
> Gitweb: http://git.kernel.org/tip/407bc16ad1769f5cb8ad9555611cb198187ef4cd
> Author: Stas Sergeev <stsp@list.ru>
> AuthorDate: Thu, 14 Apr 2016 23:20:03 +0300
> Committer: Ingo Molnar <mingo@kernel.org>
> CommitDate: Tue, 3 May 2016 08:37:59 +0200
>
> signals/sigaltstack: Prepare to add new SS_xxx flags
>
> This patch adds SS_FLAG_BITS - the mask that splits sigaltstack
> mode values and bit-flags. Since there is no bit-flags yet, the
> mask is defined to 0. The flags are added by subsequent patches.
> With every new flag, the mask should have the appropriate bit cleared.
>
> This makes sure if some flag is tried on a kernel that doesn't
> support it, the -EINVAL error will be returned, because such a
> flag will be treated as an invalid mode rather than the bit-flag.
>
> That way the existence of the particular features can be probed
> at run-time.
>
> This change was suggested by Andy Lutomirski:
>
> https://lkml.org/lkml/2016/3/6/158
Please use the message ID in the future
Message-ID: <CALCETrW=M1=n6R6dwOj-ks_=+14vf4rz0S3SFty-_GuwFFZU5A@mail.gmail.com>
to refer to public mails because random web services caching lkml tend
to become unreliable or even disappear at some point.
I.e., see Link: format below for an example.
> Signed-off-by: Stas Sergeev <stsp@list.ru>
> Cc: Al Viro <viro@zeniv.linux.org.uk>
> Cc: Amanieu d'Antras <amanieu@gmail.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Andy Lutomirski <luto@amacapital.net>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: Brian Gerst <brgerst@gmail.com>
> Cc: Denys Vlasenko <dvlasenk@redhat.com>
> Cc: H. Peter Anvin <hpa@zytor.com>
> Cc: Linus Torvalds <torvalds@linux-foundation.org>
> Cc: Michal Hocko <mhocko@suse.com>
> Cc: Oleg Nesterov <oleg@redhat.com>
> Cc: Pavel Emelyanov <xemul@parallels.com>
> Cc: Peter Zijlstra (Intel) <peterz@infradead.org>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Richard Weinberger <richard@nod.at>
> Cc: Sasha Levin <sasha.levin@oracle.com>
> Cc: Shuah Khan <shuahkh@osg.samsung.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Vladimir Davydov <vdavydov@parallels.com>
> Cc: linux-api@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Link: http://lkml.kernel.org/r/1460665206-13646-3-git-send-email-stsp@list.ru
> Signed-off-by: Ingo Molnar <mingo@kernel.org>
> ---
> include/uapi/linux/signal.h | 3 +++
> kernel/signal.c | 16 ++++++----------
> 2 files changed, 9 insertions(+), 10 deletions(-)
Thanks.
--
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
[toc] | [prev] | [next] | [standalone]
| From | Andy Lutomirski <luto@amacapital.net> |
|---|---|
| Date | 2016-05-03 18:20 +0200 |
| Subject | Re: [tip:core/signals] signals/sigaltstack: Prepare to add new SS_xxx flags |
| Message-ID | <ruLdg-2QH-17@gated-at.bofh.it> |
| In reply to | #1393138 |
On Tue, May 3, 2016 at 12:50 AM, tip-bot for Stas Sergeev <tipbot@zytor.com> wrote: > Commit-ID: 407bc16ad1769f5cb8ad9555611cb198187ef4cd > Gitweb: http://git.kernel.org/tip/407bc16ad1769f5cb8ad9555611cb198187ef4cd > Author: Stas Sergeev <stsp@list.ru> > AuthorDate: Thu, 14 Apr 2016 23:20:03 +0300 > Committer: Ingo Molnar <mingo@kernel.org> > CommitDate: Tue, 3 May 2016 08:37:59 +0200 > > signals/sigaltstack: Prepare to add new SS_xxx flags > > This patch adds SS_FLAG_BITS - the mask that splits sigaltstack > mode values and bit-flags. Since there is no bit-flags yet, the > mask is defined to 0. The flags are added by subsequent patches. > With every new flag, the mask should have the appropriate bit cleared. > > This makes sure if some flag is tried on a kernel that doesn't > support it, the -EINVAL error will be returned, because such a > flag will be treated as an invalid mode rather than the bit-flag. > > That way the existence of the particular features can be probed > at run-time. > > This change was suggested by Andy Lutomirski: > > https://lkml.org/lkml/2016/3/6/158 LGTM.
[toc] | [prev] | [next] | [standalone]
| From | Andy Lutomirski <luto@amacapital.net> |
|---|---|
| Date | 2016-05-03 18:50 +0200 |
| Subject | Re: [tip:core/signals] signals/sigaltstack: Prepare to add new SS_xxx flags |
| Message-ID | <ruLGi-33K-1@gated-at.bofh.it> |
| In reply to | #1393591 |
On Tue, May 3, 2016 at 9:13 AM, Andy Lutomirski <luto@amacapital.net> wrote: > On Tue, May 3, 2016 at 12:50 AM, tip-bot for Stas Sergeev > <tipbot@zytor.com> wrote: >> Commit-ID: 407bc16ad1769f5cb8ad9555611cb198187ef4cd >> Gitweb: http://git.kernel.org/tip/407bc16ad1769f5cb8ad9555611cb198187ef4cd >> Author: Stas Sergeev <stsp@list.ru> >> AuthorDate: Thu, 14 Apr 2016 23:20:03 +0300 >> Committer: Ingo Molnar <mingo@kernel.org> >> CommitDate: Tue, 3 May 2016 08:37:59 +0200 >> >> signals/sigaltstack: Prepare to add new SS_xxx flags >> >> This patch adds SS_FLAG_BITS - the mask that splits sigaltstack >> mode values and bit-flags. Since there is no bit-flags yet, the >> mask is defined to 0. The flags are added by subsequent patches. >> With every new flag, the mask should have the appropriate bit cleared. >> >> This makes sure if some flag is tried on a kernel that doesn't >> support it, the -EINVAL error will be returned, because such a >> flag will be treated as an invalid mode rather than the bit-flag. >> >> That way the existence of the particular features can be probed >> at run-time. >> >> This change was suggested by Andy Lutomirski: >> >> https://lkml.org/lkml/2016/3/6/158 > > LGTM. Correction: does not LGTM. In a sensible design, sigaltstack would report flags back to the caller. I will send a fix. --Andy
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web