linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [GIT PULL] thread fixes
@ 2019-11-05 15:52 Christian Brauner
  2019-11-05 19:05 ` pr-tracker-bot
  0 siblings, 1 reply; 4+ messages in thread
From: Christian Brauner @ 2019-11-05 15:52 UTC (permalink / raw)
  To: Linus Torvalds, Linux Kernel Mailing List

Hi Linus,

/* Summary */
This changes clone3() to do basic stack validation and to set up the stack
depending on whether or not it is growing up or down. With clone3() the
expectation is now very simply that the .stack argument points to the
lowest address of the stack and that .stack_size specifies the initial
stack size. This is diferent from legacy clone() where the "stack" argument
had to point to the lowest or highest address of the stack depending on the
architecture.

clone3() was released with 5.3. Currently, it is not documented and very
unclear to userspace how the stack and stack_size argument have to be
passed. After talking to glibc folks we concluded that changing clone3() to
determine stack direction and doing basic validation is the right course of
action.
Note, this is a potentially user visible change. In the very unlikely case,
that it breaks someone's use-case we will revert. (And then e.g.
place the new behavior under an appropriate flag.)
Note that passing an empty stack will continue working just as before.
Breaking someone's use-case is very unlikely. Neither glibc nor musl
currently expose a wrapper for clone3(). There is currently also no real
motivation for anyone to use clone3() directly. First, because using
clone{3}() with stacks requires some assembly (see glibc and musl). Second,
because it does not provide features that legacy clone() doesn't. New
features for clone3() will first happen in v5.5 which is why v5.4 is still
a good time to try and make that change now and backport it to v5.3.

I did a codesearch on https://codesearch.debian.net, github, and gitlab and
could not find any software currently relying directly on clone3(). I
expect this to change once we land CLONE_CLEAR_SIGHAND which was a request
coming from glibc at which point they'll likely start using it.

The following changes since commit d6d5df1db6e9d7f8f76d2911707f7d5877251b02:

  Linux 5.4-rc5 (2019-10-27 13:19:19 -0400)

are available in the Git repository at:

  git@gitolite.kernel.org:pub/scm/linux/kernel/git/brauner/linux tags/for-linus-2019-11-05

for you to fetch changes up to fa729c4df558936b4a1a7b3e2234011f44ede28b:

  clone3: validate stack arguments (2019-11-05 15:50:14 +0100)

/* Testing */
All patches have seen exposure in linux-next and are based on v5.4-rc5.
The patch has a recent change date because I added Arnd's ack.

/* Conflicts */
At the time of creating this PR no merge conflicts were reported from
linux-next.

Please consider pulling these changes from the signed for-linus-2019-11-05 tag.

Thanks!
Christian

----------------------------------------------------------------
for-linus-2019-11-05

----------------------------------------------------------------
Christian Brauner (1):
      clone3: validate stack arguments

 include/uapi/linux/sched.h |  4 ++++
 kernel/fork.c              | 33 ++++++++++++++++++++++++++++++++-
 2 files changed, 36 insertions(+), 1 deletion(-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [GIT PULL] thread fixes
  2019-11-05 15:52 [GIT PULL] thread fixes Christian Brauner
@ 2019-11-05 19:05 ` pr-tracker-bot
  0 siblings, 0 replies; 4+ messages in thread
From: pr-tracker-bot @ 2019-11-05 19:05 UTC (permalink / raw)
  To: Christian Brauner; +Cc: Linus Torvalds, Linux Kernel Mailing List

The pull request you sent on Tue,  5 Nov 2019 16:52:17 +0100:

> git@gitolite.kernel.org:pub/scm/linux/kernel/git/brauner/linux tags/for-linus-2019-11-05

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/26bc672134241a080a83b2ab9aa8abede8d30e1c

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [GIT PULL] thread fixes
  2019-11-21 14:31 Christian Brauner
@ 2019-11-21 20:30 ` pr-tracker-bot
  0 siblings, 0 replies; 4+ messages in thread
From: pr-tracker-bot @ 2019-11-21 20:30 UTC (permalink / raw)
  To: Christian Brauner; +Cc: Linus Torvalds, Linux Kernel Mailing List

The pull request you sent on Thu, 21 Nov 2019 15:31:33 +0100:

> git@gitolite.kernel.org:pub/scm/linux/kernel/git/brauner/linux tags/for-linus-2019-11-21

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/d324810acded7003c955c7c6faf4c57cd40e6000

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.wiki.kernel.org/userdoc/prtracker

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [GIT PULL] thread fixes
@ 2019-11-21 14:31 Christian Brauner
  2019-11-21 20:30 ` pr-tracker-bot
  0 siblings, 1 reply; 4+ messages in thread
From: Christian Brauner @ 2019-11-21 14:31 UTC (permalink / raw)
  To: Linus Torvalds, Linux Kernel Mailing List

Hi Linus,

This contains a simple fix for the pidfd poll method. In the original patchset
pidfd_poll() was made to return an unsigned int. However, the poll method is
defined to return a __poll_t. While the unsigned int is not a huge deal it's
just nicer to return a __poll_t.

I've decided to send it right before the 5.4 release mainly so that stable
doesn't need to backport it to both 5.4 and 5.3.

The following changes since commit af42d3466bdc8f39806b26f593604fdc54140bcb:

  Linux 5.4-rc8 (2019-11-17 14:47:30 -0800)

are available in the Git repository at:

  git@gitolite.kernel.org:pub/scm/linux/kernel/git/brauner/linux tags/for-linus-2019-11-21

for you to fetch changes up to 9e77716a75bc6cf54965e5ec069ba7c02b32251c:

  fork: fix pidfd_poll()'s return type (2019-11-20 11:48:50 +0100)

/* Testing */
All patches have seen exposure in linux-next and are based on v5.4-rc8.
All pidfd selftests passed.

/* Conflicts */
At the time of creating this PR no merge conflicts were reported from
linux-next.

Please consider pulling these changes from the signed for-linus-2019-11-21 tag.

Thanks!
Christian

----------------------------------------------------------------
for-linus-2019-11-21

----------------------------------------------------------------
Luc Van Oostenryck (1):
      fork: fix pidfd_poll()'s return type

 kernel/fork.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/fork.c b/kernel/fork.c
index 55af6931c6ec..13b38794efb5 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1708,11 +1708,11 @@ static void pidfd_show_fdinfo(struct seq_file *m, struct file *f)
 /*
  * Poll support for process exit notification.
  */
-static unsigned int pidfd_poll(struct file *file, struct poll_table_struct *pts)
+static __poll_t pidfd_poll(struct file *file, struct poll_table_struct *pts)
 {
 	struct task_struct *task;
 	struct pid *pid = file->private_data;
-	int poll_flags = 0;
+	__poll_t poll_flags = 0;
 
 	poll_wait(file, &pid->wait_pidfd, pts);
 
@@ -1724,7 +1724,7 @@ static unsigned int pidfd_poll(struct file *file, struct poll_table_struct *pts)
 	 * group, then poll(2) should block, similar to the wait(2) family.
 	 */
 	if (!task || (task->exit_state && thread_group_empty(task)))
-		poll_flags = POLLIN | POLLRDNORM;
+		poll_flags = EPOLLIN | EPOLLRDNORM;
 	rcu_read_unlock();
 
 	return poll_flags;

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-11-21 20:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-05 15:52 [GIT PULL] thread fixes Christian Brauner
2019-11-05 19:05 ` pr-tracker-bot
2019-11-21 14:31 Christian Brauner
2019-11-21 20:30 ` pr-tracker-bot

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 NNTP newsgroup(s).