Skip to content

Conversation

@pkarashchenko
Copy link
Contributor

@pkarashchenko pkarashchenko commented Aug 7, 2023

Summary

This PR contains next set of the changes:

  • use lib_free for memory de-allocation after strdup or asprintf
  • use kernel internal API for libc stubs of ESP32
  • Style fixes
  • Adding missing FAR qualifier
  • use _SCHED_GETPID in getpgrp() implementation

Impact

Should fix assert "Free memory from the wrong heap" with flat mode and user separated heap enabled mode

Testing

Pass CI

The memory allocated with strdup and asprintf is done via lib_malloc
so we need to use lib_free to deallocate memory otherwise the assertion
"Free memory from the wrong heap" is hit with flat mode and user separated
heap enabled mode.

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
@tmedicci
Copy link
Contributor

tmedicci commented Aug 7, 2023

I'll let our internal CI running and tomorrow morning I'll review the PR ;)

@pkarashchenko pkarashchenko force-pushed the _fix_free_after_strdup branch from f4934ca to 2fff68f Compare August 8, 2023 00:06
@mu578
Copy link

mu578 commented Aug 8, 2023

conflicting target on RISC, the rest that is just cascading. -> _off_t

Error: chip/esp_libc_stubs.c:97:5: error: conflicting types for '_lseek_r'
[469](https://github.com/apache/nuttx/actions/runs/5791110743/job/15695470612?pr=10110#step:7:470)
   97 | int _lseek_r(struct _reent *r, int fd, int offset, int whence)
[470](https://github.com/apache/nuttx/actions/runs/5791110743/job/15695470612?pr=10110#step:7:471)
      |     ^~~~~~~~
[471](https://github.com/apache/nuttx/actions/runs/5791110743/job/15695470612?pr=10110#step:7:472)
In file included from /github/workspace/sources/nuttx/arch/risc-v/src/chip/esp-hal-3rdparty/components/esp_rom/include/esp32c3/rom/libc_stubs.h:14,
[472](https://github.com/apache/nuttx/actions/runs/5791110743/job/15695470612?pr=10110#step:7:473)
                 from chip/esp_libc_stubs.c:41:
[473](https://github.com/apache/nuttx/actions/runs/5791110743/job/15695470612?pr=10110#step:7:474)
/tools/riscv64-unknown-elf-gcc/riscv64-unknown-elf/include/reent.h:148:15: note: previous declaration of '_lseek_r' was here
[474](https://github.com/apache/nuttx/actions/runs/5791110743/job/15695470612?pr=10110#step:7:475)
  148 | extern _off_t _lseek_r (struct _reent *, int, _off_t, int);

@royfengsss
Copy link
Contributor

As far as I tested on ESP32, the build passed and the crash former seen has been fixed.

@pkarashchenko pkarashchenko force-pushed the _fix_free_after_strdup branch from 2fff68f to 17ce5b9 Compare August 8, 2023 07:40
@pkarashchenko pkarashchenko force-pushed the _fix_free_after_strdup branch 3 times, most recently from ba56f0e to 9a6ebcb Compare August 8, 2023 08:25
@tmedicci
Copy link
Contributor

tmedicci commented Aug 8, 2023

Re-running our internal CI...

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
Copy link
Contributor

@tmedicci tmedicci left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our internal CI passed succesfully ;)

@tmedicci tmedicci merged commit 1651bb4 into apache:master Aug 8, 2023
@pkarashchenko pkarashchenko deleted the _fix_free_after_strdup branch August 8, 2023 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants