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

build: fix test for subid 4 #12655

Merged
merged 2 commits into from
Dec 20, 2021

Conversation

giuseppe
Copy link
Member

libsubid changes its ABI in version 4. Account for the different name
in the configure script.

Closes: https://github.com/containers/podman/issues/12654

Signed-off-by: Giuseppe Scrivano [email protected]

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Dec 20, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: giuseppe

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 20, 2021
@@ -9,7 +9,11 @@ cc -o "$tmpdir"/libsubid_tag -l subid -x c - > /dev/null 2> /dev/null << EOF
#include <shadow/subid.h>
int main() {
struct subid_range *ranges = NULL;
#if SUBID_ABI_MAJOR >= 4j

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a typo? the j character looks like vi artifact =)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how have you installed libsubid? I see the need for Prog but I don't see shadow_logfd defined

nevermind my last comment, I was looking at the wrong version

@gyakovlev
Copy link

I still can't get it to link to libsubid with changes in this pr:

 gcc -lsubid t.c 
/usr/lib/gcc/powerpc64le-unknown-linux-gnu/11.2.0/../../../../powerpc64le-unknown-linux-gnu/bin/ld: /usr/lib/gcc/powerpc64le-unknown-linux-gnu/11.2.0/../../../../lib64/libsubid.so: undefined reference to `Prog'
/usr/lib/gcc/powerpc64le-unknown-linux-gnu/11.2.0/../../../../powerpc64le-unknown-linux-gnu/bin/ld: /usr/lib/gcc/powerpc64le-unknown-linux-gnu/11.2.0/../../../../lib64/libsubid.so: undefined reference to `shadow_logfd'
collect2: error: ld returned 1 exit status

here's what works for me:
idk why I need to define Prog and shadow_logfd though...

#include <shadow/subid.h>                                                                                                                                                                                                               
#include <stdlib.h>                                                                                                                                                                                                                     
                                                                                                                                                                                                                                        
const char *Prog;                                                                                                                                                                                                                       
FILE *shadow_logfd = NULL;                                                                                                                                                                                                              
                                                                                                                                                                                                                                        
int main() {                                                                                                                                                                                                                            
        struct subid_range *ranges = NULL;                                                                                                                                                                                              
#if SUBID_ABI_MAJOR >= 4                                                                                                                                                                                                                
        subid_get_uid_ranges("root", &ranges);                                                                                                                                                                                          
#else                                                                                                                                                                                                                                   
        get_subuid_ranges("root", &ranges);                                                                                                                                                                                             
#endif                                                                                                                                                                                                                                  
        free(ranges);                                                                                                                                                                                                                   
        return 0;                                                                                                                                                                                                                       
}

@giuseppe
Copy link
Member Author

how have you installed libsubid? I see the need for Prog but I don't see shadow_logfd defined

libsubid changes its ABI in version 4.  Account for the different name
in the configure script.

Closes: https://github.com/containers/podman/issues/12654

[NO NEW TESTS NEEDED] it is a change in the build script

Signed-off-by: Giuseppe Scrivano <[email protected]>
Signed-off-by: Giuseppe Scrivano <[email protected]>
@gyakovlev
Copy link

yeah it's here:

file /usr/lib64/libsubid.so*
/usr/lib64/libsubid.so:       symbolic link to libsubid.so.4.0.0
/usr/lib64/libsubid.so.4:     symbolic link to libsubid.so.4.0.0
/usr/lib64/libsubid.so.4.0.0: ELF 64-bit LSB shared object, 64-bit PowerPC or cisco 7500, OpenPOWER ELF V2 ABI, version 1 (SYSV), dynamically linked, stripped

include too:

cat /usr/include/shadow/subid.h
#include <sys/types.h>
#include <stdio.h>
#include <stdbool.h>

#ifndef SUBID_RANGE_DEFINED
#define SUBID_RANGE_DEFINED 1
#define SUBID_ABI_VERSION 4.0.0
#define SUBID_ABI_MAJOR 4
#define SUBID_ABI_MINOR 0
#define SUBID_ABI_MICRO 0
...

@gyakovlev
Copy link

some dumps, might be helpful

 gcc -lsubid t.c # < this is my version with prog and shadow_logfd
ya@cerberus ~ $ nm
00000000000006e0 t 0000001b.plt_call.__cxa_finalize@@GLIBC_2.17
0000000000000760 t 0000001b.plt_call.free@@GLIBC_2.17
0000000000000700 t 0000001b.plt_call.__libc_start_main@@GLIBC_2.17
0000000000000740 t 0000001b.plt_call.__stack_chk_fail@@GLIBC_2.17
0000000000000720 t 0000001b.plt_call.subid_get_uid_ranges
0000000000000680 t 00000039.plt_call.__gmon_start__
0000000000020050 B __bss_start
                 w __cxa_finalize@GLIBC_2.17
0000000000020040 D __data_start
0000000000020040 W data_start
00000000000007d0 t deregister_tm_clones
0000000000020048 D __dso_handle
000000000001fcf0 d _DYNAMIC
0000000000020050 D _edata
0000000000020068 B _end
0000000000000ae4 T _fini
                 U free@GLIBC_2.17
0000000000000a98 t __glink_PLTresolve
                 w __gmon_start__
0000000000000b18 r __GNU_EH_FRAME_HDR
00000000000006a0 t _init
000000000001fcc8 d __init_array_end
000000000001fcc0 d __init_array_start
0000000000000b08 R _IO_stdin_used
                 w _ITM_deregisterTMCloneTable
                 w _ITM_registerTMCloneTable
0000000000000a80 T __libc_csu_fini
00000000000009c0 T __libc_csu_init
                 U __libc_start_main@GLIBC_2.17
000000000000091c T main
0000000000020058 B Prog
0000000000000830 t register_tm_clones
0000000000020060 B shadow_logfd
                 U __stack_chk_fail@GLIBC_2.17
0000000000000780 T _start
                 U subid_get_uid_ranges
0000000000020050 D __TMC_END__
0000000000027f00 d .TOC.

readelf -a /usr/lib64/libsubid.so.4.0.0 | grep logfd
00000003fd28  007d00000026 R_PPC64_ADDR64    0000000000000000 shadow_logfd + 0
00000003fd38  007d00000026 R_PPC64_ADDR64    0000000000000000 shadow_logfd + 0
00000003fd50  007d00000026 R_PPC64_ADDR64    0000000000000000 shadow_logfd + 0
00000003fd58  007d00000026 R_PPC64_ADDR64    0000000000000000 shadow_logfd + 0
00000003fd68  007d00000026 R_PPC64_ADDR64    0000000000000000 shadow_logfd + 0
00000003fd80  007d00000026 R_PPC64_ADDR64    0000000000000000 shadow_logfd + 0
00000003fd98  007d00000026 R_PPC64_ADDR64    0000000000000000 shadow_logfd + 0
00000003fdb0  007d00000026 R_PPC64_ADDR64    0000000000000000 shadow_logfd + 0
00000003fdb8  007d00000026 R_PPC64_ADDR64    0000000000000000 shadow_logfd + 0
00000003fdc8  007d00000026 R_PPC64_ADDR64    0000000000000000 shadow_logfd + 0
00000003fdd8  007d00000026 R_PPC64_ADDR64    0000000000000000 shadow_logfd + 0
00000003fde8  007d00000026 R_PPC64_ADDR64    0000000000000000 shadow_logfd + 0
00000003fdf8  007d00000026 R_PPC64_ADDR64    0000000000000000 shadow_logfd + 0
00000003fe00  007d00000026 R_PPC64_ADDR64    0000000000000000 shadow_logfd + 0
00000003fe10  007d00000026 R_PPC64_ADDR64    0000000000000000 shadow_logfd + 0
00000003fe28  007d00000026 R_PPC64_ADDR64    0000000000000000 shadow_logfd + 0
00000003fe38  007d00000026 R_PPC64_ADDR64    0000000000000000 shadow_logfd + 0
00000003fe40  007d00000026 R_PPC64_ADDR64    0000000000000000 shadow_logfd + 0
00000003fe50  007d00000026 R_PPC64_ADDR64    0000000000000000 shadow_logfd + 0
00000003fe70  007d00000026 R_PPC64_ADDR64    0000000000000000 shadow_logfd + 0
00000003fe80  007d00000026 R_PPC64_ADDR64    0000000000000000 shadow_logfd + 0
00000003fe98  007d00000026 R_PPC64_ADDR64    0000000000000000 shadow_logfd + 0
00000003fea8  007d00000026 R_PPC64_ADDR64    0000000000000000 shadow_logfd + 0
00000003feb0  007d00000026 R_PPC64_ADDR64    0000000000000000 shadow_logfd + 0
00000003feb8  007d00000026 R_PPC64_ADDR64    0000000000000000 shadow_logfd + 0
00000003fec8  007d00000026 R_PPC64_ADDR64    0000000000000000 shadow_logfd + 0
00000003fed0  007d00000026 R_PPC64_ADDR64    0000000000000000 shadow_logfd + 0
00000003fed8  007d00000026 R_PPC64_ADDR64    0000000000000000 shadow_logfd + 0
00000003fee0  007d00000026 R_PPC64_ADDR64    0000000000000000 shadow_logfd + 0
00000003fee8  007d00000026 R_PPC64_ADDR64    0000000000000000 shadow_logfd + 0
00000003fef0  007d00000026 R_PPC64_ADDR64    0000000000000000 shadow_logfd + 0
00000003fef8  007d00000026 R_PPC64_ADDR64    0000000000000000 shadow_logfd + 0
   125: 0000000000000000     0 NOTYPE  GLOBAL DEFAULT  UND shadow_logfd

@giuseppe
Copy link
Member Author

could you please give a try to the latest version?

@gyakovlev
Copy link

sorry I missed "how" question

shadow is installed via package manager (portage on gentoo linux)

@gyakovlev
Copy link

getting this, seems to be coming from storage

  <main>> $ make
CGO_ENABLED=1 GOOS=linux GOARCH=ppc64le go build \
        -mod=vendor  \
        -ldflags '-X github.com/containers/podman/v3/libpod/define.gitCommit=b3979c5029826a4c3dec61bffecb400c90f0ca3d -X github.com/containers/podman/v3/libpod/define.buildInfo=1639992553 -X github.com/containers/podman/v3/libpod/config._installPrefix=/usr/local -X github.com/containers/podman/v3/libpod/config._etcDir=/usr/local/etc ' \
        -tags "    systemd libsubid exclude_graphdriver_devicemapper seccomp" \
        -o bin/podman ./cmd/podman
# github.com/containers/storage/pkg/idtools
/usr/lib/gcc/powerpc64le-unknown-linux-gnu/11.2.0/../../../../powerpc64le-unknown-linux-gnu/bin/ld: /usr/lib/gcc/powerpc64le-unknown-linux-gnu/11.2.0/../../../../lib64/libsubid.so: undefined reference to `shadow_logfd'
collect2: error: ld returned 1 exit status
make: *** [Makefile:312: bin/podman] Error 2

@giuseppe
Copy link
Member Author

yes, this is fixed with: containers/storage#1089

@umohnani8
Copy link
Member

LGTM

@mheon
Copy link
Member

mheon commented Dec 20, 2021

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Dec 20, 2021
@openshift-merge-robot openshift-merge-robot merged commit c133c5f into containers:main Dec 20, 2021
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants