Compare commits

..

25 Commits

Author SHA1 Message Date
openharmony_ci
b744cfa164 !385 SIOCGIFCONF iotcl,用户态到内核态申请内存大小错误
Merge pull request !385 from 刘建东/cherry-pick-1625021431
2021-07-05 00:49:11 +00:00
YOUR_NAME
51a24eaeb2 fixed 4496e71 from https://gitee.com/life-liu/kernel_liteos_a/pulls/373
fixed bfd27e7 from https://gitee.com/life-liu/kernel_liteos_a/pulls/355
fix: SIOCGIFCONF ioctl malloc size error in kernel

use struct ifconf and ifc_buf size malloc memory

close: #I3XEZ3

Signed-off-by: liujiandong <liujiandong1@huawei.com>
2021-06-30 11:31:08 +08:00
openharmony_ci
07fb6c150e !330 修改lwip_enhanced编译脚本,更新lwip_enhanced lwip版本到2.1.2
Merge pull request !330 from 刘建东/pr_329
2021-06-17 17:01:38 +08:00
openharmony_ci
7ceaf68832 !319 fix: avoid compile warning ignored
Merge pull request !319 from MGY917/citu_clean_release
2021-06-17 15:53:35 +08:00
YOUR_NAME
309e7569f8 chore: update lwip_enhanced lwip version to 2.1.2
update lwip version to 2.1.2 for lwip_enhanced

close: #I3VXAP

Signed-off-by: liujiandong <liujiandong1@huawei.com>
2021-06-17 15:21:24 +08:00
openharmony_ci
e42cb26b14 !324 fix: v1.1.0的reset_vector_up/mp.S bug修复同步自master
Merge pull request !324 from MGY917/start_up_bug_fix
2021-06-17 13:54:56 +08:00
Guangyao Ma
8ab4c9a6bc fix: v1.1.0的reset_vector_up/mp.S bug修复同步自master
Close #I3VQGN

Change-Id: I3772fde91067433c18b34fe2157abf05fa75fd73
Signed-off-by: Guangyao Ma <guangyao.ma@outlook.com>
2021-06-16 17:23:40 +08:00
Guangyao Ma
a40dc411b2 fix: avoid compile warning ignored
Close #I3VOAO

Change-Id: I42103e0e7061e50f8d63df98ea9f5cecd49fe6f4
Signed-off-by: Guangyao Ma <guangyao.ma@outlook.com>
2021-06-15 20:06:09 +08:00
openharmony_ci
ebe33aa2f6 !299 删除PRINTK维测log
Merge pull request !299 from 刘建东/OpenHarmony_1.0.1_release
2021-06-09 13:51:24 +08:00
YOUR_NAME
ece0e8ae06 IssueNo:#I3UKNE
Description:delete PRINTK log
Sig:phone
Feature or Bugfix:Bugfix
Binary Source:No

Signed-off-by: YOUR_NAME <liujiandong1@huawei.com>
2021-06-07 12:01:52 +08:00
openharmony_ci
c059be5ec8 !237 lwip crash问题增加维测log
Merge pull request !237 from 刘建东/OpenHarmony_1.0.1_release
2021-05-13 09:33:15 +08:00
YOUR_NAME
723b3ff8e2 IssueNo:#I3R13T
Description:add log for lwip crash
Sig:phone
Feature or Bugfix:Bugfix
Binary Source:No
2021-05-12 17:15:44 +08:00
openharmony_ci
7cf342c29f !195 clang编译的系统镜像内核栈回溯功能失效
Merge pull request !195 from zhangfanfan2/OpenHarmony_1.0.1_release
2021-04-28 14:44:13 +08:00
YOUR_NAME
3b9ccc839e fix:solve the problem of stack backtrace failure for llvm.
Change-Id: I0b0426e0e529cb6517d6a2712c6862ebbcea2239
2021-04-28 10:33:10 +08:00
openharmony_ci
4f1e1619a5 !161 【轻量级 PR】:调度中存在有符号数与无符号数比较
Merge pull request !161 from zhushengle/N/A
2021-04-20 14:12:58 +08:00
openharmony_ci
6523c496c8 !159 同步master 分支已修复问题: setitimer 中定时给进程发信号时未持有调度锁,导致踩内存等问题
Merge pull request !159 from zhushengle/OpenHarmony_1.0.1_release
2021-04-20 14:12:53 +08:00
zhushengle
7648648887 调度中存在有符号数与无符号数比较 2021-04-20 10:06:48 +08:00
zhushengle
1c0bbb66de fix:setitimer are downregulated for multicore scenarios, and are static, resulting in inconsistent behavior.
Close #I3EBOI

Change-Id: I71a86b8f2b7451e886a08dfc7f274287107df916
2021-04-20 09:54:00 +08:00
zhushengle
d44f3904cf fix:the setitimer signals the process to be locked at a fixed time. There is a static problem.
Close #I3H7TO

Change-Id: Iccfb458ed43f761fde1f943e0005f4ac1bf425bc
2021-04-20 09:25:36 +08:00
openharmony_ci
5cbb83dc6e !126 Add issue and PR template for release
Merge pull request !126 from 马明帅/add_issus_pr_template_for_release
2021-04-08 08:40:31 +08:00
mamingshuai
13fa3d4403 add issue and pr template 2021-04-07 14:49:43 +08:00
openharmony_ci
e9522d44bf !121 release【bug】sigaction中sigsuspend的后执行信号顺序与预期不符,信号注册时未屏蔽用户传入信号屏蔽字段
Merge pull request !121 from give-me-five/OpenHarmony_1.0.1_release
2021-04-04 17:40:08 +08:00
x_xiny
f30790c5c8 signal
Change-Id: Ia42e914b7a19b7d519010e371f808baa1c6588c0
2021-04-04 16:23:24 +08:00
openharmony_ci
a0bb801f67 !114 Fix OHOS shell cannot ls a file for branch release
Merge pull request !114 from ysy4tc3/fork_release
2021-04-01 14:47:03 +08:00
Far
170aa8ba6f Description: fix OHOS shell cannot ls a file
Change-Id: Ie13485cc2406882985405db0599666690c25dc1f
2021-04-01 09:44:37 +08:00
14 changed files with 223 additions and 66 deletions

View File

@@ -0,0 +1,11 @@
### 该问题是怎么引起的?
### 重现步骤
### 报错信息

View File

@@ -0,0 +1,12 @@
### 相关的Issue
### 原因(目的、解决的问题等)
### 描述(做了什么,变更了什么)
### 测试用例(新增、改动、可能影响的功能)

View File

@@ -37,7 +37,7 @@ LIBSOUT := $(OBJOUT)/libs
IMGOUT := $(OUT)
# common flags config
BASE_OPTS := -ffunction-sections -fdata-sections -fno-omit-frame-pointer -D_GNU_SOURCE \
BASE_OPTS := -ffunction-sections -fdata-sections -fno-omit-frame-pointer -fno-common -fno-strict-aliasing -D_GNU_SOURCE \
$(LITEOS_SSP) $(LITEOS_CORE_COPTS) $(WARNING_AS_ERROR) $(LLVM_EXTRA_OPTS) $(LITEOS_GCOV_OPTS)
CFLAGS := -std=c99 -fno-exceptions $(BASE_OPTS) $(LITEOS_COPTS_OPTMIZE)

View File

@@ -669,12 +669,21 @@ VOID BackTraceSub(UINTPTR regFP)
while (IsValidFP(backFP, stackStart, stackEnd, &kvaddr) == TRUE) {
tmpFP = backFP;
#ifdef LOSCFG_COMPILER_CLANG_LLVM
backFP = *(UINTPTR *)(UINTPTR)kvaddr;
if (IsValidFP(tmpFP + POINTER_SIZE, stackStart, stackEnd, &kvaddr) == FALSE) {
PrintExcInfo("traceback backLR check failed, backLP: 0x%x\n", tmpFP + POINTER_SIZE);
return;
}
backLR = *(UINTPTR *)(UINTPTR)kvaddr;
#else
backLR = *(UINTPTR *)(UINTPTR)kvaddr;
if (IsValidFP(tmpFP - POINTER_SIZE, stackStart, stackEnd, &kvaddr) == FALSE) {
PrintExcInfo("traceback backFP check failed, backFP: 0x%x\n", tmpFP - POINTER_SIZE);
return;
}
backFP = *(UINTPTR *)(UINTPTR)kvaddr;
#endif
if (LOS_IsUserAddress((VADDR_T)backLR) == TRUE) {
region = LOS_RegionFind(OsCurrProcessGet()->vmSpace, (VADDR_T)backLR);
}

View File

@@ -65,7 +65,9 @@
.equ MPIDR_CPUID_MASK, 0xffU
.fpu vfpv4
.fpu neon-vfpv4
.syntax unified
.arch armv7-a
.arm
/* param0 is stack bottom, param1 is stack size, r12 hold cpu id */
@@ -187,7 +189,7 @@ reloc_img_to_bottom_done:
mov r0, r4
mov r1, #0
mov r2, #MMU_DESCRIPTOR_L1_SMALL_ENTRY_NUMBERS
bl memset
bl memset_optimized /* optimized memset since r0 is 64-byte aligned */
PAGE_TABLE_SET SYS_MEM_BASE, KERNEL_VMM_BASE, KERNEL_VMM_SIZE, MMU_DESCRIPTOR_KERNEL_L1_PTE_FLAGS
PAGE_TABLE_SET SYS_MEM_BASE, UNCACHED_VMM_BASE, UNCACHED_VMM_SIZE, MMU_INITIAL_MAP_NORMAL_NOCACHE
@@ -463,6 +465,18 @@ _bootaddr_setup:
bx lr
memset_optimized:
mov r3, r0
vdup.8 q0, r1
vmov q1, q0
vmov q2, q0
vmov q3, q0
memset_optimized_loop:
subs r2, #64
vstmia r3!, {d0 - d7}
bge memset_optimized_loop
bx lr
init_done:
.long 0xDEADB00B

View File

@@ -65,7 +65,9 @@
.equ MPIDR_CPUID_MASK, 0xffU
.fpu vfpv4
.fpu neon-vfpv4
.syntax unified
.arch armv7-a
.arm
/* param0 is stack bottom, param1 is stack size, r11 hold cpu id */
@@ -164,7 +166,7 @@ reloc_img_to_bottom_done:
mov r0, r4
mov r1, #0
mov r2, #MMU_DESCRIPTOR_L1_SMALL_ENTRY_NUMBERS
bl memset
bl memset_optimized /* optimized memset since r0 is 64-byte aligned */
PAGE_TABLE_SET SYS_MEM_BASE, KERNEL_VMM_BASE, KERNEL_VMM_SIZE, MMU_DESCRIPTOR_KERNEL_L1_PTE_FLAGS
@@ -431,6 +433,18 @@ _bootaddr_setup:
bx lr
memset_optimized:
mov r3, r0
vdup.8 q0, r1
vmov q1, q0
vmov q2, q0
vmov q3, q0
memset_optimized_loop:
subs r2, #64
vstmia r3!, {d0 - d7}
bge memset_optimized_loop
bx lr
init_done:
.long 0xDEADB00B

View File

@@ -38,22 +38,22 @@ outdir="../..$3/test_info/gen/kernel/test"
if [ "$5" = "tee" ]; then
tee="_tee"
fi
productName="$(basename $7)"
source="tools/build/config/${productName}_release.config"
product_name="$(basename $7)"
source="tools/build/config/${product_name}_release.config"
if [ "$2" = "clang" ]; then
if [ "$4" = "debug" ]; then
config_file="${productName}_$2$tee.config"
config_file="${product_name}_$2$tee.config"
source="tools/build/config/debug/$config_file"
else
config_file="${productName}_$2_release$tee.config"
config_file="${product_name}_$2_release$tee.config"
source="tools/build/config/$config_file"
fi
elif [ "$2" = "gcc" ]; then
if [ "$4" = "debug" ]; then
config_file="${productName}_debug_shell$tee.config"
config_file="${product_name}_debug_shell$tee.config"
source="tools/build/config/$config_file"
else
config_file="${productName}_release$tee.config"
config_file="${product_name}_release$tee.config"
source="tools/build/config/$config_file"
fi
fi

View File

@@ -586,6 +586,7 @@ typedef struct {
static VOID SwtmrProc(UINTPTR tmrArg)
{
unsigned int intSave;
int sig;
pid_t pid;
siginfo_t info;
@@ -610,7 +611,10 @@ static VOID SwtmrProc(UINTPTR tmrArg)
info.si_value.sival_ptr = arg->sigev_value.sival_ptr;
/* Send the signal */
SCHEDULER_LOCK(intSave);
OsDispatch(pid, &info, OS_USER_KILL_PERMISSION);
SCHEDULER_UNLOCK(intSave);
return;
}
@@ -883,8 +887,10 @@ clock_t times(struct tms *buf)
int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue)
{
UINT32 intSave;
LosTaskCB *taskCB = OS_TCB_FROM_TID(LOS_CurTaskIDGet());
LosProcessCB *processCB = OS_PCB_FROM_PID(taskCB->processID);
timer_t timerID = 0;
struct itimerspec spec;
struct itimerspec ospec;
int ret = LOS_OK;
@@ -894,15 +900,27 @@ int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue
set_errno(EINVAL);
return -1;
}
LOS_TaskLock();
if (processCB->timerID == (timer_t)(UINTPTR)MAX_INVALID_TIMER_VID) {
ret = timer_create(CLOCK_REALTIME, NULL, &processCB->timerID);
ret = timer_create(CLOCK_REALTIME, NULL, &timerID);
if (ret != LOS_OK) {
LOS_TaskUnlock();
return ret;
}
}
LOS_TaskUnlock();
/* The initialization of this global timer must be in spinlock
* timer_create cannot be located in spinlock.
*/
SCHEDULER_LOCK(intSave);
if (processCB->timerID == (timer_t)(UINTPTR)MAX_INVALID_TIMER_VID) {
processCB->timerID = timerID;
SCHEDULER_UNLOCK(intSave);
} else {
SCHEDULER_UNLOCK(intSave);
if (timerID) {
timer_delete(timerID);
}
}
if (!ValidTimeval(&value->it_value) || !ValidTimeval(&value->it_interval)) {
set_errno(EINVAL);

120
fs/vfs/operation/fs_other.c Executable file → Normal file
View File

@@ -526,16 +526,74 @@ static void PrintFileInfo(const struct stat *statInfo, const char *name)
str[0], str[1], str[UGO_NUMS - 1], statInfo->st_size, statInfo->st_uid, statInfo->st_gid, name);
}
void ls(const char *pathname)
int LsFile(const char *path)
{
struct stat64 stat64_info;
struct stat stat_info;
struct dirent *pdirent = NULL;
char *path = NULL;
struct stat64 stat64Info;
struct stat statInfo;
if (stat64(path, &stat64Info) == 0) {
PrintFileInfo64(&stat64Info, path);
} else if (stat(path, &statInfo) == 0) {
PrintFileInfo(&statInfo, path);
} else {
return -1;
}
return 0;
}
int LsDir(const char *path)
{
struct stat statInfo = { 0 };
struct stat64 stat64Info = { 0 };
DIR *d = NULL;
char *fullpath = NULL;
char *fullpath_bak = NULL;
struct dirent *pdirent = NULL;
d = opendir(path);
if (d == NULL) {
return -1;
}
PRINTK("Directory %s:\n", path);
do {
pdirent = readdir(d);
if (pdirent == NULL) {
break;
} else {
if (!strcmp(pdirent->d_name, ".") || !strcmp(pdirent->d_name, "..")) {
continue;
}
(void)memset_s(&statInfo, sizeof(struct stat), 0, sizeof(struct stat));
(void)memset_s(&stat64Info, sizeof(struct stat), 0, sizeof(struct stat));
fullpath = ls_get_fullpath(path, pdirent);
if (fullpath == NULL) {
(void)closedir(d);
return -1;
}
fullpath_bak = fullpath;
if (stat64(fullpath, &stat64Info) == 0) {
PrintFileInfo64(&stat64Info, pdirent->d_name);
} else if (stat(fullpath, &statInfo) == 0) {
PrintFileInfo(&statInfo, pdirent->d_name);
} else {
PRINTK("BAD file: %s\n", pdirent->d_name);
}
free(fullpath_bak);
}
} while (1);
(void)closedir(d);
return 0;
}
void ls(const char *pathname)
{
struct stat statInfo = { 0 };
char *path = NULL;
int ret;
DIR *d = NULL;
if (pathname == NULL) {
#ifdef VFS_USING_WORKDIR
@@ -561,45 +619,23 @@ void ls(const char *pathname)
}
}
/* list all directory and file*/
d = opendir(path);
if (d == NULL) {
ret = stat(path, &statInfo);
if (ret < 0) {
perror("ls error");
} else {
PRINTK("Directory %s:\n", path);
do {
pdirent = readdir(d);
if (pdirent == NULL) {
break;
} else {
if (!strcmp(pdirent->d_name, ".") || !strcmp(pdirent->d_name, "..")) {
continue;
}
(void)memset_s(&stat_info, sizeof(struct stat), 0, sizeof(struct stat));
fullpath = ls_get_fullpath(path, pdirent);
if (fullpath == NULL) {
free(path);
(void)closedir(d);
return;
}
fullpath_bak = fullpath;
if (stat64(fullpath, &stat64_info) == 0) {
PrintFileInfo64(&stat64_info, pdirent->d_name);
} else if (stat(fullpath, &stat_info) == 0) {
PrintFileInfo(&stat_info, pdirent->d_name);
} else
PRINTK("BAD file: %s\n", pdirent->d_name);
free(fullpath_bak);
}
} while (1);
(void)closedir(d);
free(path);
return;
}
free(path);
if (statInfo.st_mode & S_IFDIR) { /* list all directory and file */
ret = LsDir((pathname == NULL) ? path : pathname);
} else { /* show the file infomation */
ret = LsFile(path);
}
if (ret < 0) {
perror("ls error");
}
free(path);
return;
}

View File

@@ -510,7 +510,6 @@ int OsSigSuspend(const sigset_t *set)
{
unsigned int intSave;
LosTaskCB *rtcb = NULL;
unsigned int sigTempProcMask;
sigset_t setSuspend;
int ret;
@@ -519,7 +518,6 @@ int OsSigSuspend(const sigset_t *set)
}
SCHEDULER_LOCK(intSave);
rtcb = OsCurrTaskGet();
sigTempProcMask = rtcb->sig.sigprocmask;
/* Wait signal calc */
setSuspend = FULL_SIGNAL_SET & (~(*set));
@@ -530,8 +528,6 @@ int OsSigSuspend(const sigset_t *set)
if (ret < 0) {
PRINT_ERR("FUNC %s LINE = %d, ret = %x\n", __FUNCTION__, __LINE__, ret);
}
/* Restore old sigprocmask */
OsSigMaskSwitch(rtcb, sigTempProcMask);
SCHEDULER_UNLOCK(intSave);
return -EINTR;

View File

@@ -63,7 +63,7 @@ extern "C" {
#define OS_SCHED_TIME_SLICES_MAX ((LOSCFG_BASE_CORE_TIMESLICE_TIMEOUT * OS_SYS_NS_PER_US) / OS_NS_PER_CYCLE)
#define OS_SCHED_TIME_SLICES_DIFF (OS_SCHED_TIME_SLICES_MAX - OS_SCHED_TIME_SLICES_MIN)
#define OS_SCHED_READY_MAX 30
#define OS_TIME_SLICE_MIN ((50 * OS_SYS_NS_PER_US) / OS_NS_PER_CYCLE) /* 50us */
#define OS_TIME_SLICE_MIN (INT32)((50 * OS_SYS_NS_PER_US) / OS_NS_PER_CYCLE) /* 50us */
#define OS_SCHED_MAX_RESPONSE_TIME (UINT64)(OS_64BIT_MAX - 1U)
typedef struct {

View File

@@ -37,7 +37,8 @@ VDSO_INCLUDE := -I $(LITEOSTOPDIR)/kernel/extended/vdso/include \
-I $(LITEOSTOPDIR)/kernel/common \
-I $(LITEOSTOPDIR)/bsd/compat/linuxkpi/include
VDSO_CCFLAGS := -nostdlib -fPIC $(LITEOS_SSP) $(LITEOS_CORE_COPTS) $(WARNING_AS_ERROR) $(LITEOS_COPTS_OPTMIZE)
VDSO_CCFLAGS := -nostdlib -fPIC -fno-common -fno-strict-aliasing \
$(LITEOS_SSP) $(LITEOS_CORE_COPTS) $(WARNING_AS_ERROR) $(LITEOS_COPTS_OPTMIZE)
ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y)
VDSO_CCFLAGS += $(LLVM_EXTRA_OPTS) --sysroot=$(LITEOSTOPDIR)/../../prebuilts/lite/sysroot/
endif

48
net/lwip-2.1/porting/src/sockets.c Executable file → Normal file
View File

@@ -1468,6 +1468,51 @@ static err_t lwip_do_ioctl_impl(struct tcpip_api_call_data *call)
#include "los_vm_map.h"
#include "user_copy.h"
static int do_ioctl_SIOCGIFCONF(int sockfd, long cmd, void *argp)
{
int nbytes;
struct ifconf ifc;
char *buf_bak = NULL;
int ret;
if (LOS_ArchCopyFromUser(&ifc, argp, sizeof(struct ifconf)) != 0) {
set_errno(EFAULT);
return -1;
}
nbytes = ifc.ifc_len;
if (nbytes < 0) {
set_errno(EINVAL);
return -1;
}
buf_bak = ifc.ifc_buf;
if (!LOS_IsUserAddress((VADDR_T)(uintptr_t)buf_bak)) {
set_errno(EFAULT);
return -1;
}
ifc.ifc_buf = malloc(nbytes);
if (ifc.ifc_buf == NULL) {
set_errno(ENOMEM);
return -1;
}
(void)memset_s(ifc.ifc_buf, nbytes, 0, nbytes);
ret = lwip_ioctl(sockfd, cmd, &ifc);
if (ret == 0) {
if (LOS_ArchCopyToUser(buf_bak, ifc.ifc_buf, nbytes) != 0) {
set_errno(EFAULT);
ret = -1;
}
}
free(ifc.ifc_buf);
ifc.ifc_buf = buf_bak;
if (LOS_ArchCopyToUser(argp, &ifc, sizeof(struct ifconf)) != 0) {
set_errno(EFAULT);
ret = -1;
}
return ret;
}
int socks_ioctl(int sockfd, long cmd, void *argp)
{
void *argpbak = argp;
@@ -1483,11 +1528,12 @@ int socks_ioctl(int sockfd, long cmd, void *argp)
case SIOCADDRT:
nbytes = sizeof(struct rtentry);
break;
case SIOCGIFCONF:
return do_ioctl_SIOCGIFCONF(sockfd, cmd, argp);
case SIOCSIPV6DAD:
case SIOCGIPV6DAD:
case SIOCSIPV6DPCTD:
case SIOCGIPV6DPCTD:
case SIOCGIFCONF:
case SIOCGIFADDR:
case SIOCSIFADDR:
case SIOCDIFADDR:

4
tools/build/mk/los_config.mk Executable file → Normal file
View File

@@ -359,13 +359,13 @@ ifeq ($(LOSCFG_NET_LWIP_SACK_2_1), y)
LITEOS_CMACRO += $(LWIP_MACROS)
else ifeq ($(LOSCFG_NET_LWIP_SACK_2_0), y)
LWIPDIR := $(LITEOSTHIRDPARTY)/lwip_enhanced
LWIPDIR := $(LITEOSTHIRDPARTY)/lwip_enhanced/src
LITEOS_BASELIB += -llwip
LIB_SUBDIRS += $(LWIPDIR)
LITEOS_LWIP_SACK_INCLUDE += \
-I $(LWIPDIR)/include \
-I $(LITEOSTOPDIR)/net/mac
LWIP_MACROS += -DLWIP_CONFIG_FILE=\"lwip/lwipopts.h\"
LWIP_MACROS += -DLWIP_CONFIG_FILE=\"lwip/lwipopts.h\" -DLWIP_LITEOS_A_COMPAT
LITEOS_CMACRO += $(LWIP_MACROS)
else
$(error "unknown lwip version")