Skip to content

tee-supplicant: renameat2() may not be supported #418

@etienne-lms

Description

@etienne-lms

Possible build issues using renameat2() since commit e3148e3 (#400) merged in OP-TEE release 4.8.0. The function was somewhat recently introduced and may not be supported.

Example of build error trace messages:

.../tee-supplicant/src/tee_supp_fs.c: In function 'ree_fs_new_rename':
.../tee-supplicant/src/tee_supp_fs.c:491:25: error: 'RENAME_NOREPLACE' undeclared (first use in this function)
  491 |                 flags = RENAME_NOREPLACE;
      |                         ^~~~~~~~~~~~~~~~

.../tee-supplicant/src/tee_supp_fs.c:493:13: error: implicit declaration of function 'renameat2'; did you mean 'renameat'? [-Werror=implicit-function-declaration]
  493 |         if (renameat2(tee_fs_fd, old_rel_filename, tee_fs_fd, new_rel_filename, flags)) {
      |             ^~~~~~~~~
      |             renameat

See for example these Buildroot CI build test reports (extracts from failures on target architectures):
x86_64: https://autobuild.buildroot.org/results/c5197057fbf8afb0a416e4dcd9e73ab82aa4b8b2/build-end.log
aarch64: https://autobuild.buildroot.org/results/60db3171134f732158cd0ceef4246788c972766e/build-end.log
sparc: https://autobuild.buildroot.org/results/f6f47442072ba415d363403ac38ca2ec17a55399/build-end.log

Should we provide a fallback to renameat() when RENAME_NOREPLACE is not defined by stdio.h?
That said, I understand that it could lead to race conditions as per e3148e3 commit message.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions