Compare commits

..

20 Commits

Author SHA1 Message Date
openharmony_ci
1eb753cd25 !1075 【挑单】time相关系统调用内核栈信息泄露排查
Merge pull request !1075 from zhushengle/OpenHarmony_1.0.1_release
2022-11-23 08:14:13 +00:00
zhushengle
19769f795b fix: time相关系统调用内核栈信息泄露排查
Close #I620AB
Signed-off-by: zhushengle <zhushengle@huawei.com>
2022-11-19 11:26:04 +08:00
openharmony_ci
5b44332cff !642 解决release1.0.1分支内核关闭中断后在写BUFF满了后卡住问题
Merge pull request !642 from wanghao-free/OpenHarmony_1.0.1_release
2021-09-30 01:56:11 +00:00
wanghao-free
0d50fad855 fix:解决release1.0.1分支内核关闭中断后在写BUFF满了后卡住问题
主干存在该问题,release分支先合入

添加cnt==0以及关中断的判断条件,在符合这种情况时跳出死循环,避免卡住

Signed-off-by: wanghao-free <wanghao453@huawei.com>
2021-09-28 20:10:13 -07:00
openharmony_ci
a37c850d1b !622 解决OsLockDepCheckIn异常处理中存在锁嵌套调用 导致死锁异常信息不正常输出问题
Merge pull request !622 from wanghao-free/OpenHarmony_1.0.1_release
2021-09-22 06:50:00 +00:00
wanghao-free
1eca7a502a fix: 解决OsLockDepCheckIn异常处理中存在锁嵌套调用
导致死锁异常信息不正常输出问题

主干存在该问题,修改同步release分支

新增加异常信息打印输出函数,用局部数组保存输出信息,避免锁嵌套问题

Close #I457ZZ

Signed-off-by: wanghao-free <wanghao453@huawei.com>
2021-09-14 23:35:56 -07:00
openharmony_ci
80e24fa9db !618 回退错误合入的解决getgroups的list比设置的list多一个gid问题的修改
Merge pull request !618 from wanghao-free/OpenHarmony_1.0.1_release
2021-09-09 14:54:09 +00:00
wanghao-free
15bded54c9 fix: 回退错误合入的解决getgroups的list比设置的list多一个gid问题的修改
主干不存在该问题.

回退原因是要求维护这边合入的人没有跟问题修改人赵天宇确认,实际上这个问题单解决不在内核这边,
内核这边的提交需要回退

Close #I48FMK

Signed-off-by: wanghao-free <wanghao453@huawei.com>
2021-09-09 02:30:38 -07:00
openharmony_ci
2a0db42072 !616 release分支解决nanosleep 接口的rmtp参数被错误清零问题
Merge pull request !616 from wanghao-free/OpenHarmony_1.0.1_release
2021-09-09 08:34:13 +00:00
openharmony_ci
de82bf893a !615 shell命令中rm -r指令尝试删除/dev下节点系统出错
Merge pull request !615 from 高荣鑫/OpenHarmony_1.0.1_release
2021-09-09 06:40:27 +00:00
openharmony_ci
a0bb06189d !614 修复子进程setgroups时会额外加上父进程gid,导致getgroups的list比设置的list多一个gid的问题
Merge pull request !614 from 刘占伟/OpenHarmony_1.0.1_release
2021-09-09 06:39:12 +00:00
openharmony_ci
a8513ae614 !613 解决sd卡读写操作时对卡进行热插拔后,disk资源未释放问题
Merge pull request !613 from 董逸群/OpenHarmony_1.0.1_release
2021-09-09 06:38:33 +00:00
wanghao-free
0c203c1e57 fix: 解决nanosleep 接口的rmtp参数被错误清零问题
主干不存在该问题,已解决.

nanosleep 使线程进入到了可被信号中断的状态,当线程睡眠被信号
中断,线程回复运行态时,若rmtp不为NULL,则会将sleep剩余的时间
记录在rmtp参数中返回,但是如果线程sleep过程中未被信号唤醒,
则忽略该参数。

由于鸿蒙中nanosleep是不可被打断的,即rmtp应该被忽略,而不是清零。

Close #I48FMT

Signed-off-by: wanghao-free <wanghao453@huawei.com>
2021-09-08 20:04:54 -07:00
gao-rongxin
93658ba478 fix: 解决shell命令中rm -r指令尝试删除/dev下节点系统出错的问题
主干不存在该问题,已解决.

shell命令rm中当opendir时没有正确判断opendir的返回值,
导致后续访问空指针.

检查opendir的返回值,当opendir失败时返回-1.

Close #I48FLX

Signed-off-by: gao-rongxin <gaorongxin1@huawei.com>
2021-09-08 19:49:51 -07:00
liu-zhanwei
58aea01f5a fix: 修复子进程setgroups时会额外加上父进程gid,导致getgroups的list比设置的list多一个gid的问题
主干不存在该问题,已解决.

子进程setgroups时会额外加上父进程gid,导致groups总是多出一个,与posix标准不符
setgroups时,若经过了入参校验,传入的list直接覆盖设置为groups,当groups个数为0,则getgroups直接返回0

close:  #I48FMK
Signed-off-by: liu-zhanwei <liuzhanwei4@huawei.com>
2021-09-08 19:24:16 -07:00
dong-yiqun
d39ed70c65 fix:解决disk资源未释放导致的资源泄露问题
主干存在该问题,还未解决.

因为对于热插入的sd卡,如果被其中一个线程操作拿住锁资源,

热插拔会导致disk资源状态未修改为UNUSED,造成资源泄露

现在修改为在拔出sd卡时,销毁disk锁资源之前,先将disk状态修改成UNUSED

Close #I3ZOIO

Signed-off-by: dong-yiqun <dongyiqun@huawei.com>
2021-09-09 10:23:36 +08:00
openharmony_ci
3e6bab5158 !612 修改commit msg后重新上传,解决OsMountRootfs失败问题
Merge pull request !612 from wanghao-free/OpenHarmony_1.0.1_release
2021-09-08 09:56:11 +00:00
wanghao-free
672cff7ee5 fix: 解决OsMountRootfs失败问题
主干存在该问题,下一步同步主干.

挂载rootfs需要emmc驱动,emmc驱动还没有初始化好,内核就尝试挂载rootfs了,
现修改为通过一个事件同步,emmc驱动完成后写事件,内核读到这个事件再挂载rootfs

close: #I43WLG
Signed-off-by: wanghao-free <wanghao453@huawei.com>
2021-09-08 01:43:22 -07:00
openharmony_ci
3ad07bc40f !560 解决调用system_console_deinit接口进行卸载console调试口,系统挂死
Merge pull request !560 from xukunrui/OpenHarmony_1.0.1_release
2021-08-20 03:53:35 +00:00
xukunrui
1e8d5baf8c 解决调用system_console_deinit接口进行卸载console调试口,系统挂死
Signed-off-by: xukunrui <xukunrui1@huawei.com>
2021-08-18 14:13:56 +08:00
9 changed files with 110 additions and 32 deletions

View File

@@ -700,6 +700,8 @@ INT32 los_alloc_diskid_byname(const CHAR *diskName);
*
*/
INT32 los_get_diskid_byname(const CHAR *diskName);
INT32 DiskEventRead(void);
INT32 DiskEventInit(void);
#ifdef __cplusplus
#if __cplusplus

View File

@@ -58,6 +58,10 @@ spinlock_t g_diskFatBlockSpinlock;
UINT32 g_usbMode = 0;
#ifdef LOSCFG_STORAGE_EMMC
static struct tagEvent g_diskInitEvent;
#endif
#define MEM_ADDR_ALIGN_BYTE 64
#define RWE_RW_RW 0755
@@ -1275,20 +1279,20 @@ static INT32 DiskDeinit(los_disk *disk)
#endif
disk->dev = NULL;
DISK_UNLOCK(&disk->disk_mutex);
(VOID)unregister_blockdriver(disk->disk_name);
if (disk->disk_name != NULL) {
LOS_MemFree(m_aucSysMem0, disk->disk_name);
disk->disk_name = NULL;
}
DISK_UNLOCK(&disk->disk_mutex);
disk->disk_status = STAT_UNUSED;
ret = pthread_mutex_destroy(&disk->disk_mutex);
if (ret != 0) {
PRINT_ERR("%s %d, mutex destroy failed, ret = %d\n", __FUNCTION__, __LINE__, ret);
return -EFAULT;
}
disk->disk_status = STAT_UNUSED;
return ENOERR;
}
@@ -1360,6 +1364,16 @@ INT32 los_disk_init(const CHAR *diskName, const struct block_operations *bops,
} else {
disk->type = OTHERS;
}
#ifdef LOSCFG_STORAGE_EMMC
ret = LOS_EventWrite(&g_diskInitEvent, 1);
if (ret < 0) {
PRINT_ERR("Disk initialization event write fail \n");
(void)unregister_blockdriver(diskName);
disk->disk_status = STAT_UNUSED;
return VFS_ERROR;
}
#endif
return ENOERR;
DISK_BLKDRIVER_ERROR:
@@ -1370,6 +1384,24 @@ DISK_FIND_ERROR:
return VFS_ERROR;
}
INT32 DiskEventInit(void)
{
#ifdef LOSCFG_STORAGE_EMMC
return LOS_EventInit(&g_diskInitEvent);
#else
return LOS_OK;
#endif
}
INT32 DiskEventRead(void)
{
#ifdef LOSCFG_STORAGE_EMMC
return LOS_EventRead(&g_diskInitEvent, 1, LOS_WAITMODE_OR, LOS_WAIT_FOREVER);
#else
return LOS_OK;
#endif
}
INT32 los_disk_deinit(INT32 diskID)
{
los_disk *disk = get_disk(diskID);

View File

@@ -838,6 +838,10 @@ static int os_shell_cmd_do_rmdir(const char *pathname)
return remove(pathname);
}
d = opendir(pathname);
if (d == NULL)
{
return -1;
}
while (1)
{
dirent = readdir(d);

View File

@@ -44,6 +44,8 @@ extern "C" {
#if (LOSCFG_KERNEL_SMP_LOCKDEP == YES)
#define PRINT_BUF_SIZE 256
#define LOCKDEP_GET_NAME(lockDep, index) (((SPIN_LOCK_S *)((lockDep)->heldLocks[(index)].lockPtr))->name)
#define LOCKDEP_GET_ADDR(lockDep, index) ((lockDep)->heldLocks[(index)].lockAddr)
@@ -107,6 +109,31 @@ WEAK VOID OsLockDepPanic(enum LockDepErrType errType)
while (1) {}
}
STATIC VOID OsLockDepPrint(const CHAR *fmt, va_list ap)
{
UINT32 len;
CHAR buf[PRINT_BUF_SIZE] = {0};
len = vsnprintf_s(buf, PRINT_BUF_SIZE, PRINT_BUF_SIZE - 1, fmt, ap);
if ((len == -1) && (*buf == '\0')) {
/* parameter is illegal or some features in fmt dont support */
UartPuts("OsLockDepPrint is error\n", strlen("OsLockDepPrint is error\n") + 1, 0);
return;
}
*(buf + len) = '\0';
UartPuts(buf, len, 0);
}
STATIC VOID OsPrintLockDepInfo(const CHAR *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
OsLockDepPrint(fmt, ap);
va_end(ap);
}
STATIC VOID OsLockDepDumpLock(const LosTaskCB *task, const SPIN_LOCK_S *lock,
const VOID *requestAddr, enum LockDepErrType errType)
{
@@ -114,24 +141,24 @@ STATIC VOID OsLockDepDumpLock(const LosTaskCB *task, const SPIN_LOCK_S *lock,
const LockDep *lockDep = &task->lockDep;
const LosTaskCB *temp = task;
PrintExcInfo("lockdep check failed\n");
PrintExcInfo("error type : %s\n", OsLockDepErrorStringGet(errType));
PrintExcInfo("request addr : 0x%x\n", requestAddr);
OsPrintLockDepInfo("lockdep check failed\n");
OsPrintLockDepInfo("error type : %s\n", OsLockDepErrorStringGet(errType));
OsPrintLockDepInfo("request addr : 0x%x\n", requestAddr);
while (1) {
PrintExcInfo("task name : %s\n", temp->taskName);
PrintExcInfo("task id : %u\n", temp->taskID);
PrintExcInfo("cpu num : %u\n", temp->currCpu);
PrintExcInfo("start dumping lockdep infomation\n");
OsPrintLockDepInfo("task name : %s\n", temp->taskName);
OsPrintLockDepInfo("task id : %u\n", temp->taskID);
OsPrintLockDepInfo("cpu num : %u\n", temp->currCpu);
OsPrintLockDepInfo("start dumping lockdep infomation\n");
for (i = 0; i < lockDep->lockDepth; i++) {
if (lockDep->heldLocks[i].lockPtr == lock) {
PrintExcInfo("[%d] %s <-- addr:0x%x\n", i, LOCKDEP_GET_NAME(lockDep, i),
OsPrintLockDepInfo("[%d] %s <-- addr:0x%x\n", i, LOCKDEP_GET_NAME(lockDep, i),
LOCKDEP_GET_ADDR(lockDep, i));
} else {
PrintExcInfo("[%d] %s \n", i, LOCKDEP_GET_NAME(lockDep, i));
OsPrintLockDepInfo("[%d] %s \n", i, LOCKDEP_GET_NAME(lockDep, i));
}
}
PrintExcInfo("[%d] %s <-- now\n", i, lock->name);
OsPrintLockDepInfo("[%d] %s <-- now\n", i, lock->name);
if (errType == LOCKDEP_ERR_DEAD_LOCK) {
temp = lock->owner;
@@ -144,7 +171,6 @@ STATIC VOID OsLockDepDumpLock(const LosTaskCB *task, const SPIN_LOCK_S *lock,
}
}
OsLockDepPanic(errType);
}
STATIC BOOL OsLockDepCheckDependancy(const LosTaskCB *current, LosTaskCB *lockOwner)
@@ -172,7 +198,7 @@ VOID OsLockDepCheckIn(SPIN_LOCK_S *lock)
{
UINT32 intSave;
enum LockDepErrType checkResult = LOCKDEP_SUCEESS;
VOID *requestAddr = (VOID *)__builtin_return_address(0);
VOID *requestAddr = (VOID *)__builtin_return_address(1);
LosTaskCB *current = OsCurrTaskGet();
LockDep *lockDep = &current->lockDep;
LosTaskCB *lockOwner = NULL;
@@ -211,11 +237,12 @@ OUT:
lockDep->waitLock = lock;
lockDep->heldLocks[lockDep->lockDepth].lockAddr = requestAddr;
lockDep->heldLocks[lockDep->lockDepth].waitTime = OsLockDepGetCycles(); /* start time */
} else {
OsLockDepDumpLock(current, lock, requestAddr, checkResult);
OsLockDepRelease(intSave);
return;
}
OsLockDepDumpLock(current, lock, requestAddr, checkResult);
OsLockDepRelease(intSave);
OsLockDepPanic(checkResult);
}
VOID OsLockDepRecord(SPIN_LOCK_S *lock)
@@ -253,7 +280,7 @@ VOID OsLockDepCheckOut(SPIN_LOCK_S *lock)
UINT32 intSave;
INT32 depth;
enum LockDepErrType checkResult = LOCKDEP_SUCEESS;
VOID *requestAddr = (VOID *)__builtin_return_address(0);
VOID *requestAddr = (VOID *)__builtin_return_address(1);
LosTaskCB *current = OsCurrTaskGet();
LosTaskCB *owner = NULL;
LockDep *lockDep = NULL;
@@ -265,7 +292,8 @@ VOID OsLockDepCheckOut(SPIN_LOCK_S *lock)
if (owner == SPINLOCK_OWNER_INIT) {
checkResult = LOCKDEP_ERR_UNLOCK_WITOUT_LOCK;
OsLockDepDumpLock(current, lock, requestAddr, checkResult);
goto OUT;
OsLockDepRelease(intSave);
OsLockDepPanic(checkResult);
}
lockDep = &owner->lockDep;
@@ -294,7 +322,6 @@ VOID OsLockDepCheckOut(SPIN_LOCK_S *lock)
lock->cpuid = (UINT32)(-1);
lock->owner = SPINLOCK_OWNER_INIT;
OUT:
OsLockDepRelease(intSave);
}

View File

@@ -98,7 +98,7 @@ STATIC VOID ConsoleOutput(const CHAR *str, UINT32 len)
for (;;) {
cnt = write(STDOUT_FILENO, str + writen, (size_t)toWrite);
if ((cnt < 0) || (toWrite == cnt)) {
if ((cnt < 0) || ((cnt == 0) && OS_INT_ACTIVE) || (toWrite == cnt)) {
break;
}
writen += cnt;

View File

@@ -246,6 +246,7 @@ STATIC INT32 GetArgs(CHAR **args)
}
#ifdef LOSCFG_STORAGE_EMMC
(void)DiskEventRead();
g_emmcDisk = GetMmcDisk(EMMC);
if (g_emmcDisk == NULL) {
PRINT_ERR("Get EMMC disk failed!\n");

View File

@@ -157,6 +157,12 @@ INT32 OsShellDeinit(INT32 consoleId)
return -1;
}
#if defined(LOSCFG_PLATFORM_ROOTFS)
if (consoleId == CONSOLE_SERIAL){
return 0;
}
#endif
(VOID)LOS_TaskDelete(shellCB->shellEntryHandle);
(VOID)LOS_EventWrite(&shellCB->shellEvent, CONSOLE_SHELL_KEY_EVENT);

0
syscall/process_syscall.c Executable file → Normal file
View File

View File

@@ -108,7 +108,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;
@@ -136,7 +136,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;
@@ -188,7 +188,7 @@ int SysTimerCreate(clockid_t clockID, struct sigevent *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;
@@ -212,7 +212,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;
@@ -284,7 +284,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;
@@ -307,7 +307,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;
@@ -362,6 +362,11 @@ int SysNanoSleep(const struct timespec *rqtp, struct timespec *rmtp)
return -EFAULT;
}
if (rmtp && LOS_ArchCopyFromUser(&srmtp, rmtp, sizeof(struct timespec))) {
errno = EFAULT;
return -EFAULT;
}
ret = nanosleep(&srqtp, rmtp ? &srmtp : NULL);
if (ret < 0) {
return -get_errno();
@@ -378,7 +383,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;
@@ -430,7 +435,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;
@@ -457,7 +462,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;
@@ -519,7 +524,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;
@@ -578,6 +583,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;