update sftable memory size before using pipe fd as index of fdstatus
(cherry picked from commit f4466e5a45cbc2cafd50becb23e3fddc5b7a5f1e)
This commit is contained in:
parent
63dac55e94
commit
16cc40aa2e
6
ksh.spec
6
ksh.spec
@ -1,6 +1,6 @@
|
|||||||
Name: ksh
|
Name: ksh
|
||||||
Version: 2020.0.0
|
Version: 2020.0.0
|
||||||
Release: 11
|
Release: 12
|
||||||
Summary: The Original ATT Korn Shell
|
Summary: The Original ATT Korn Shell
|
||||||
License: EPL-1.0
|
License: EPL-1.0
|
||||||
URL: http://www.kornshell.com/
|
URL: http://www.kornshell.com/
|
||||||
@ -19,6 +19,7 @@ Patch6003: backport-Fix-handling-of-skipped-directories.patch
|
|||||||
|
|
||||||
Patch9000: skip-some-test.patch
|
Patch9000: skip-some-test.patch
|
||||||
Patch9001: solve-the-problem-of-dereference-null-return-value-w.patch
|
Patch9001: solve-the-problem-of-dereference-null-return-value-w.patch
|
||||||
|
Patch9002: update-sftable-memory-size-before-using-p.patch
|
||||||
|
|
||||||
Provides: /bin/ksh /usr/bin/ksh
|
Provides: /bin/ksh /usr/bin/ksh
|
||||||
BuildRequires: meson gcc glibc-devel ed
|
BuildRequires: meson gcc glibc-devel ed
|
||||||
@ -95,6 +96,9 @@ done
|
|||||||
%config(noreplace) %{_sysconfdir}/binfmt.d/kshcomp.conf
|
%config(noreplace) %{_sysconfdir}/binfmt.d/kshcomp.conf
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Mar 31 2025 Linux_zhang <zhangruifang@h-partners.com>- 1:2020.0.0-12
|
||||||
|
- update sftable memory size before using pipe fd as index of fdstatus
|
||||||
|
|
||||||
* Tue May 7 2024 wangyuhang <wangyuhang27@huawei.com> - 1:2020.0.0-11
|
* Tue May 7 2024 wangyuhang <wangyuhang27@huawei.com> - 1:2020.0.0-11
|
||||||
- solve the problem of dereference null return value when moving a job to the head of the linked list and reorder patches
|
- solve the problem of dereference null return value when moving a job to the head of the linked list and reorder patches
|
||||||
|
|
||||||
|
|||||||
39
update-sftable-memory-size-before-using-p.patch
Normal file
39
update-sftable-memory-size-before-using-p.patch
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
From f9e4914c562edea76ee12c1d0bffba19cfee3994 Mon Sep 17 00:00:00 2001
|
||||||
|
From: chenjiayi <chenjiayi22@huawei.com>
|
||||||
|
Date: Sun, 16 Mar 2025 16:10:17 +0800
|
||||||
|
Subject: [PATCH 1/1] ksh: update sftable memory size before using pipe fd as index of fdstatus
|
||||||
|
|
||||||
|
---
|
||||||
|
src/cmd/ksh93/sh/io.c | 10 ++++++++--
|
||||||
|
1 file changed, 8 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/cmd/ksh93/sh/io.c b/src/cmd/ksh93/sh/io.c
|
||||||
|
index 4cbfa75..3b897ef 100644
|
||||||
|
--- a/src/cmd/ksh93/sh/io.c
|
||||||
|
+++ b/src/cmd/ksh93/sh/io.c
|
||||||
|
@@ -746,14 +746,20 @@ void sh_rpipe(int pv[]) {
|
||||||
|
errormsg(SH_DICT, ERROR_system(1), e_pipe);
|
||||||
|
__builtin_unreachable();
|
||||||
|
}
|
||||||
|
- shp->fdstatus[pv[0]] = IONOSEEK | IOREAD | IOCLEX;
|
||||||
|
- shp->fdstatus[pv[1]] = IONOSEEK | IOWRITE | IOCLEX;
|
||||||
|
+
|
||||||
|
#if !_lib_pipe2
|
||||||
|
if (pv[0] > 2) (void)fcntl(pv[0], F_SETFD, FD_CLOEXEC);
|
||||||
|
if (pv[1] > 2) (void)fcntl(pv[1], F_SETFD, FD_CLOEXEC);
|
||||||
|
#endif
|
||||||
|
if (pv[0] <= 2) pv[0] = sh_iomovefd(shp, pv[0]);
|
||||||
|
if (pv[1] <= 2) pv[1] = sh_iomovefd(shp, pv[1]);
|
||||||
|
+
|
||||||
|
+ if (!sh_iovalidfd(shp, pv[0])) abort();
|
||||||
|
+ if (!sh_iovalidfd(shp, pv[1])) abort();
|
||||||
|
+
|
||||||
|
+ shp->fdstatus[pv[0]] = IONOSEEK | IOREAD | IOCLEX;
|
||||||
|
+ shp->fdstatus[pv[1]] = IONOSEEK | IOWRITE | IOCLEX;
|
||||||
|
+
|
||||||
|
sh_subsavefd(pv[0]);
|
||||||
|
sh_subsavefd(pv[1]);
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user