Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Musl
提交
dafef346
T
Third Party Musl
项目概览
OpenHarmony
/
Third Party Musl
大约 1 年 前同步成功
通知
37
Star
125
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Musl
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
dafef346
编写于
8月 30, 2022
作者:
G
ganlan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update test script and rename fortity macro
Signed-off-by:
N
ganlan
<
tony.gan@huawei.com
>
上级
f451e8a1
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
33 addition
and
24 deletion
+33
-24
libc-test/src/functionalext/fortify/string.c
libc-test/src/functionalext/fortify/string.c
+7
-5
libc-test/src/functionalext/fortify/unistd.c
libc-test/src/functionalext/fortify/unistd.c
+1
-0
libc-test/test_template.gni
libc-test/test_template.gni
+4
-1
porting/linux/user/include/fortify/fortify.h
porting/linux/user/include/fortify/fortify.h
+11
-11
porting/linux/user/include/fortify/stdlib.h
porting/linux/user/include/fortify/stdlib.h
+1
-1
porting/linux/user/include/fortify/unistd.h
porting/linux/user/include/fortify/unistd.h
+3
-3
porting/linux/user/src/fortify/fortify.c
porting/linux/user/src/fortify/fortify.c
+1
-0
scripts/runtest.sh
scripts/runtest.sh
+2
-0
scripts/runtest_Windows.bat
scripts/runtest_Windows.bat
+3
-3
未找到文件。
libc-test/src/functionalext/fortify/string.c
浏览文件 @
dafef346
...
@@ -12,13 +12,15 @@
...
@@ -12,13 +12,15 @@
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
#include <errno.h>
#include <errno.h>
#include <limits.h>
#include <signal.h>
#include <signal.h>
#include <stdlib.h>
#include <stdlib.h>
#include <string.h>
#include <string.h>
#include <sys/wait.h>
#include <sys/wait.h>
#include "fortify_test.h"
#include "fortify_test.h"
#include "test.h"
#include "test.h"
#define SIZE_1 1
#define SIZE_1 1
#define SIZE_5 5
#define SIZE_5 5
...
@@ -556,7 +558,7 @@ static void test_strlcpy_0020()
...
@@ -556,7 +558,7 @@ static void test_strlcpy_0020()
};
};
sigaction
(
SIGABRT
,
&
sigabrt
,
NULL
);
sigaction
(
SIGABRT
,
&
sigabrt
,
NULL
);
char
src
[
SIZE_15
];
char
src
[
SIZE_15
];
char
dst
[
SIZE_10
];
char
dst
[
SIZE_10
];
strcpy
(
src
,
STRLEN_14
);
strcpy
(
src
,
STRLEN_14
);
...
@@ -781,7 +783,7 @@ static void test_memcpy_0020()
...
@@ -781,7 +783,7 @@ static void test_memcpy_0020()
};
};
sigaction
(
SIGABRT
,
&
sigabrt
,
NULL
);
sigaction
(
SIGABRT
,
&
sigabrt
,
NULL
);
int
status
;
int
status
;
char
dst
[
SIZE_10
];
char
dst
[
SIZE_10
];
int
pid
=
fork
();
int
pid
=
fork
();
...
@@ -827,7 +829,7 @@ static void test_memset_0020()
...
@@ -827,7 +829,7 @@ static void test_memset_0020()
.
sa_handler
=
SignalHandler
,
.
sa_handler
=
SignalHandler
,
};
};
sigaction
(
SIGABRT
,
&
sigabrt
,
NULL
);
sigaction
(
SIGABRT
,
&
sigabrt
,
NULL
);
char
buf
[
SIZE_10
];
char
buf
[
SIZE_10
];
size_t
n
=
atoi
(
EQ_11
);
size_t
n
=
atoi
(
EQ_11
);
int
status
;
int
status
;
...
@@ -856,7 +858,7 @@ static void test_strlen_0010()
...
@@ -856,7 +858,7 @@ static void test_strlen_0010()
.
sa_handler
=
SignalHandler
,
.
sa_handler
=
SignalHandler
,
};
};
sigaction
(
SIGABRT
,
&
sigabrt
,
NULL
);
sigaction
(
SIGABRT
,
&
sigabrt
,
NULL
);
char
buf
[
SIZE_10
];
char
buf
[
SIZE_10
];
memcpy
(
buf
,
STRLEN_10
,
sizeof
(
buf
));
memcpy
(
buf
,
STRLEN_10
,
sizeof
(
buf
));
int
status
;
int
status
;
...
...
libc-test/src/functionalext/fortify/unistd.c
浏览文件 @
dafef346
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
*/
*/
#include <fcntl.h>
#include <fcntl.h>
#include <limits.h>
#include <unistd.h>
#include <unistd.h>
#include <signal.h>
#include <signal.h>
#include <string.h>
#include <string.h>
...
...
libc-test/test_template.gni
浏览文件 @
dafef346
...
@@ -125,7 +125,10 @@ template("test_unittest") {
...
@@ -125,7 +125,10 @@ template("test_unittest") {
}
}
if (target_dir == "functionalext/fortify") {
if (target_dir == "functionalext/fortify") {
defines = [ "MUSL_FORTIFY_SOURCE=2" ]
if (!defined(defines)) {
defines = []
}
defines += [ "MUSL_FORTIFY_SOURCE=2" ]
}
}
if (target_dir == "functionalext/ldso_randomization") {
if (target_dir == "functionalext/ldso_randomization") {
...
...
porting/linux/user/include/fortify/fortify.h
浏览文件 @
dafef346
...
@@ -39,22 +39,22 @@ extern "C" {
...
@@ -39,22 +39,22 @@ extern "C" {
#endif
#endif
#if defined(__LP64__)
#if defined(__LP64__)
#ifndef LONG_MAX
#ifndef
FORTIFY_
LONG_MAX
#define LONG_MAX 0x7fffffffffffffffL
#define
FORTIFY_
LONG_MAX 0x7fffffffffffffffL
#endif
#endif
#ifndef SSIZE_MAX
#ifndef
FORTIFY_
SSIZE_MAX
#define
SSIZE_MAX
LONG_MAX
#define
FORTIFY_SSIZE_MAX FORTIFY_
LONG_MAX
#endif
#endif
#else
#else
#ifndef LONG_MAX
#ifndef
FORTIFY_
LONG_MAX
#define LONG_MAX 0x7fffffffL
#define
FORTIFY_
LONG_MAX 0x7fffffffL
#endif
#endif
#ifndef SSIZE_MAX
#ifndef
FORTIFY_
SSIZE_MAX
#define
SSIZE_MAX
LONG_MAX
#define
FORTIFY_SSIZE_MAX FORTIFY_
LONG_MAX
#endif
#endif
#endif
#endif
#ifndef PATH_MAX
#ifndef
FORTIFY_
PATH_MAX
#define PATH_MAX 4096
#define
FORTIFY_
PATH_MAX 4096
#endif
#endif
#define __DIAGNOSE_ALWAYS_INLINE __attribute__((__always_inline__))
#define __DIAGNOSE_ALWAYS_INLINE __attribute__((__always_inline__))
...
@@ -122,7 +122,7 @@ extern "C" {
...
@@ -122,7 +122,7 @@ extern "C" {
#define CALLED_WITH_STRING_BIGGER_BUFFER "called with string bigger than buffer"
#define CALLED_WITH_STRING_BIGGER_BUFFER "called with string bigger than buffer"
#define FD_COUNT_LARGE_GIVEN_BUFFER "fd_count is larger than the given buffer"
#define FD_COUNT_LARGE_GIVEN_BUFFER "fd_count is larger than the given buffer"
#define CALLED_WITH_SIZE_BIGGER_BUFFER "called with size bigger than buffer"
#define CALLED_WITH_SIZE_BIGGER_BUFFER "called with size bigger than buffer"
#define OUTPUT_PARAMETER_BYTES "output parameter must be NULL or a pointer to a buffer with >= PATH_MAX bytes"
#define OUTPUT_PARAMETER_BYTES "output parameter must be NULL or a pointer to a buffer with >=
FORTIFY_
PATH_MAX bytes"
#define SIZE_LARGER_THEN_DESTINATION_BUFFER "size is larger than the destination buffer"
#define SIZE_LARGER_THEN_DESTINATION_BUFFER "size is larger than the destination buffer"
void
__fortify_error
(
const
char
*
info
,
...);
void
__fortify_error
(
const
char
*
info
,
...);
...
...
porting/linux/user/include/fortify/stdlib.h
浏览文件 @
dafef346
...
@@ -26,7 +26,7 @@ extern "C" {
...
@@ -26,7 +26,7 @@ extern "C" {
#if defined(_GNU_SOURCE) && defined(__FORTIFY_COMPILATION)
#if defined(_GNU_SOURCE) && defined(__FORTIFY_COMPILATION)
char
*
realpath
(
const
char
*
path
,
char
*
resolved
)
char
*
realpath
(
const
char
*
path
,
char
*
resolved
)
__DIAGNOSE_ERROR_IF
(
!
path
,
"'realpath': NULL path is never correct; flipped arguments?"
)
__DIAGNOSE_ERROR_IF
(
!
path
,
"'realpath': NULL path is never correct; flipped arguments?"
)
__DIAGNOSE_ERROR_IF
(
__DIAGNOSE_UNEVALUATED_LT
(
__DIAGNOSE_BOS
(
resolved
),
PATH_MAX
),
__DIAGNOSE_ERROR_IF
(
__DIAGNOSE_UNEVALUATED_LT
(
__DIAGNOSE_BOS
(
resolved
),
FORTIFY_
PATH_MAX
),
"'realpath' "
OUTPUT_PARAMETER_BYTES
);
"'realpath' "
OUTPUT_PARAMETER_BYTES
);
#endif
#endif
#ifdef __cplusplus
#ifdef __cplusplus
...
...
porting/linux/user/include/fortify/unistd.h
浏览文件 @
dafef346
...
@@ -26,15 +26,15 @@ extern "C" {
...
@@ -26,15 +26,15 @@ extern "C" {
#if defined(__FORTIFY_COMPILATION)
#if defined(__FORTIFY_COMPILATION)
#define __DIAGNOSE_ERROR_IF_OVERFLOWS_SSIZET(what, fn) \
#define __DIAGNOSE_ERROR_IF_OVERFLOWS_SSIZET(what, fn) \
__DIAGNOSE_ERROR_IF((what) >
SSIZE_MAX, "in call to '" #fn "', '" #what "' must be <=
SSIZE_MAX")
__DIAGNOSE_ERROR_IF((what) >
FORTIFY_SSIZE_MAX, "in call to '" #fn "', '" #what "' must be <= FORTIFY_
SSIZE_MAX")
#define __DIAGNOSE_ERROR_IF_OVERFLOWS_OBJECTSIZE(what, objsize, fn) \
#define __DIAGNOSE_ERROR_IF_OVERFLOWS_OBJECTSIZE(what, objsize, fn) \
__DIAGNOSE_ERROR_IF(__DIAGNOSE_UNEVALUATED_LT((objsize), (what)), \
__DIAGNOSE_ERROR_IF(__DIAGNOSE_UNEVALUATED_LT((objsize), (what)), \
"in call to '" #fn "', '" #what "' bytes overflows the given object")
"in call to '" #fn "', '" #what "' bytes overflows the given object")
#define __DIAGNOSE_BOS_TRIVIALLY_GE_NO_OVERFLOW(bos_val, index) \
#define __DIAGNOSE_BOS_TRIVIALLY_GE_NO_OVERFLOW(bos_val, index) \
((__DIAGNOSE_BOS_DYNAMIC_CHECK_IMPL_AND((bos_val), >=, (index), (bos_val) <= (SSIZE_MAX)) && \
((__DIAGNOSE_BOS_DYNAMIC_CHECK_IMPL_AND((bos_val), >=, (index), (bos_val) <= (
FORTIFY_
SSIZE_MAX)) && \
__builtin_constant_p(index) && (index) <= (SSIZE_MAX)))
__builtin_constant_p(index) && (index) <= (
FORTIFY_
SSIZE_MAX)))
char
*
__getcwd_chk
(
char
*
,
size_t
,
size_t
)
;
char
*
__getcwd_chk
(
char
*
,
size_t
,
size_t
)
;
...
...
porting/linux/user/src/fortify/fortify.c
浏览文件 @
dafef346
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
#include <fortify/fortify.h>
#include <fortify/fortify.h>
#include <fcntl.h>
#include <fcntl.h>
#include <limits.h>
#include <poll.h>
#include <poll.h>
#include <stdarg.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdbool.h>
...
...
scripts/runtest.sh
浏览文件 @
dafef346
...
@@ -22,6 +22,8 @@ do
...
@@ -22,6 +22,8 @@ do
do
do
if
[
"
$(
FileSuffix
${
file
}
)
"
=
"so"
]
\
if
[
"
$(
FileSuffix
${
file
}
)
"
=
"so"
]
\
||
[
"
$file
"
=
"trace_stresstest"
]
\
||
[
"
$file
"
=
"trace_stresstest"
]
\
||
[
"
$file
"
=
"fatal_message"
]
\
||
[
"
$file
"
=
"tgkill"
]
\
||
[
-d
./
$subdir
/
$file
]
||
[
-d
./
$subdir
/
$file
]
then
then
continue
continue
...
...
scripts/runtest_Windows.bat
浏览文件 @
dafef346
...
@@ -105,7 +105,7 @@ hdc shell cp %REMOTEFEXT%/dlns/libdlopen_ns_dso.so %REMOTEFEXT%/dlns/inherit_030
...
@@ -105,7 +105,7 @@ hdc shell cp %REMOTEFEXT%/dlns/libdlopen_ns_dso.so %REMOTEFEXT%/dlns/inherit_030
hdc
shell
cp
%REMOTEFEXT%
/dlns/libdlopen
_ns_dso.so
%REMOTEFEXT%
/dlns/inherit
_0700.so
hdc
shell
cp
%REMOTEFEXT%
/dlns/libdlopen
_ns_dso.so
%REMOTEFEXT%
/dlns/inherit
_0700.so
hdc
shell
cp
%REMOTEFEXT%
/dlns/libdlopen
_ns_dso.so
%REMOTEFEXT%
/dlns/inherit
_0800.so
hdc
shell
cp
%REMOTEFEXT%
/dlns/libdlopen
_ns_dso.so
%REMOTEFEXT%
/dlns/inherit
_0800.so
hdc
shell
cp
%REMOTEFEXT%
/dlns/libdlopen
_ns_dso.so
%REMOTEFEXT%
/dlns/inherit
_1100.so
hdc
shell
cp
%REMOTEFEXT%
/dlns/libdlopen
_ns_dso.so
%REMOTEFEXT%
/dlns/inherit
_1100.so
hdc
shell
mv
/etc/ld-musl-namespace-arm
.ini
/etc/ld-musl-namespace-arm-temp
.ini
hdc
shell
cp
/etc/ld-musl-namespace-arm
.ini
/etc/ld-musl-namespace-arm-temp
.ini
hdc
shell
mv
/etc/ld-musl-namespace-arm-test
.ini
/etc/ld-musl-namespace-arm
.ini
hdc
shell
mv
/etc/ld-musl-namespace-arm-test
.ini
/etc/ld-musl-namespace-arm
.ini
...
@@ -136,9 +136,9 @@ echo The test cases have been executed.
...
@@ -136,9 +136,9 @@ echo The test cases have been executed.
@REM 恢复现场
@REM 恢复现场
echo
Start
restore
the
scene
echo
Start
restore
the
scene
echo
hdc
shell
mv
/etc/ld-musl-namespace-arm
.ini
/etc/ld-musl-namespace-arm-test
.in
herit_0300
echo
hdc
shell
mv
/etc/ld-musl-namespace-arm
.ini
/etc/ld-musl-namespace-arm-test
.in
i
echo
...
echo
...
hdc
shell
mv
/etc/ld-musl-namespace-arm
.ini
/etc/ld-musl-namespace-arm-test
.ini
hdc
shell
cp
/etc/ld-musl-namespace-arm
.ini
/etc/ld-musl-namespace-arm-test
.ini
hdc
shell
mv
/etc/ld-musl-namespace-arm-temp
.ini
/etc/ld-musl-namespace-arm
.ini
hdc
shell
mv
/etc/ld-musl-namespace-arm-temp
.ini
/etc/ld-musl-namespace-arm
.ini
hdc
shell
rm
%REMOTEFEXT%
/dlns/sharedlibtest
.so
-rf
hdc
shell
rm
%REMOTEFEXT%
/dlns/sharedlibtest
.so
-rf
hdc
shell
rm
%REMOTEFEXT%
/dlns/B/libB
.so
-rf
hdc
shell
rm
%REMOTEFEXT%
/dlns/B/libB
.so
-rf
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录