Skip to content

failing to build runtime on clang 10 #33681

Closed

Description

@omajid

Clang 10 introduces a new warning -Walloca. This breaks compiling runtime:

/runtime/src/libraries/Native/Unix/System.Native/pal_io.c(924,64): error G8742B11B: use of function '__builtin_alloca' is discouraged; there is no way to check for failure but failure may still occur, resulting in a possibly exploitable security vulnerability [-Werror,-Walloca] [/runtime/src/libraries/Native/build-native.proj]
      struct pollfd* pollfds = (struct pollfd*)(useStackBuffer ? alloca(bufferSize) : malloc(bufferSize));
                                                                 ^
  /usr/include/alloca.h:35:23: note: expanded from macro 'alloca'
  # define alloca(size)   __builtin_alloca (size)
                          ^
  1 error generated.

Should we disable this warning? Should we fix some uses? I know that coreclr has some extra checks (via AllocaCheck) and I dont think clang 10 flags those.

Activity

  1. added
    untriaged
    on Mar 17, 2020
  2. jkotas commented on Mar 17, 2020

    @jkotas
    Member

    This specific case can be fixed by switching to a fixed size stack allocated buffer.

    Is this the only use in libraries\native? I think it would be fine to shoot for no alloca under libraries\native.

  3. omajid commented on Mar 18, 2020

    @omajid
    MemberAuthor

    This specific case can be fixed by switching to a fixed size stack allocated buffer.

    Okay, I will open a PR for that.

    Is this the only use in libraries\native? I think it would be fine to shoot for no alloca under libraries\native.

    I think so. This is the only use of alloca() that clang 10 errors out on.

  4. added a commit that references this issue on Mar 20, 2020
    2cf9265
  5. ghost locked as resolved and limited conversation to collaborators on Dec 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-Infrastructure-librariesuntriaged

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions