Skip to contentSkip to conversation

package/openssh: backport upstream fix for 32-bit

PATCH Applied John Keeping 5 participants 7 messages Mar 10, 2022 – Mar 18, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/openssh: backport upstream fix for 32-bit

sshd is broken on 32-bit systems because ppoll_time64 is used by the application although it is not allowed by the seccomp filter.

Apply the upstream patch to fix this.

---
 ...llow-ppoll_time64-in-seccomp-sandbox.patch | 31 +++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 package/openssh/0001-Allow-ppoll_time64-in-seccomp-sandbox.patch
package/openssh/0001-Allow-ppoll_time64-in-seccomp-sandbox.patch new file +31 -0
new file mode 100644
index 0000000000..34b309bd9a
@@ -0,0 +1,31 @@
+From 284b6e5394652d519e31782e3b3cdfd7b21d1a81 Mon Sep 17 00:00:00 2001
+From: Darren Tucker <[email protected]>
+Date: Sat, 26 Feb 2022 14:06:14 +1100
+Subject: [PATCH] Allow ppoll_time64 in seccomp sandbox.
+
+Should fix sandbox violations on (some? at least i386 and armhf) 32bit
+Linux platforms.  Patch from chutzpahu at gentoo.org and cjwatson at
+debian.org via bz#3396.
+
+Signed-off-by: John Keeping <[email protected]>
+---
+ sandbox-seccomp-filter.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/sandbox-seccomp-filter.c b/sandbox-seccomp-filter.c
+index 2e065ba3..4ce80cb2 100644
+--- a/sandbox-seccomp-filter.c
++++ b/sandbox-seccomp-filter.c
+@@ -276,6 +276,9 @@ static const struct sock_filter preauth_insns[] = {
+ #ifdef __NR_ppoll
+ 	SC_ALLOW(__NR_ppoll),
+ #endif
++#ifdef __NR_ppoll_time64
++	SC_ALLOW(__NR_ppoll_time64),
++#endif
+ #ifdef __NR_poll
+ 	SC_ALLOW(__NR_poll),
+ #endif
+-- 
+2.35.1
+
Signature · 6 lines
2.35.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Reviewed-by on v1 1/1
#1 lore raw

Hello John,

thanks for the patch, some minor nitpicks...

Better patch subject would be:

package/openssh: add upstream patch to add seccomp ppoll_time64 support

Quoted 4 lines · John Keeping

sshd is broken on 32-bit systems because ppoll_time64 is used by the application although it is not allowed by the seccomp filter.

Apply the upstream patch to fix this.

Better:

-add upstream patch ([1] to add seccomp ppoll_time64 support

[1] https://github.com/openssh/openssh-portable/commit/284b6e5394652d519e31782e3b3cdfd7b21d1a81.patch

Quoted 13 lines
---
 ...llow-ppoll_time64-in-seccomp-sandbox.patch | 31 +++++++++++++++++++
 1 file changed, 31 insertions(+)
 create mode 100644 package/openssh/0001-Allow-ppoll_time64-in-seccomp-sandbox.patch
package/openssh/0001-Allow-ppoll_time64-in-seccomp-sandbox.patch new file +0 -0
new file mode 100644
index 0000000000..34b309bd9a

package/openssh/0001-Allow-ppoll_time64-in-seccomp-sandbox.patch line 9

Quoted 9 lines
package/openssh/0001-Allow-ppoll_time64-in-seccomp-sandbox.patch new file +9 -0
@@ -0,0 +1,31 @@
+From 284b6e5394652d519e31782e3b3cdfd7b21d1a81 Mon Sep 17 00:00:00 2001
+From: Darren Tucker <[email protected]>
+Date: Sat, 26 Feb 2022 14:06:14 +1100
+Subject: [PATCH] Allow ppoll_time64 in seccomp sandbox.
+
+Should fix sandbox violations on (some? at least i386 and armhf) 32bit
+Linux platforms.  Patch from chutzpahu at gentoo.org and cjwatson at
+debian.org via bz#3396.
+

Missing:

[Upstream: https://github.com/openssh/openssh-portable/commit/284b6e5394652d519e31782e3b3cdfd7b21d1a81.patch]

Quoted 12 lines
package/openssh/0001-Allow-ppoll_time64-in-seccomp-sandbox.patch new file +12 -0
+Signed-off-by: John Keeping <[email protected]>
+---
+ sandbox-seccomp-filter.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/sandbox-seccomp-filter.c b/sandbox-seccomp-filter.c
+index 2e065ba3..4ce80cb2 100644
+--- a/sandbox-seccomp-filter.c
++++ b/sandbox-seccomp-filter.c
+@@ -276,6 +276,9 @@ static const struct sock_filter preauth_insns[] = {
+ #ifdef __NR_ppoll
+ 	SC_ALLOW(__NR_ppoll),

package/openssh/0001-Allow-ppoll_time64-in-seccomp-sandbox.patch line 31

Quoted 10 lines
package/openssh/0001-Allow-ppoll_time64-in-seccomp-sandbox.patch new file +10 -0
+ #endif
++#ifdef __NR_ppoll_time64
++	SC_ALLOW(__NR_ppoll_time64),
++#endif
+ #ifdef __NR_poll
+ 	SC_ALLOW(__NR_poll),
+ #endif
+--
+2.35.1
+

With this fixed you can add my

Regards,
Peter

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#2 lore raw
Quoted 7 lines · Peter Seiderer

Hello John,

thanks for the patch, some minor nitpicks...

Better patch subject would be:

package/openssh: add upstream patch to add seccomp ppoll_time64 support

Applied to master with this changed.

Quoted 11 lines · John Keeping
Quoted 5 lines

sshd is broken on 32-bit systems because ppoll_time64 is used by the application although it is not allowed by the seccomp filter.

Apply the upstream patch to fix this.

Better:

-add upstream patch ([1] to add seccomp ppoll_time64 support

Since the subject now already says that it adds seccomp ppoll_time64 support,
this is redundant. Since I'm lazy :-), I didn't change this.

Quoted 2 lines

[1] https://github.com/openssh/openssh-portable/commit/284b6e5394652d519e31782e3b3cdfd7b21d1a81.patch

There's already a reference to the upstream commit in the patch itself, so
this is not really needed.

Quoted 26 lines
Quoted 14 lines
---
  ...llow-ppoll_time64-in-seccomp-sandbox.patch | 31 +++++++++++++++++++
  1 file changed, 31 insertions(+)

create mode 100644 package/openssh/0001-Allow-ppoll_time64-in-seccomp-sandbox.patch

package/openssh/0001-Allow-ppoll_time64-in-seccomp-sandbox.patch new file +0 -0
new file mode 100644
index 0000000000..34b309bd9a

package/openssh/0001-Allow-ppoll_time64-in-seccomp-sandbox.patch line 9

Quoted 9 lines
package/openssh/0001-Allow-ppoll_time64-in-seccomp-sandbox.patch new file +9 -0
@@ -0,0 +1,31 @@
+From 284b6e5394652d519e31782e3b3cdfd7b21d1a81 Mon Sep 17 00:00:00 2001
+From: Darren Tucker <[email protected]>
+Date: Sat, 26 Feb 2022 14:06:14 +1100
+Subject: [PATCH] Allow ppoll_time64 in seccomp sandbox.
+
+Should fix sandbox violations on (some? at least i386 and armhf) 32bit
+Linux platforms.  Patch from chutzpahu at gentoo.org and cjwatson at
+debian.org via bz#3396.
+

Missing:

Quoted 1 line

[Upstream: https://github.com/openssh/openssh-portable/commit/284b6e5394652d519e31782e3b3cdfd7b21d1a81.patch]

Except for the signoff, the patch is literally the upstream patch, including
the sha1 in the From line. So an upstream reference is not really needed. Still, it's useful so I overcame my laziness and added it.

Regards,
Arnout

Quoted 27 lines
Quoted 12 lines
package/openssh/0001-Allow-ppoll_time64-in-seccomp-sandbox.patch new file +12 -0
+Signed-off-by: John Keeping <[email protected]>
+---
+ sandbox-seccomp-filter.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/sandbox-seccomp-filter.c b/sandbox-seccomp-filter.c
+index 2e065ba3..4ce80cb2 100644
+--- a/sandbox-seccomp-filter.c
++++ b/sandbox-seccomp-filter.c
+@@ -276,6 +276,9 @@ static const struct sock_filter preauth_insns[] = {
+ #ifdef __NR_ppoll
+ 	SC_ALLOW(__NR_ppoll),

package/openssh/0001-Allow-ppoll_time64-in-seccomp-sandbox.patch line 31

Quoted 10 lines
package/openssh/0001-Allow-ppoll_time64-in-seccomp-sandbox.patch new file +10 -0
+ #endif
++#ifdef __NR_ppoll_time64
++	SC_ALLOW(__NR_ppoll_time64),
++#endif
+ #ifdef __NR_poll
+ 	SC_ALLOW(__NR_poll),
+ #endif
+--
+2.35.1
+

With this fixed you can add my

Quoted 7 lines

Regards,
Peter

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw

Hello Arnout,

Quoted 58 lines · Arnout Vandecappelle
Quoted 7 lines · Peter Seiderer

Hello John,

thanks for the patch, some minor nitpicks...

Better patch subject would be:

package/openssh: add upstream patch to add seccomp ppoll_time64 support

Applied to master with this changed.

Quoted 11 lines · John Keeping
Quoted 5 lines

sshd is broken on 32-bit systems because ppoll_time64 is used by the application although it is not allowed by the seccomp filter.

Apply the upstream patch to fix this.

Better:

-add upstream patch ([1] to add seccomp ppoll_time64 support

Since the subject now already says that it adds seccomp ppoll_time64 support,
this is redundant. Since I'm lazy :-), I didn't change this.

Quoted 2 lines

[1] https://github.com/openssh/openssh-portable/commit/284b6e5394652d519e31782e3b3cdfd7b21d1a81.patch

There's already a reference to the upstream commit in the patch itself, so
this is not really needed.

Quoted 26 lines
Quoted 14 lines
---
  ...llow-ppoll_time64-in-seccomp-sandbox.patch | 31 +++++++++++++++++++
  1 file changed, 31 insertions(+)

create mode 100644 package/openssh/0001-Allow-ppoll_time64-in-seccomp-sandbox.patch

package/openssh/0001-Allow-ppoll_time64-in-seccomp-sandbox.patch new file +0 -0
new file mode 100644
index 0000000000..34b309bd9a

package/openssh/0001-Allow-ppoll_time64-in-seccomp-sandbox.patch line 9

Quoted 9 lines
package/openssh/0001-Allow-ppoll_time64-in-seccomp-sandbox.patch new file +9 -0
@@ -0,0 +1,31 @@
+From 284b6e5394652d519e31782e3b3cdfd7b21d1a81 Mon Sep 17 00:00:00 2001
+From: Darren Tucker <[email protected]>
+Date: Sat, 26 Feb 2022 14:06:14 +1100
+Subject: [PATCH] Allow ppoll_time64 in seccomp sandbox.
+
+Should fix sandbox violations on (some? at least i386 and armhf) 32bit
+Linux platforms.  Patch from chutzpahu at gentoo.org and cjwatson at
+debian.org via bz#3396.
+

Missing:

Quoted 5 lines
Quoted 1 line

[Upstream: https://github.com/openssh/openssh-portable/commit/284b6e5394652d519e31782e3b3cdfd7b21d1a81.patch]

Except for the signoff, the patch is literally the upstream patch, including
the sha1 in the From line. So an upstream reference is not really needed. Still, it's useful so I overcame my laziness and added it.

But the sha1 alone does not tell to which git repo it belongs to, but the explicit upstream link does (and has the nice effect to gain a one-click link to the corresponding patch/merge-request etc.) and is a prominent remainder in case of package version bump where the patch comes from...

Regards,
Peter

Quoted 39 lines

Regards,
Arnout

Quoted 34 lines
Quoted 12 lines
package/openssh/0001-Allow-ppoll_time64-in-seccomp-sandbox.patch new file +12 -0
+Signed-off-by: John Keeping <[email protected]>
+---
+ sandbox-seccomp-filter.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/sandbox-seccomp-filter.c b/sandbox-seccomp-filter.c
+index 2e065ba3..4ce80cb2 100644
+--- a/sandbox-seccomp-filter.c
++++ b/sandbox-seccomp-filter.c
+@@ -276,6 +276,9 @@ static const struct sock_filter preauth_insns[] = {
+ #ifdef __NR_ppoll
+ 	SC_ALLOW(__NR_ppoll),

package/openssh/0001-Allow-ppoll_time64-in-seccomp-sandbox.patch line 31

Quoted 10 lines
package/openssh/0001-Allow-ppoll_time64-in-seccomp-sandbox.patch new file +10 -0
+ #endif
++#ifdef __NR_ppoll_time64
++	SC_ALLOW(__NR_ppoll_time64),
++#endif
+ #ifdef __NR_poll
+ 	SC_ALLOW(__NR_poll),
+ #endif
+--
+2.35.1
+

With this fixed you can add my

Regards,
Peter

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#4 lore raw
Quoted 64 lines · Peter Seiderer

Hello Arnout,

Quoted 60 lines · Arnout Vandecappelle
Quoted 7 lines · Peter Seiderer

Hello John,

thanks for the patch, some minor nitpicks...

Better patch subject would be:

package/openssh: add upstream patch to add seccomp ppoll_time64 support

Applied to master with this changed.

Quoted 11 lines · John Keeping
Quoted 5 lines

sshd is broken on 32-bit systems because ppoll_time64 is used by the application although it is not allowed by the seccomp filter.

Apply the upstream patch to fix this.

Better:

-add upstream patch ([1] to add seccomp ppoll_time64 support

Since the subject now already says that it adds seccomp ppoll_time64 support,
this is redundant. Since I'm lazy :-), I didn't change this.

Quoted 2 lines

[1] https://github.com/openssh/openssh-portable/commit/284b6e5394652d519e31782e3b3cdfd7b21d1a81.patch

There's already a reference to the upstream commit in the patch itself, so
this is not really needed.

Quoted 27 lines
Quoted 14 lines
---
   ...llow-ppoll_time64-in-seccomp-sandbox.patch | 31 +++++++++++++++++++
   1 file changed, 31 insertions(+)

create mode 100644 package/openssh/0001-Allow-ppoll_time64-in-seccomp-sandbox.patch

package/openssh/0001-Allow-ppoll_time64-in-seccomp-sandbox.patch new file +0 -0
new file mode 100644
index 0000000000..34b309bd9a

package/openssh/0001-Allow-ppoll_time64-in-seccomp-sandbox.patch line 9

Quoted 9 lines
package/openssh/0001-Allow-ppoll_time64-in-seccomp-sandbox.patch new file +9 -0
@@ -0,0 +1,31 @@
+From 284b6e5394652d519e31782e3b3cdfd7b21d1a81 Mon Sep 17 00:00:00 2001
+From: Darren Tucker <[email protected]>
+Date: Sat, 26 Feb 2022 14:06:14 +1100
+Subject: [PATCH] Allow ppoll_time64 in seccomp sandbox.
+
+Should fix sandbox violations on (some? at least i386 and armhf) 32bit
+Linux platforms.  Patch from chutzpahu at gentoo.org and cjwatson at
+debian.org via bz#3396.
+

Missing:

[Upstream: https://github.com/openssh/openssh-portable/commit/284b6e5394652d519e31782e3b3cdfd7b21d1a81.patch]

Quoted 8 lines
Quoted 3 lines

Except for the signoff, the patch is literally the upstream patch, including
the sha1 in the From line. So an upstream reference is not really needed. Still, it's useful so I overcame my laziness and added it.

But the sha1 alone does not tell to which git repo it belongs to, but the explicit upstream link does (and has the nice effect to gain a one-click link to the corresponding patch/merge-request etc.) and is a prominent remainder in case of package version bump where the patch comes from...

I don't know about you, but the normal way that I generate patches is to clone
the repo and do 'git format-patch -1 <sha1>', and then add my SoB. And if it doesn't apply cleanly, I first do 'git cherry-pick -x -s'.

Obviously it's helpful to have a link there. However, requiring contributors
to go and find the upstream web frontend and construct a URL is IMHO asking a lot, especially since chances are that no one is ever going to actually look at that link. There's already plenty of steps a contributor has to go through, I don't want to increase the threshold even more.

Regards,
Arnout

Quoted 44 lines

Regards,
Peter

Quoted 39 lines

Regards,
Arnout

Quoted 34 lines
Quoted 12 lines
package/openssh/0001-Allow-ppoll_time64-in-seccomp-sandbox.patch new file +12 -0
+Signed-off-by: John Keeping <[email protected]>
+---
+ sandbox-seccomp-filter.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/sandbox-seccomp-filter.c b/sandbox-seccomp-filter.c
+index 2e065ba3..4ce80cb2 100644
+--- a/sandbox-seccomp-filter.c
++++ b/sandbox-seccomp-filter.c
+@@ -276,6 +276,9 @@ static const struct sock_filter preauth_insns[] = {
+ #ifdef __NR_ppoll
+ 	SC_ALLOW(__NR_ppoll),

package/openssh/0001-Allow-ppoll_time64-in-seccomp-sandbox.patch line 31

Quoted 10 lines
package/openssh/0001-Allow-ppoll_time64-in-seccomp-sandbox.patch new file +10 -0
+ #endif
++#ifdef __NR_ppoll_time64
++	SC_ALLOW(__NR_ppoll_time64),
++#endif
+ #ifdef __NR_poll
+ 	SC_ALLOW(__NR_poll),
+ #endif
+--
+2.35.1
+

With this fixed you can add my

Regards,
Peter

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#5 lore raw

Arnout, Peter, All,

On 2022-03-12 17:00 +0100, Arnout Vandecappelle spake thusly:

Quoted 8 lines · Peter Seiderer
Quoted 4 lines

But the sha1 alone does not tell to which git repo it belongs to, but the explicit upstream link does (and has the nice effect to gain a one-click link to the corresponding patch/merge-request etc.) and is a prominent remainder in case of package version bump where the patch comes from...

I don't know about you, but the normal way that I generate patches is to
clone the repo and do 'git format-patch -1 <sha1>', and then add my SoB. And if it doesn't apply cleanly, I first do 'git cherry-pick -x -s'.

Exactly what I do too, with an additional tag just before my SoB:

[[email protected]: backport from upstream]
Quoted 5 lines

Obviously it's helpful to have a link there. However, requiring
contributors to go and find the upstream web frontend and construct a URL is IMHO asking a lot, especially since chances are that no one is ever going to actually look at that link. There's already plenty of steps a contributor has to go through, I don't want to increase the threshold even more.

I fully subscribe to Arnout's position.

I only add an URL to the original patch if it was grabbed fro; a pending PR/MR/BZ/.. or a third-party tree.

Regards,
Yann E. MORIN.

Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#6 lore raw
In reply to John Keeping
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"John" == John Keeping <[email protected]> writes:

sshd is broken on 32-bit systems because ppoll_time64 is used by the application although it is not allowed by the seccomp filter.

Apply the upstream patch to fix this.

Committed to 2022.02.x, thanks.

Signature · 5 lines
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot