Compare commits

...

18 Commits

Author SHA1 Message Date
openharmony_ci 3936764b25
!1179 fix: /dev/mem 及 /proc/fs_cache 权限漏洞修复挑单到3.2-Release分支
Merge pull request !1179 from yinjiaming/cherry-pick-1697592111
2023-10-26 08:37:50 +00:00
yinjiaming df25cc00a5 fixed 6daecc8 from https://gitee.com/hgbveiu743/kernel_liteos_a/pulls/1178
fix: /dev/mem 及 /proc/fs_cache 权限漏洞修复
/dev/mem 和 /proc/fs_cache 存在多余的读写权限,
有被低权限者利用进行攻击的风险,现予以修复。

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: Ie6b537e8cb1de7353dfc357411eba4920a539b4f
2023-10-18 01:21:52 +00:00
openharmony_ci f4c3ac7c38
!1177 SysMqNotify系统调用安全增强
Merge pull request !1177 from 乔克叔叔/cherry-pick-1695689883
2023-09-26 02:10:00 +00:00
zhangdengyu ada7e138cc fixed 27eb4e2 from https://gitee.com/wenxin-liu_admin/kernel_liteos_a/pulls/1174
fix:SysMqNotify系统调用安全增强

Close: #I7YG58

Signed-off-by: zhangdengyu <zhangdengyu2@huawei.com>
Change-Id: Iee5a6c24cd2226e9cab0c4fd37e76194ad068862
2023-09-26 00:58:03 +00:00
openharmony_ci e46f96de46
!1170 挑单swtmr遍历不全导致的用例问题到3.2
Merge pull request !1170 from wangchen/0726_32
2023-07-29 01:55:55 +00:00
wangchen 82f06317c5 Fix: 挑单swtmr遍历不全导致的用例问题到3.2
Close #I7O084
Signed-off-by: wangchen <wangchen240@huawei.com>
2023-07-26 09:54:00 +08:00
openharmony_ci 379aa8dd27
!1130 【同步到monthly_20221018分支】fix:修复内核调用栈解析脚本bug
Merge pull request !1130 from zhangdengyu/cherry-pick-1677501665
2023-03-06 04:17:04 +00:00
zhangdengyu 3b2c37aa66 fixed f924cc7 from https://gitee.com/zhangdengyu/kernel_liteos_a/pulls/1129
fix:修复内核调用栈解析脚本bug

方案描述:
1、修复内核调用栈解析脚本parse_mem_info.sh的bug,将多余符号(`)去除

BREAKING CHANGE:
无

Close:#I6I6BA

Signed-off-by: zhangdengyu <zhangdengyu2@huawei.com>
Change-Id: I0b0d7e5f6e79313e5f517f89395f4195883cfe06
2023-02-27 12:41:06 +00:00
openharmony_ci f7dbd27a33
!1111 Fix : 删除冗余函数挑单到monthly_20221018分支
Merge pull request !1111 from yinjiaming/cherry-pick-1675760069
2023-02-09 02:01:05 +00:00
yinjiaming 0b3430e574 fixed d17bc9d from https://gitee.com/hgbveiu743/kernel_liteos_a/pulls/1109
fix:删除冗余的函数
代码扫描工具发现代码中有被注释的多余函数,现删除。

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I26980061390924d53c77e467b2cab2f56b192a82
2023-02-07 08:54:29 +00:00
openharmony_ci 518d448a2f
!1093 Fix : 内核告警清理挑单到monthly_20221018
Merge pull request !1093 from yinjiaming/cherry-pick-1672881303
2023-01-06 11:29:40 +00:00
yinjiaming 05b07a29fe fixed ebc3f30 from https://gitee.com/hgbveiu743/kernel_liteos_a/pulls/1089
fix:修复codecheck扫描出的告警
给宏定义中的参数加上了括号,删除了多余的函数声明

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: I8853f6a9717ede96578cd674b83b716c8e63f0d8
2023-01-05 01:15:05 +00:00
openharmony_ci 2bef65046a
!1081 fix: 【挑单】codecheck问题清零
Merge pull request !1081 from zhushengle/cherry-pick-1669685670
2022-11-29 03:20:11 +00:00
zhushengle 205df75f15 fixed 8d980de from https://gitee.com/zhushengle/kernel_liteos_a/pulls/1078
fix: codecheck问题清零

1.shell初始化异常流程double free
2.los_disk_init中冗余初始化
3.OsKProcessPmUsage 中OsUProcessPmUsage异常退出时,存在使用未初始化的变量
4.HiLogHeadInit异常推出后,存在使用未初始化的变量
5.api_shell.c 中存在冗余初始化

fix #I63H5G

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: If17d8ed1e6f2276e20fbce24b32de169bfd22e54
2022-11-29 01:34:30 +00:00
openharmony_ci 85f1c9e0ca
!1067 【挑单】time相关系统调用内核栈信息泄露排查
Merge pull request !1067 from zhushengle/cherry-pick-1668158211
2022-11-14 03:24:57 +00:00
zhushengle c04ff6b10f fixed 0b05a46 from https://gitee.com/zhushengle/kernel_liteos_a/pulls/1061
task: time相关系统调用内核栈信息泄露排查

解决方案:
    在涉及从内核拷贝数据到用户态的场景时,先将内核的数据进行清零操作,再填充内核数据
Close #I60M1P

Signed-off-by: zhushengle <zhushengle@huawei.com>
Change-Id: Ia61d4e39b9e190accea477ff5b361e41d0eed2af
2022-11-11 09:16:52 +00:00
openharmony_ci 1b61489512
!1048 Fix : 内核告警清理挑单到monthly 分支
Merge pull request !1048 from yinjiaming/cherry-pick-1666774395
2022-10-27 14:24:41 +00:00
yinjiaming 29c459e045 fixed 8d55bb1 from https://gitee.com/hgbveiu743/kernel_liteos_a/pulls/1046
fix: 内核告警清理
【背景】
内核告警清理

【修改方案】
删去了多余的空格,更改了魔数字

【影响】
对现有的产品编译不会有影响。

Signed-off-by: yinjiaming <yinjiaming@huawei.com>
Change-Id: Iba21be6cb23027dfb369576847d7d21e85f936b4
2022-10-26 08:53:15 +00:00
25 changed files with 57 additions and 149 deletions

View File

@ -49,7 +49,7 @@ ShellCB *OsGetShellCb()
return g_shellCB;
}
void ShellDeinit(ShellCB *shellCB)
static void ShellDeinit(ShellCB *shellCB)
{
(void)pthread_mutex_destroy(&shellCB->historyMutex);
(void)pthread_mutex_destroy(&shellCB->keyMutex);
@ -65,27 +65,23 @@ static int OsShellCreateTask(ShellCB *shellCB)
ret = sched_getparam(getpid(), &param);
if (ret != SH_OK) {
goto OUT;
return ret;
}
param.sched_priority = SHELL_PROCESS_PRIORITY_INIT;
ret = sched_setparam(getpid(), &param);
if (ret != SH_OK) {
goto OUT;
return ret;
}
ret = ShellTaskInit(shellCB);
if (ret != SH_OK) {
goto OUT;
return ret;
}
shellCB->shellEntryHandle = pthread_self();
return 0;
OUT:
ShellDeinit(shellCB);
return ret;
}
static int DoShellExec(char **argv)
@ -148,7 +144,7 @@ int main(int argc, char **argv)
shellCB = (ShellCB *)malloc(sizeof(ShellCB));
if (shellCB == NULL) {
goto ERR_OUT1;
return SH_NOK;
}
ret = memset_s(shellCB, sizeof(ShellCB), 0, sizeof(ShellCB));
if (ret != SH_OK) {
@ -176,7 +172,9 @@ int main(int argc, char **argv)
g_shellCB = shellCB;
ret = OsShellCreateTask(shellCB);
if (ret != SH_OK) {
goto ERR_OUT3;
ShellDeinit(shellCB);
g_shellCB = NULL;
return ret;
}
ShellEntry(shellCB);

View File

@ -1465,7 +1465,7 @@ INT32 los_disk_init(const CHAR *diskName, const struct block_operations *bops,
ret = VnodeLookup(diskName, &blkDriver, 0);
if (ret < 0) {
VnodeDrop();
ret = ENOENT;
PRINT_ERR("disk_init : %s, failed to find the vnode, ERRNO=%d\n", diskName, ret);
goto DISK_FIND_ERROR;
}
struct block_operations *bops2 = (struct block_operations *)((struct drv_data *)blkDriver->data)->ops;

View File

@ -97,5 +97,5 @@ static const struct file_operations_vfs g_memDevOps = {
int DevMemRegister(void)
{
return register_driver("/dev/mem", &g_memDevOps, 0666, 0); /* 0666: file mode */
return register_driver("/dev/mem", &g_memDevOps, 0644, 0); /* 0644: file mode */
}

View File

@ -207,7 +207,7 @@ static const struct ProcFileOperations FS_CACHE_PROC_FOPS = {
void ProcFsCacheInit(void)
{
struct ProcDirEntry *pde = CreateProcEntry("fs_cache", 0, NULL);
struct ProcDirEntry *pde = CreateProcEntry("fs_cache", 0400, NULL);
if (pde == NULL) {
PRINT_ERR("create fs_cache error!\n");
return;

View File

@ -583,7 +583,7 @@ STATIC INLINE BOOL SwtmrRunqueueFind(SortLinkAttribute *swtmrSortLink, SCHED_TL_
STATIC BOOL SwtmrTimeListFind(SCHED_TL_FIND_FUNC checkFunc, UINTPTR arg)
{
for (UINT16 cpuid = 0; cpuid < LOSCFG_KERNEL_CORE_NUM; cpuid++) {
SortLinkAttribute *swtmrSortLink = &g_swtmrRunqueue[ArchCurrCpuid()].swtmrSortLink;
SortLinkAttribute *swtmrSortLink = &g_swtmrRunqueue[cpuid].swtmrSortLink;
if (SwtmrRunqueueFind(swtmrSortLink, checkFunc, arg)) {
return TRUE;
}

View File

@ -146,7 +146,6 @@ UINT32 OsKProcessPmUsage(LosVmSpace *kSpace, UINT32 *actualPm)
LosVmSpace *space = NULL;
LOS_DL_LIST *spaceList = NULL;
UINT32 UProcessUsed = 0;
UINT32 pmTmp;
if (actualPm == NULL) {
return 0;
@ -167,8 +166,7 @@ UINT32 OsKProcessPmUsage(LosVmSpace *kSpace, UINT32 *actualPm)
if (space == LOS_GetKVmSpace()) {
continue;
}
(VOID)OsUProcessPmUsage(space, NULL, &pmTmp);
UProcessUsed += pmTmp;
UProcessUsed += OsUProcessPmUsage(space, NULL, NULL);
}
(VOID)LOS_MuxRelease(vmSpaceListMux);

View File

@ -233,14 +233,8 @@ static int HiLogWriteRingBuffer(unsigned char *buffer, size_t bufLen)
static void HiLogHeadInit(struct HiLogEntry *header, size_t len)
{
struct timespec now;
int ret;
ret = clock_gettime(CLOCK_REALTIME, &now);
if (ret != 0) {
PRINTK("In %s line %d,clock_gettime fail\n", __FUNCTION__, __LINE__);
return;
}
struct timespec now = {0};
(void)clock_gettime(CLOCK_REALTIME, &now);
header->len = len;
header->pid = LOS_GetCurrProcessID();

View File

@ -356,7 +356,7 @@ int print_netif(struct netif *netif, char *print_buf, unsigned int buf_len)
buf_len -= (unsigned int)ret;
}
ret = snprintf_s(tmp, buf_len, (buf_len - 1), " %s\n",
ret = snprintf_s(tmp, buf_len, (buf_len - 1), " %s\n",
(netif->flags & NETIF_FLAG_LINK_UP) ? "Link UP" : "Link Down");
if ((ret <= 0) || ((unsigned int)ret >= buf_len))
goto out;
@ -2175,8 +2175,6 @@ u32_t osShellPing6(int argc, const char **argv)
/* Setting the start time of the entire ping task for statistics */
(void)clock_gettime(CLOCK_MONOTONIC_RAW, &first);
nsent = 0;
for (nsent = 0; nsent < ping6_params.pingcount; nsent++) {
/* capture the start tick to calculate rtt */
(void)clock_gettime(CLOCK_MONOTONIC_RAW, &start);
@ -3170,7 +3168,6 @@ void netstat_internal(void *ctx)
}
/* For listen PCBs */
recvQlen = 0;
sendQlen = 0;
for (lpcb = tcp_listen_pcbs.listen_pcbs; lpcb != NULL; lpcb = lpcb->next) {
@ -3670,7 +3667,7 @@ u32_t netdebug_sock(int argc, const char **argv)
int idx;
u32_t ret = LOS_NOK;
if (argc == 2) {
if (argc == 2) { /* 2: Number of command parameters */
if (!strcmp("-i", argv[1])) {
/* netdebug sock -i */
for (idx = 0; idx < (int)LWIP_CONFIG_NUM_SOCKETS; idx++) {
@ -3678,10 +3675,9 @@ u32_t netdebug_sock(int argc, const char **argv)
}
ret = LOS_OK;
}
} else if (argc == 3) {
} else if (argc == 3) { /* 3: Number of command parameters */
if (!strcmp("-d", argv[1])) {
/* netdebug sock -d <idx> */
idx = atoi(argv[2]);
idx = atoi(argv[2]); /* 2: netdebug sock -d <idx> */
if (idx >= 0) {
debug_socket_info(idx, 1, 1);
ret = LOS_OK;

View File

@ -94,9 +94,15 @@ int SysMqClose(mqd_t personal)
int SysMqNotify(mqd_t personal, const struct sigevent *sigev)
{
int ret;
struct sigevent ksigev;
ret = LOS_ArchCopyFromUser(&ksigev, sigev, sizeof(struct sigevent));
if (ret != 0) {
return -EFAULT;
}
MQUEUE_FD_U2K(personal);
ret = OsMqNotify(personal, sigev);
ret = OsMqNotify(personal, &ksigev);
if (ret < 0) {
return -get_errno();
}

View File

@ -109,7 +109,7 @@ int SysSetiTimer(int which, const struct itimerval *value, struct itimerval *ova
{
int ret;
struct itimerval svalue;
struct itimerval sovalue;
struct itimerval sovalue = { 0 };
if (value == NULL) {
errno = EINVAL;
@ -137,7 +137,7 @@ int SysSetiTimer(int which, const struct itimerval *value, struct itimerval *ova
int SysGetiTimer(int which, struct itimerval *value)
{
int ret;
struct itimerval svalue;
struct itimerval svalue = { 0 };
if (value == NULL) {
errno = EINVAL;
@ -189,7 +189,7 @@ int SysTimerCreate(clockid_t clockID, struct ksigevent *evp, timer_t *timerID)
int SysTimerGettime(timer_t timerID, struct itimerspec *value)
{
int ret;
struct itimerspec svalue;
struct itimerspec svalue = { 0 };
if (value == NULL) {
errno = EINVAL;
@ -213,7 +213,7 @@ int SysTimerSettime(timer_t timerID, int flags, const struct itimerspec *value,
{
int ret;
struct itimerspec svalue;
struct itimerspec soldValue;
struct itimerspec soldValue = { 0 };
if (value == NULL) {
errno = EINVAL;
@ -285,7 +285,7 @@ int SysClockSettime(clockid_t clockID, const struct timespec *tp)
int SysClockGettime(clockid_t clockID, struct timespec *tp)
{
int ret;
struct timespec stp;
struct timespec stp = { 0 };
if (tp == NULL) {
errno = EINVAL;
@ -308,7 +308,7 @@ int SysClockGettime(clockid_t clockID, struct timespec *tp)
int SysClockGetres(clockid_t clockID, struct timespec *tp)
{
int ret;
struct timespec stp;
struct timespec stp = { 0 };
if (tp == NULL) {
errno = EINVAL;
@ -356,7 +356,7 @@ int SysNanoSleep(const struct timespec *rqtp, struct timespec *rmtp)
{
int ret;
struct timespec srqtp;
struct timespec srmtp;
struct timespec srmtp = { 0 };
if (!rqtp || LOS_ArchCopyFromUser(&srqtp, rqtp, sizeof(struct timespec))) {
errno = EFAULT;
@ -384,7 +384,7 @@ int SysNanoSleep(const struct timespec *rqtp, struct timespec *rmtp)
clock_t SysTimes(struct tms *buf)
{
clock_t ret;
struct tms sbuf;
struct tms sbuf = { 0 };
if (buf == NULL) {
errno = EFAULT;
@ -436,7 +436,7 @@ int SysClockGettime64(clockid_t clockID, struct timespec64 *tp)
{
int ret;
struct timespec t;
struct timespec64 stp;
struct timespec64 stp = { 0 };
if (tp == NULL) {
errno = EINVAL;
@ -463,7 +463,7 @@ int SysClockGetres64(clockid_t clockID, struct timespec64 *tp)
{
int ret;
struct timespec t;
struct timespec64 stp;
struct timespec64 stp = { 0 };
if (tp == NULL) {
errno = EINVAL;
@ -525,7 +525,7 @@ int SysTimerGettime64(timer_t timerID, struct itimerspec64 *value)
{
int ret;
struct itimerspec val;
struct itimerspec64 svalue;
struct itimerspec64 svalue = { 0 };
if (value == NULL) {
errno = EINVAL;
@ -584,6 +584,7 @@ int SysTimerSettime64(timer_t timerID, int flags, const struct itimerspec64 *val
}
if (oldValue != NULL) {
(void)memset_s(&soldValue, sizeof(struct itimerspec64), 0, sizeof(struct itimerspec64));
soldValue.it_interval.tv_sec = oldVal.it_interval.tv_sec;
soldValue.it_interval.tv_nsec = oldVal.it_interval.tv_nsec;
soldValue.it_value.tv_sec = oldVal.it_value.tv_sec;

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@ -31,6 +31,7 @@
#include "it_test_shm.h"
#define SHMID_MAX 192
#define SHM_FLAG 0777
static int Testcase(VOID)
{
@ -44,24 +45,24 @@ static int Testcase(VOID)
ICUNIT_ASSERT_EQUAL(ret, SHMID_MAX, ret);
leftShmIds = SHMID_MAX - shmInfo.used_ids;
shmid[0] = shmget((key_t)0x1234, PAGE_SIZE, 0777 | IPC_CREAT);
shmid[0] = shmget((key_t)0x1234, PAGE_SIZE, SHM_FLAG | IPC_CREAT); // 0x1234: a key used to create shared memory
ICUNIT_ASSERT_NOT_EQUAL(shmid[0], -1, shmid[0]);
ret = shmctl(shmid[0], IPC_RMID, NULL);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
shmid[0] = shmget(IPC_PRIVATE, PAGE_SIZE, 0777 | IPC_CREAT);
shmid[0] = shmget(IPC_PRIVATE, PAGE_SIZE, SHM_FLAG | IPC_CREAT);
ICUNIT_ASSERT_NOT_EQUAL(shmid[0], -1, shmid[0]);
ret = shmctl(shmid[0], IPC_RMID, NULL);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
for (i = 0; i < leftShmIds; i++) {
shmid[i] = shmget(IPC_PRIVATE, PAGE_SIZE, 0777 | IPC_CREAT);
shmid[i] = shmget(IPC_PRIVATE, PAGE_SIZE, SHM_FLAG | IPC_CREAT);
ICUNIT_ASSERT_NOT_EQUAL(shmid[i], -1, shmid[i]);
}
shmid[leftShmIds] = shmget(IPC_PRIVATE, PAGE_SIZE, 0777 | IPC_CREAT);
shmid[leftShmIds] = shmget(IPC_PRIVATE, PAGE_SIZE, SHM_FLAG | IPC_CREAT);
ICUNIT_ASSERT_EQUAL(shmid[leftShmIds], -1, shmid[leftShmIds]);
for (i = 0; i < leftShmIds; i++) {

View File

@ -55,7 +55,6 @@ static int Testcase(VOID)
ICUNIT_GOTO_EQUAL(ds.shm_perm.uid, getuid(), ds.shm_perm.uid, ERROR_OUT);
ret = shmctl(shmid, SHM_STAT, &ds);
// ICUNIT_GOTO_EQUAL(ret, 0x10000, ret, ERROR_OUT);
ICUNIT_GOTO_NOT_EQUAL(ret, -1, ret, ERROR_OUT);
ICUNIT_GOTO_NOT_EQUAL(ret, 0, ret, ERROR_OUT);
@ -70,7 +69,7 @@ static int Testcase(VOID)
ICUNIT_GOTO_EQUAL(info.shmmax, 0x1000000, info.shmmax, ERROR_OUT);
ICUNIT_GOTO_EQUAL(info.shmmin, 1, info.shmmin, ERROR_OUT);
ICUNIT_GOTO_EQUAL(info.shmmni, 192, info.shmmni, ERROR_OUT);
ICUNIT_GOTO_EQUAL(info.shmseg, 128, info.shmseg, ERROR_OUT);
ICUNIT_GOTO_EQUAL(info.shmseg, 128, info.shmseg, ERROR_OUT); // 128: expected value of shmseg
ICUNIT_GOTO_EQUAL(info.shmall, 0x1000, info.shmall, ERROR_OUT);
ret = shmdt(shm);

View File

@ -63,13 +63,11 @@ static int LiteIpcTest(void)
/* testing mmap liteipc mem pool with different size and flag */
retptr = mmap(nullptr, 1024 * 4096, PROT_READ, MAP_PRIVATE, fd, 0);
ICUNIT_ASSERT_EQUAL(static_cast<int>(static_cast<intptr_t>(retptr)), -1, retptr);
//retptr = mmap(nullptr, 0, PROT_READ, MAP_PRIVATE, fd, 0);
//ICUNIT_ASSERT_EQUAL((int)(intptr_t)retptr, -1, retptr);
retptr = mmap(nullptr, -1, PROT_READ, MAP_PRIVATE, fd, 0);
ICUNIT_ASSERT_EQUAL(static_cast<int>(static_cast<intptr_t>(retptr)), -1, retptr);
retptr = mmap(nullptr, 4096, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
ICUNIT_ASSERT_EQUAL(static_cast<int>(static_cast<intptr_t>(retptr)), -1, retptr);
retptr = mmap(nullptr, 4096, PROT_READ, MAP_SHARED, fd, 0);
retptr = mmap(nullptr, 4096, PROT_READ, MAP_SHARED, fd, 0); // 4096: length of mapped memory
ICUNIT_ASSERT_EQUAL(static_cast<int>(static_cast<intptr_t>(retptr)), -1, retptr);
retptr = mmap(nullptr, 1, PROT_READ, MAP_PRIVATE, fd, 0);
@ -81,7 +79,7 @@ static int LiteIpcTest(void)
char buf[10] = {0};
ret = read(fd, buf, 10);
ICUNIT_ASSERT_EQUAL(ret, -1, ret);
ret = write(fd, buf, 10);
ret = write(fd, buf, 10); // 10: size of buf
ICUNIT_ASSERT_EQUAL(ret, -1, ret);
/* before set cms, testing ioctl cmd */
@ -96,7 +94,7 @@ static int LiteIpcTest(void)
sleep(2);
/* after set cms, testing set cms cmd */
ret = ioctl(fd, IPC_SET_CMS, 200);
ret = ioctl(fd, IPC_SET_CMS, 200); // 200: use 200 for set cms cmd testing
ICUNIT_ASSERT_NOT_EQUAL(ret, 0, ret);
exit(0);

View File

@ -60,17 +60,6 @@ static int TestCase()
exit(0);
}
/* sig = SIGTERM;
ret = sigaction(sig, (struct sigaction *)1, &oldAct);
printf("ret == %d\n", ret);
ICUNIT_ASSERT_EQUAL(ret, -1, ret);
ICUNIT_ASSERT_EQUAL(errno, EFAULT, errno);
ret = sigaction(sig, &sigAct, (struct sigaction *)1);
printf("ret === %d\n", ret);
ICUNIT_ASSERT_EQUAL(ret, -1, ret);
ICUNIT_ASSERT_EQUAL(errno, EFAULT, errno); */
ret = waitpid(fpid, &status, 0);
ICUNIT_ASSERT_EQUAL(ret, fpid, ret);
ICUNIT_ASSERT_EQUAL(WEXITSTATUS(status), 0, WEXITSTATUS(status));

View File

@ -37,7 +37,6 @@ static UINT32 testcase(VOID)
time_t currtime;
struct tm *timer = {nullptr};
char buffer[80];
//locale_t loc = malloc(sizeof(locale_t);
time(&currtime);
timer = localtime(&currtime);
@ -46,17 +45,17 @@ static UINT32 testcase(VOID)
printf("getenv MUSL_LOCPATH=%s\n", getenv("MUSL_LOCPATH"));
printf("Locale is: %s\n", setlocale(LC_TIME, "en_US.UTF-8"));
strftime(buffer, 80, "%c", timer);
(void)strftime(buffer, sizeof(buffer), "%c", timer);
printf("Date is: %s\n", buffer);
ICUNIT_ASSERT_NOT_EQUAL_NULL(buffer, NULL, -1);
printf("Locale is: %s\n", setlocale(LC_TIME, "zh_CN.UTF-8"));
strftime(buffer, 80, "%c", timer);
(void)strftime(buffer, sizeof(buffer), "%c", timer);
printf("Date is: %s\n", buffer);
ICUNIT_ASSERT_NOT_EQUAL_NULL(buffer, NULL, -1);
printf("Locale is: %s\n", setlocale(LC_TIME, ""));
strftime(buffer, 80, "%c", timer);
(void)strftime(buffer, sizeof(buffer), "%c", timer);
printf("Date is: %s\n", buffer);
ICUNIT_ASSERT_NOT_EQUAL_NULL(buffer, NULL, -1);
setlocale(LC_ALL, "C");

View File

@ -145,26 +145,6 @@ HWTEST_F(MiscTest, ItTestMisc009, TestSize.Level0)
ItTestMisc009();
}
/* *
* @tc.name: IT_TEST_MISC_010
* @tc.desc: function for MiscTest
* @tc.type: FUNC
*/
/*HWTEST_F(MiscTest, ItTestMisc010, TestSize.Level0)
{
ItTestMisc010();
}*/
/* *
* @tc.name: IT_TEST_MISC_011
* @tc.desc: function for MiscTest
* @tc.type: FUNC
*/
/*HWTEST_F(MiscTest, ItTestMisc011, TestSize.Level0)
{
ItTestMisc011();
}*/
/* *
* @tc.name: IT_TEST_MISC_012
* @tc.desc: function for MiscTest
@ -174,16 +154,6 @@ HWTEST_F(MiscTest, ItTestMisc012, TestSize.Level0)
{
ItTestMisc012();
}
/* *
* @tc.name: IT_TEST_MISC_013
* @tc.desc: function for MiscTest
* @tc.type: FUNC
*/
/*HWTEST_F(MiscTest, ItTestMisc013, TestSize.Level0)
{
ItTestMisc013();
}*/
#endif
} // namespace OHOS

View File

@ -56,7 +56,7 @@
#define TEST_HwiTrigger(HWI_NUM_TEST)
#define LOS_TaskLock()
#define LOS_TaskUnlock()
#define LOS_MS2Tick(ms) (ms / 10)
#define LOS_MS2Tick(ms) ((ms) / 10)
#define OS_TASK_PRIORITY_HIGHEST 0
#define OS_TASK_PRIORITY_LOWEST 31
@ -228,12 +228,7 @@ struct testdata {
};
extern struct testdata g_td;
extern unsigned int sleep(unsigned int seconds);
extern unsigned int alarm(unsigned int seconds);
extern int map_errno(UINT32 err);
extern long sysconf(int name);
extern void posix_signal_start(void);
VOID ScenarInit(VOID);

View File

@ -34,7 +34,6 @@ static void *pthread_f01(void *tmp)
{
int rc = 0;
g_testCount++;
// printf("www\n");
/* acquire the mutex */
rc = pthread_mutex_lock(&g_pthreadMutexTest1);
@ -69,7 +68,7 @@ static UINT32 Testcase(VOID)
/* Let the other thread run */
LosTaskDelay(2);
ICUNIT_ASSERT_EQUAL(g_testCount, 2, g_testCount);
ICUNIT_ASSERT_EQUAL(g_testCount, 2, g_testCount); // 2: expected value of g_testCount
/* Try to destroy the cond var. This should return an error */
rc = pthread_cond_destroy(&g_pthreadCondTest1);
@ -79,7 +78,7 @@ static UINT32 Testcase(VOID)
ICUNIT_ASSERT_EQUAL(rc, 0, rc);
LosTaskDelay(2);
ICUNIT_ASSERT_EQUAL(g_testCount, 4, g_testCount);
ICUNIT_ASSERT_EQUAL(g_testCount, 4, g_testCount); // 4: expected value of g_testCount
rc = pthread_cond_destroy(&g_pthreadCondTest1);
ICUNIT_ASSERT_EQUAL(rc, 0, rc);

View File

@ -51,10 +51,6 @@ static UINT32 Testcase(VOID)
tmp = pthread_equal(a, b);
// pthread_join(a, NULL);
// pthread_detach(a);
pthread_attr_init(&aa);
pthread_attr_getdetachstate(&aa, &detachstate);
@ -63,19 +59,6 @@ static UINT32 Testcase(VOID)
pthread_attr_destroy(&aa);
// pthread_mutex_init(&c, NULL);
// pthread_mutex_destroy(&c);
// pthread_mutex_lock(&c);
// pthread_mutex_trylock(&c);
// pthread_mutex_unlock(&c);
// pthread_mutexattr_init(&c);
// pthread_mutexattr_destroy(&c);
ret = pthread_join(aThread, NULL);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);

View File

@ -36,8 +36,6 @@ static void *ThreadF01(void *arg)
/* Shouldn't reach here. If we do, then the pthread_cancel()
* function did not succeed. */
// uart_printf_func("Could not send cancel request correctly\n");
// ICUNIT_TRACK_EQUAL(1, 0, errno);
pthread_exit(nullptr);
return NULL;
}
@ -62,7 +60,6 @@ static UINT32 Testcase(VOID)
ret = pthread_join(newTh, (void **)&temp);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);
// ICUNIT_ASSERT_EQUAL(temp, (UINTPTR)PTHREAD_CANCELED, temp);
return PTHREAD_NO_ERROR;
}

View File

@ -34,7 +34,6 @@ static void *ThreadF01(void *arg)
{
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
// while (1)
sleep(1);
pthread_exit(nullptr);
@ -48,7 +47,6 @@ static UINT32 Testcase(VOID)
pthread_t a;
/* SIGALRM will be sent in 5 seconds. */
// alarm(5);//alarm NOT SUPPORT
/* Create a new thread. */
if (pthread_create(&a, NULL, ThreadF01, NULL) != 0) {
@ -61,7 +59,6 @@ static UINT32 Testcase(VOID)
/* If 'main' has reached here, then the test passed because it means
* that the thread is truly asynchronise, and main isn't waiting for
* it to return in order to move on. */
// printf("Test PASSED\n");
ret = pthread_join(a, &temp);
ICUNIT_ASSERT_EQUAL(ret, 0, ret);

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
* Copyright (c) 2020-2022 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
@ -41,7 +41,7 @@
#define CLOCK_RES_NSEC 1000
#define CLOCK_COARSE_RES_SEC 0
#define CLOCK_COARSE_RES_NSEC 1000000
#define CLOCK_GET_CPU_CLOCKID(pid) ((-pid - 1) * 8U + 2)
#define CLOCK_GET_CPU_CLOCKID(pid) ((-(pid) - 1) * 8U + 2)
void ClockTestSmoke(void);
void ClockTest001(void);

View File

@ -176,16 +176,5 @@ HWTEST_F(NetSocketTest, NetSocketTest012, TestSize.Level0)
NetSocketTest012();
}
/* *
* @tc.name: NetSocketTest013
* @tc.desc: function for NetSocketTest
* @tc.type: FUNC
*/
/*
HWTEST_F(NetSocketTest, NetSocketTest013, TestSize.Level0)
{
//NetSocketTest013(); // broadcast to self to be supported.
}
*/
#endif
}

View File

@ -131,7 +131,6 @@ def parse_user_pc_ulr(excinfo_file, rootfs_dir, string, addr2line_cmd, objdump_c
ret = commands.getoutput(cmd)
print(ret)
cmd = "%s%s%s %s" % (addr2line_cmd, rootfs_dir, strlist[4], strlist[6])
#print(cmd)
ret = commands.getoutput(cmd)
ret = ret.split('\n')
print("<%s>%s<%s><%s>\n" % (string, ret[0], strlist[6], strlist[4]))

View File

@ -38,7 +38,7 @@ get_line()
{
SYM_ADDR=$(echo $1 | awk '{print $2}')
ELF_OFFSET=$(echo ${SYM_ADDR} | cut -d '[' -f2 | cut -d ']' -f1)
FILE_LINE=$(${ADDR2LINE} -f -e $2 ${ELF_OFFSET} | awk 'NR==2'`)
FILE_LINE=$(${ADDR2LINE} -f -e $2 ${ELF_OFFSET} | awk 'NR==2')
if [[ "${FILE_LINE}" == *"?"* ]]; then
typeset ELF_OFFSET=$((ELF_OFFSET+LOAD_BASE))
ELF_OFFSET=$(echo "obase=16;${ELF_OFFSET}" | bc)