Project

General

Profile

Actions

Bug #14380

closed

pam_modules: build errors with gcc 11

Added by Toomas Soome over 1 year ago. Updated 6 days ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
lib - userland libraries
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
Gerrit CR:
External Bug:

Description

Build errors with gcc 11:

    ../unix_auth.c: In function 'error':
    ../unix_auth.c:63:16: error: '__pam_display_msg' accessing 16384 bytes in a region of size 512 [-Werror=stringop-overflow=]
       63 |         (void) __pam_display_msg(pamh, PAM_ERROR_MSG, 1, messages, NULL);
          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../unix_auth.c:63:16: note: referencing argument 4 of type 'char (*)[512]'
    In file included from ../unix_auth.c:45:
    /code/illumos-gate/proto/root_i386/usr/include/security/pam_impl.h:148:1: note: in a call to function '__pam_display_msg'
      148 | __pam_display_msg(pam_handle_t *pamh, int msg_style, int num_msg,
          | ^~~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors

    ../smb_passwd.c: In function 'info':
    ../smb_passwd.c:72:16: error: '__pam_display_msg' accessing 16384 bytes in a region of size 512 [-Werror=stringop-overflow=]
       72 |         (void) __pam_display_msg(pamh, PAM_TEXT_INFO, 1, &message,
          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       73 |             NULL);
          |             ~~~~~
    ../smb_passwd.c:72:16: note: referencing argument 4 of type 'char (*)[512]'
    In file included from ../smb_passwd.c:36:
    /code/illumos-gate/proto/root_i386/usr/include/security/pam_impl.h:148:1: note: in a call to function '__pam_display_msg'
      148 | __pam_display_msg(pam_handle_t *pamh, int msg_style, int num_msg,
          | ^~~~~~~~~~~~~~~~~
    ../smb_passwd.c: In function 'error':
    ../smb_passwd.c:55:16: error: '__pam_display_msg' accessing 16384 bytes in a region of size 512 [-Werror=stringop-overflow=]
       55 |         (void) __pam_display_msg(pamh, PAM_ERROR_MSG, 1, &message,
          |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       56 |             NULL);
          |             ~~~~~
    ../smb_passwd.c:55:16: note: referencing argument 4 of type 'char (*)[512]'
    In file included from ../smb_passwd.c:36:
    /code/illumos-gate/proto/root_i386/usr/include/security/pam_impl.h:148:1: note: in a call to function '__pam_display_msg'
      148 | __pam_display_msg(pam_handle_t *pamh, int msg_style, int num_msg,
          | ^~~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors

    ../krb5_authenticate.c: In function 'pam_krb5_prompter':
    ../krb5_authenticate.c:462:40: error: '__pam_display_msg' accessing 16384 bytes in a region of size 512 [-Werror=stringop-overflow=]
      462 |                                 (void) __pam_display_msg(pamh, PAM_ERROR_MSG,
          |                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      463 |                                     1, errmsg, NULL);
          |                                     ~~~~~~~~~~~~~~~~
    ../krb5_authenticate.c:462:40: note: referencing argument 4 of type 'char (*)[512]'
    In file included from ../krb5_authenticate.c:28:
    /code/illumos-gate/proto/root_i386/usr/include/security/pam_impl.h:148:1: note: in a call to function '__pam_display_msg'
      148 | __pam_display_msg(pam_handle_t *pamh, int msg_style, int num_msg,
          | ^~~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors

    ../dhkeys.c: In function 'remove_key':
    ../dhkeys.c:433:32: error: '__pam_display_msg' accessing 16384 bytes in a region of size 1536 [-Werror=stringop-overflow=]
      433 |                         (void) __pam_display_msg(pamh, PAM_ERROR_MSG, 3,
          |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      434 |                             msg, NULL);
          |                             ~~~~~~~~~~
    ../dhkeys.c:433:32: note: referencing argument 4 of type 'char (*)[512]'
    In file included from ../dhkeys.c:54:
    /code/illumos-gate/proto/root_i386/usr/include/security/pam_impl.h:148:1: note: in a call to function '__pam_display_msg'
      148 | __pam_display_msg(pam_handle_t *pamh, int msg_style, int num_msg,
          | ^~~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors

    ../authtok_check.c: In function 'error':
    ../authtok_check.c:122:24: error: '__pam_display_msg' accessing 16384 bytes in a region of size 512 [-Werror=stringop-overflow=]
      122 |                 (void) __pam_display_msg(pamh, PAM_ERROR_MSG, 1, msg, NULL);
          |                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    ../authtok_check.c:122:24: note: referencing argument 4 of type 'char (*)[512]'
    In file included from ../authtok_check.c:36:
    /code/illumos-gate/proto/root_i386/usr/include/security/pam_impl.h:148:1: note: in a call to function '__pam_display_msg'
      148 | __pam_display_msg(pam_handle_t *pamh, int msg_style, int num_msg,
          | ^~~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors

The problem here is simple - __pam_display_msg() is defined to take argument of char (*)[512], but we are giving an array with 1 element instead.

Testing done: build/install/boot, system appears to behave as expected. Incidentally, this patch is also integrated and tested in SPARC build by Klaus.

Actions #1

Updated by Electric Monk over 1 year ago

  • Gerrit CR set to 1925
Actions #2

Updated by Toomas Soome 6 days ago

  • Description updated (diff)
  • Status changed from In Progress to Pending RTI
Actions #3

Updated by Electric Monk 6 days ago

  • Status changed from Pending RTI to Closed
  • % Done changed from 90 to 100

git commit 040524e83cbd2eb410edc795626783c095f877e3

commit  040524e83cbd2eb410edc795626783c095f877e3
Author: Toomas Soome <tsoome@me.com>
Date:   2023-05-22T16:57:03.000Z

    14380 pam_modules: build errors with gcc 11
    Reviewed by: Andy Fiddaman <illumos@fiddaman.net>
    Reviewed by: Klaus Ziegler <klausz@haus-gisela.de>
    Approved by: Dan McDonald <danmcd@mnx.io>

Actions

Also available in: Atom PDF