From: Oleg Nesterov <oleg@redhat.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Andy Lutomirski <luto@kernel.org>, Borislav Petkov <bp@alien8.de>,
Ingo Molnar <mingo@kernel.org>,
Jan Kratochvil <jan.kratochvil@redhat.com>,
Pedro Alves <palves@redhat.com>, Peter Anvin <hpa@zytor.com>,
Thomas Gleixner <tglx@linutronix.de>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
the arch/x86 maintainers <x86@kernel.org>
Subject: Re: [PATCH] ptrace/x86: introduce TS_COMPAT_RESTART to fix get_nr_restart_syscall()
Date: Wed, 27 Nov 2019 18:02:35 +0100 [thread overview]
Message-ID: <20191127170234.GA26180@redhat.com> (raw)
In-Reply-To: <CAHk-=whrhuNg_53wc3pBVToH-AUwKDbC5P_cb7=8bYfn=BYCJA@mail.gmail.com>
On 11/26, Linus Torvalds wrote:
>
> On Tue, Nov 26, 2019 at 3:08 AM Oleg Nesterov <oleg@redhat.com> wrote:
> >
> > Alternatively we could add ->compat_restart into struct restart_block,
> > logically this is the same thing.
>
> That sounds like the better model to me. That's what the restart_block
> is about: it's supposed to contain the restart information.
I knew ;) OK, I won't argue, I'll send V2.
> I'd much rather see the system call number added into the restart
> block (or just the "compat bit" - but we have that X32 case too, so
> why not put it all there).
apart from x86, who else can use it? after the quick grep I think nobody,
even arm64 and mips which have compat nr_restart's do not need it.
restart_block.arch_restart_block_infp makes more sense, but that would be
even more painful, I do not want to add asm/restart_block.h or
HAVE_ARCH_RESTART_INFO, or use CONFIG_IA32_EMULATION.
OK, lets add the new restart_block.nr_restart_syscall field, then we need
void set_restart_block_fn(restart, fn)
{
restart->nr_restart_syscall = arch_get_nr_restart_syscall()
restart->fn = fn;
}
but somehow I do not see a good place for
#ifndef arch_get_nr_restart_syscall()
#define arch_get_nr_restart_syscall() 0
#endif
Can you suggest a simple solution?
Hmm. Or may be HAVE_ARCH_RESTART is better after all? Say, just
--- a/include/linux/restart_block.h
+++ b/include/linux/restart_block.h
@@ -24,6 +24,9 @@ enum timespec_type {
*/
struct restart_block {
long (*fn)(struct restart_block *);
+#ifdef CONFIG_HAVE_ARCH_RESTART_XXX
+ int nr_restart_syscall;
+#endif
union {
/* For futex_wait and futex_wait_requeue_pi */
struct {
@@ -55,6 +58,15 @@ struct restart_block {
};
};
+static inline void set_restart_block_fn(restart, fn)
+{
+#ifdef CONFIG_HAVE_ARCH_RESTART_XXX
+ extern int arch_get_nr_restart_syscall();
+ restart->nr_restart_syscall = arch_get_nr_restart_syscall();
+#endif
+ restart->fn = fn;
+}
+
extern long do_no_restart_syscall(struct restart_block *parm);
#endif /* __LINUX_RESTART_BLOCK_H */
?
Oleg.
next prev parent reply other threads:[~2019-11-27 17:02 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-26 11:06 Oleg Nesterov
2019-11-26 11:07 ` Oleg Nesterov
2019-11-27 4:04 ` Linus Torvalds
2019-11-27 5:46 ` Andy Lutomirski
2019-11-27 17:06 ` Oleg Nesterov
2019-11-27 17:02 ` Oleg Nesterov [this message]
2019-11-27 17:21 ` Linus Torvalds
2019-11-28 15:36 ` Oleg Nesterov
2019-11-28 19:24 ` Linus Torvalds
2019-11-28 21:13 ` Andy Lutomirski
2019-11-29 17:32 ` Oleg Nesterov
2019-11-29 18:19 ` Andy Lutomirski
2019-11-29 17:21 ` Oleg Nesterov
2019-12-03 14:12 ` [PATCH v2 0/4] x86: " Oleg Nesterov
2019-12-03 14:13 ` [PATCH v2 1/4] introduce set_restart_fn() and arch_set_restart_data() Oleg Nesterov
2019-12-04 15:09 ` Oleg Nesterov
2019-12-04 15:09 ` [PATCH v3 " Oleg Nesterov
2019-12-03 14:13 ` [PATCH v2 2/4] x86: mv TS_COMPAT from asm/processor.h to asm/thread_info.h Oleg Nesterov
2019-12-03 14:13 ` [PATCH v2 3/4] x86: introduce TS_COMPAT_RESTART to fix get_nr_restart_syscall() Oleg Nesterov
2019-12-03 14:14 ` [PATCH v2 4/4] x86: introduce restart_block->arch_data to kill TS_COMPAT_RESTART Oleg Nesterov
2019-12-18 15:19 ` [PATCH v2 0/4] x86: fix get_nr_restart_syscall() Oleg Nesterov
2019-12-18 20:02 ` Linus Torvalds
2019-12-19 2:48 ` Andy Lutomirski
2020-02-17 15:54 ` Thomas Gleixner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191127170234.GA26180@redhat.com \
--to=oleg@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=jan.kratochvil@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@kernel.org \
--cc=palves@redhat.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome