[ 
https://issues.apache.org/jira/browse/YARN-2847?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14206801#comment-14206801
 ] 

Jason Lowe commented on YARN-2847:
----------------------------------

The problem is in this code:

{code}
  char **banned_users = get_values(BANNED_USERS_KEY);
  char **banned_user = (banned_users == NULL) ? 
    (char**) DEFAULT_BANNED_USERS : banned_users;
  for(; *banned_user; ++banned_user) {
    if (strcmp(*banned_user, user) == 0) {
      free(user_info);
      if (banned_users != (char**)DEFAULT_BANNED_USERS) {
        free_values(banned_users);
      }
      fprintf(LOGFILE, "Requested user %s is banned\n", user);
      return NULL;
    }
  }
  if (banned_users != NULL && banned_users != (char**)DEFAULT_BANNED_USERS) {
    free_values(banned_users);
  }
{code}

Note that in one case we check for banned_users != NULL and != 
DEFAULT_BANNED_USERS but in another case we're missing the NULL check.

Lots of ways to fix it:

- free_values could check for NULL
- banned_users could always be non-NULL (i.e.: set it to DEFAULT_BANNED_USERS 
if get_values returns NULL)
- add check for != NULL before calling free_values

> Linux native container executor segfaults if default banned user detected
> -------------------------------------------------------------------------
>
>                 Key: YARN-2847
>                 URL: https://issues.apache.org/jira/browse/YARN-2847
>             Project: Hadoop YARN
>          Issue Type: Bug
>          Components: nodemanager
>    Affects Versions: 2.5.0
>            Reporter: Jason Lowe
>
> The check_user function in container-executor.c can cause a segmentation 
> fault if banned.users is not provided but the user is detected as one of the 
> default users.  In that scenario it will call free_values on a NULL pointer.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to