[pipeline] Set CAP_SYS_TIME for settimeofday ok in syncd test#1068
[pipeline] Set CAP_SYS_TIME for settimeofday ok in syncd test#1068lguohan merged 3 commits intosonic-net:masterfrom
Conversation
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
|
||
| tests_SOURCES = tests.cpp | ||
| tests_CXXFLAGS = $(DBGFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS_COMMON) | ||
| tests_LDFLAGS = -Wl,-rpath,$(top_srcdir)/lib/.libs -Wl,-rpath,$(top_srcdir)/meta/.libs |
There was a problem hiding this comment.
why this is required here ? those directories are already passed in below LDADD
There was a problem hiding this comment.
Running syncd/tests depends on env LD_LIBRARY_PATH:
+ LD_LIBRARY_PATH=/sonic/src/sonic-sairedis/lib/.libs:/sonic/src/sonic-sairedis/meta/.libs
+ export LD_LIBRARY_PATH
...
+ exec /sonic/src/sonic-sairedis/syncd/.libs/tests
After setting linux capability, for security reason, LD_LIBRARY_PATH is ignored, referring to man ld.so:
Secure-execution mode
For security reasons, if the dynamic linker determines that a binary should be run in secure-execution mode, the effects of some environment variables are voided or modified, and furthermore those environment variables are stripped from the environment, so that the program does not even see the definitions...
A binary is executed in secure-execution mode ...
* A process with a non-root user ID executed a binary that conferred capabilities to the process.
Then have to specify -rpath option for runtime linker to locate shared libraries libsairedis, libsaimetadata, etc.
…s' (#633) Following sonic-net/sonic-sairedis#1067 and sonic-net/sonic-sairedis#1068, it fixes the below failure at `make check` of building syncd in step 'Compile sonic sairedis': ``` Making check in syncd make[2]: Entering directory '/__w/1/s/syncd' make check-TESTS make[3]: Entering directory '/__w/1/s/syncd' tests: tests.cpp:843: void test_watchdog_timer_clock_rollback(): Assertion `settimeofday(¤tTime, NULL) == 0' failed. /bin/bash: line 5: 13004 Aborted (core dumped) ${dir}$tst FAIL: tests ```
…s' (sonic-net#633) Following sonic-net/sonic-sairedis#1067 and sonic-net/sonic-sairedis#1068, it fixes the below failure at `make check` of building syncd in step 'Compile sonic sairedis': ``` Making check in syncd make[2]: Entering directory '/__w/1/s/syncd' make check-TESTS make[3]: Entering directory '/__w/1/s/syncd' tests: tests.cpp:843: void test_watchdog_timer_clock_rollback(): Assertion `settimeofday(¤tTime, NULL) == 0' failed. /bin/bash: line 5: 13004 Aborted (core dumped) ${dir}$tst FAIL: tests ```
…net#1068) The fix sonic-net#1067 is not enough. If docker user is non-root, set capability CAP_SYS_TIME for settimeofday success in syncd test, then test_watchdog_timer_clock_rollback can be run. Co-authored-by: junhuazhai <junhuazhai@contoso.com>
The fix #1067 is not enough. If docker user is non-root, set capability CAP_SYS_TIME for settimeofday success in syncd test, then
test_watchdog_timer_clock_rollbackcan be run.