[PATCH v20 05/11] posix: do not allow option name translations for secure programs

Adhemerval Zanella Netto adhemerval.zanella@linaro.org
Wed Jan 28 19:10:54 GMT 2026



On 27/01/26 16:18, Vivien Kraus wrote:
> SETUID / SETGID / AT_SECURE programs should not accept translated
> names, so that the programmer knows exactly how the program can be
> invoked.

I think it makes sense to avoid it for setuid bianries.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> ---
>  posix/getopt.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/posix/getopt.c b/posix/getopt.c
> index 82f0968f8e..aec2bbd48a 100644
> --- a/posix/getopt.c
> +++ b/posix/getopt.c
> @@ -199,7 +199,7 @@ match_translated_option_name (char *(*translate) (const char *, const char *,
>    const char *translated = opt_name;
>    char *translation_buffer = NULL;
>    bool matches = false;
> -  if (translate != NULL)
> +  if (translate != NULL && !__libc_enable_secure)
>      translated = translate (opt_textdomain, translation_context,
>  			    opt_name, &translation_buffer);
>  



More information about the Libc-alpha mailing list