Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bash with log_subcmds on AIX #289

Closed
loopway opened this issue Jul 14, 2023 · 4 comments
Closed

bash with log_subcmds on AIX #289

loopway opened this issue Jul 14, 2023 · 4 comments

Comments

@loopway
Copy link

loopway commented Jul 14, 2023

Calling sudo bash on AIX with enabled log_subcmds breaks STDOUT of certain commands like df. STDOUT is not displayed at all. For other commands like ps it seems to have no affect.

Tested with:
AIX 7300-01-02-2320
sudo 1.9.14-2 RPM (from sudo.ws Prebuilt Packages)
bash 5.1.4.0 LPP (AIX 7.3)
bash 5.1.16-1 RPM (from IBM AIX Toolbox for Open Source Software)

sudo ksh works as expected.

@millert
Copy link
Collaborator

millert commented Jul 28, 2023

This is almost certainly because bash is a 64-bit executable but ksh and sudo are 32-bit. For example:

$ file /bin/ksh /bin/bash
/bin/ksh: executable (RISC System/6000) or object module
/bin/bash: 64-bit XCOFF executable or object module

I see the same behavior when using log_subcmds with a 64-bit bash and a 32-bit sudo. It works as expected with a 32-bit bash executable.

The way log_subcmds works is that it interposes itself via LDR_PRELOAD so it can catch calls to execute a new program. Unfortunately, that only works for binaries of the same word size. Since your bash is 64-bit but sudo is 32-bit log_subcmds will not work properly. The way to fix this is for sudo to build both 32-bit and 64-bit versions of the sudo_intercept dynamic shared object but the build system uses by sudo (autoconf and libtool) doesn't really support that. It may be possible for me to build both a 32-bit and 64-bit sudo on AIX and combine the shared objects since the build system doesn't support this natively.

@millert
Copy link
Collaborator

millert commented Aug 4, 2023

I've added scaffolding to support both 32-bit and 64-bit versions of sudo_intercept.a on AIX in 980e021, 0a18184 and 002e22f. My sudo 1.9.15 AIX packages will include 32-bit and 64-bit versions of sudo_intercept.a.

@loopway
Copy link
Author

loopway commented Aug 25, 2023

@millert Thanks a lot for looking into it. I can confirm that we have no issue with the /opt/freeware/bin/bash_32 binary. Will be happy to test the new 1.9.15 release with 32 and 64 bit bash. 😎

@millert
Copy link
Collaborator

millert commented Nov 6, 2023

Closing now that sudo 1.9.15 is out.

@millert millert closed this as completed Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants