-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adds arm64 to rock images Previously, we've skipped adding support for arm64 since some of the rocks failed to build for arm64. * Fixes longhorn-manager arm64 rocks The ``iputils`` snap does nto have an arm64 target, so we can't use that for arm64. The iputils rpm from suse (installed in the original Dockerfile) contains the following binaries: arping, clockdiff, ping, tracepath. It also contains symlinks for ping6 and tracepath6. We'll be installing equivalent apt packages for those binaries to keep parity. * Fixes v1.7.0 longhorn-engine and longhorn-instance-manager arm64 rocks When building tgt, we're getting this error on arm64: ``` bs.c: In function ‘bs_sig_request_done’: bs.c:196:15: error: ‘read’ writing 1 byte into a region of size 0 overflows the destination [-Werror=stringop-overflow=] 196 | ret = read(fd, (char *)siginfo, sizeof(siginfo)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ bs.c:193:33: note: destination object ‘siginfo’ of size 0 193 | struct signalfd_siginfo siginfo[16]; | ^~~~~~~ In file included from /usr/include/unistd.h:1217, from bs.c:33: /usr/include/aarch64-linux-gnu/bits/unistd.h:26:1: note: in a call to function ‘read’ declared with attribute ‘access (write_only, 2)’ 26 | read (int __fd, void *__buf, size_t __nbytes) | ^~~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:95: bs.o] Error 1 make[1]: Leaving directory '/root/parts/build-tgt/build/usr' make: *** [Makefile:24: programs] Error 2 'override-build' in part 'build-tgt' failed with code 2. ``` After some investigation, it seems that this Warning is not a false positive. Because ``# if defined(__NR_signalfd)`` is false, ``signalfd_siginfo`` is an empty structure, which means that siginfo is actually an array of elements that have 0 bytes in size. It seems that on arm64, there's only ``__NR_signalfd4``, not ``__NR_signalfd``. Interestingly, this does not occur on ubuntu 22.04, which is why we're not seeing this issue in the v1.6.2 rocks. xref: https://www.spinics.net/lists/linux-stgt/msg04783.html This patch is a cherry-pick of the following commit (+ resolved conflicts), which solves this issue: fujita/tgt@7ea5597
- Loading branch information
1 parent
c5f9bbb
commit 80f94fc
Showing
16 changed files
with
212 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ base: [email protected] | |
build-base: [email protected] | ||
platforms: | ||
amd64: | ||
arm64: | ||
|
||
|
||
services: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ base: [email protected] | |
build-base: [email protected] | ||
platforms: | ||
amd64: | ||
arm64: | ||
|
||
services: | ||
longhorn-engine: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ base: [email protected] | |
build-base: [email protected] | ||
platforms: | ||
amd64: | ||
arm64: | ||
|
||
environment: | ||
LD_LIBRARY_PATH: /usr/local/lib | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ base: [email protected] | |
build-base: [email protected] | ||
platforms: | ||
amd64: | ||
arm64: | ||
|
||
services: | ||
longhorn-manager: | ||
|
@@ -97,5 +98,15 @@ parts: | |
- xfsprogs | ||
- zip | ||
- unzip | ||
stage-snaps: | ||
- iputils | ||
# Original Dockerfile is installing iputils. The iputils snap does not have an arm64 target, | ||
# so we can't use that for arm64. | ||
# The iputils rpm from suse contains the following binaries: arping, clockdiff, ping, tracepath. | ||
# It also contains symlinks for ping6 and tracepath6. | ||
- iputils-arping | ||
- iputils-clockdiff | ||
- iputils-ping | ||
- iputils-tracepath | ||
override-build: | | ||
# iputils-ping already contains a symlink for ping6. | ||
mkdir -p $CRAFT_PART_INSTALL/usr/bin | ||
ln -s tracepath $CRAFT_PART_INSTALL/usr/bin/tracepath6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ base: [email protected] | |
build-base: [email protected] | ||
platforms: | ||
amd64: | ||
arm64: | ||
|
||
services: | ||
longhorn-share-manager: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ build-base: [email protected] | |
|
||
platforms: | ||
amd64: | ||
arm64: | ||
|
||
environment: | ||
APP_VERSION: v1.6.2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ run-user: _daemon_ | |
|
||
platforms: | ||
amd64: | ||
arm64: | ||
|
||
environment: | ||
APP_VERSION: v0.0.37 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ base: [email protected] | |
build-base: [email protected] | ||
platforms: | ||
amd64: | ||
arm64: | ||
|
||
|
||
services: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
diff --git a/usr/bs.c b/usr/bs.c | ||
index 8171a32..21547d5 100644 | ||
--- a/usr/bs.c | ||
+++ b/usr/bs.c | ||
@@ -311,7 +311,7 @@ static int bs_init_signalfd(void) | ||
sigaddset(&mask, SIGUSR2); | ||
sigprocmask(SIG_BLOCK, &mask, NULL); | ||
|
||
- sig_fd = __signalfd(-1, &mask, 0); | ||
+ sig_fd = signalfd(-1, &mask, O_NONBLOCK); | ||
if (sig_fd < 0) | ||
return 1; | ||
|
||
diff --git a/usr/util.h b/usr/util.h | ||
index eefce74..8a857bb 100644 | ||
--- a/usr/util.h | ||
+++ b/usr/util.h | ||
@@ -15,6 +15,7 @@ | ||
#include <string.h> | ||
#include <limits.h> | ||
#include <linux/types.h> | ||
+#include <sys/signalfd.h> | ||
|
||
#include "be_byteshift.h" | ||
|
||
@@ -99,44 +100,6 @@ static inline int between(uint32_t seq1, uint32_t seq2, uint32_t seq3) | ||
|
||
extern unsigned long pagesize, pageshift; | ||
|
||
-#if defined(__NR_signalfd) && defined(USE_SIGNALFD) | ||
- | ||
-/* | ||
- * workaround for broken linux/signalfd.h including | ||
- * usr/include/linux/fcntl.h | ||
- */ | ||
-#define _LINUX_FCNTL_H | ||
- | ||
-#include <linux/signalfd.h> | ||
- | ||
-static inline int __signalfd(int fd, const sigset_t *mask, int flags) | ||
-{ | ||
- int fd2, ret; | ||
- | ||
- fd2 = syscall(__NR_signalfd, fd, mask, _NSIG / 8); | ||
- if (fd2 < 0) | ||
- return fd2; | ||
- | ||
- ret = fcntl(fd2, F_GETFL); | ||
- if (ret < 0) { | ||
- close(fd2); | ||
- return -1; | ||
- } | ||
- | ||
- ret = fcntl(fd2, F_SETFL, ret | O_NONBLOCK); | ||
- if (ret < 0) { | ||
- close(fd2); | ||
- return -1; | ||
- } | ||
- | ||
- return fd2; | ||
-} | ||
-#else | ||
-#define __signalfd(fd, mask, flags) (-1) | ||
-struct signalfd_siginfo { | ||
-}; | ||
-#endif | ||
- | ||
/* convert string to integer, check for validity of the string numeric format | ||
* and the natural boundaries of the integer value type (first get a 64-bit | ||
* value and check that it fits the range of the destination integer). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ base: [email protected] | |
build-base: [email protected] | ||
platforms: | ||
amd64: | ||
arm64: | ||
|
||
|
||
services: | ||
|
@@ -185,6 +186,23 @@ parts: | |
override-build: | | ||
set -eux -o pipefail | ||
# When building tgt, we're getting this error on arm64: | ||
# | ||
# bs.c: In function ‘bs_sig_request_done’: | ||
# bs.c:196:15: error: ‘read’ writing 1 byte into a region of size 0 overflows the destination [-Werror=stringop-overflow=] | ||
# 196 | ret = read(fd, (char *)siginfo, sizeof(siginfo)); | ||
# | ||
# After some investigation, it seems that this Warning is not a false positive. | ||
# Because defined(__NR_signalfd) is false, signalfd_siginfo is an empty structure, which means | ||
# that siginfo is actually an array of elements that have 0 bytes in size. | ||
# It seems that on arm64, there's only __NR_signalfd4, not __NR_signalfd. | ||
# Interestingly, this does not occur on ubuntu 22.04. | ||
# xref: https://www.spinics.net/lists/linux-stgt/msg04783.html | ||
# | ||
# This patch is a cherry-pick of the following commit (+ resolved conflicts), which solves this issue: | ||
# https://github.com/fujita/tgt/commit/7ea559753e647e6a5fa5a0ca3c29ba417d9744b7 | ||
git apply -v $CRAFT_PROJECT_DIR/fix-arm64-compile-breakage.patch | ||
make | ||
make install | ||
|
70 changes: 70 additions & 0 deletions
70
v1.7.0/longhorn-instance-manager/fix-arm64-compile-breakage.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
diff --git a/usr/bs.c b/usr/bs.c | ||
index 8171a32..21547d5 100644 | ||
--- a/usr/bs.c | ||
+++ b/usr/bs.c | ||
@@ -311,7 +311,7 @@ static int bs_init_signalfd(void) | ||
sigaddset(&mask, SIGUSR2); | ||
sigprocmask(SIG_BLOCK, &mask, NULL); | ||
|
||
- sig_fd = __signalfd(-1, &mask, 0); | ||
+ sig_fd = signalfd(-1, &mask, O_NONBLOCK); | ||
if (sig_fd < 0) | ||
return 1; | ||
|
||
diff --git a/usr/util.h b/usr/util.h | ||
index eefce74..8a857bb 100644 | ||
--- a/usr/util.h | ||
+++ b/usr/util.h | ||
@@ -15,6 +15,7 @@ | ||
#include <string.h> | ||
#include <limits.h> | ||
#include <linux/types.h> | ||
+#include <sys/signalfd.h> | ||
|
||
#include "be_byteshift.h" | ||
|
||
@@ -99,44 +100,6 @@ static inline int between(uint32_t seq1, uint32_t seq2, uint32_t seq3) | ||
|
||
extern unsigned long pagesize, pageshift; | ||
|
||
-#if defined(__NR_signalfd) && defined(USE_SIGNALFD) | ||
- | ||
-/* | ||
- * workaround for broken linux/signalfd.h including | ||
- * usr/include/linux/fcntl.h | ||
- */ | ||
-#define _LINUX_FCNTL_H | ||
- | ||
-#include <linux/signalfd.h> | ||
- | ||
-static inline int __signalfd(int fd, const sigset_t *mask, int flags) | ||
-{ | ||
- int fd2, ret; | ||
- | ||
- fd2 = syscall(__NR_signalfd, fd, mask, _NSIG / 8); | ||
- if (fd2 < 0) | ||
- return fd2; | ||
- | ||
- ret = fcntl(fd2, F_GETFL); | ||
- if (ret < 0) { | ||
- close(fd2); | ||
- return -1; | ||
- } | ||
- | ||
- ret = fcntl(fd2, F_SETFL, ret | O_NONBLOCK); | ||
- if (ret < 0) { | ||
- close(fd2); | ||
- return -1; | ||
- } | ||
- | ||
- return fd2; | ||
-} | ||
-#else | ||
-#define __signalfd(fd, mask, flags) (-1) | ||
-struct signalfd_siginfo { | ||
-}; | ||
-#endif | ||
- | ||
/* convert string to integer, check for validity of the string numeric format | ||
* and the natural boundaries of the integer value type (first get a 64-bit | ||
* value and check that it fits the range of the destination integer). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ base: [email protected] | |
build-base: [email protected] | ||
platforms: | ||
amd64: | ||
arm64: | ||
|
||
environment: | ||
LD_LIBRARY_PATH: /usr/local/lib | ||
|
@@ -199,6 +200,23 @@ parts: | |
override-build: | | ||
set -eux -o pipefail | ||
# When building tgt, we're getting this error on arm64: | ||
# | ||
# bs.c: In function ‘bs_sig_request_done’: | ||
# bs.c:196:15: error: ‘read’ writing 1 byte into a region of size 0 overflows the destination [-Werror=stringop-overflow=] | ||
# 196 | ret = read(fd, (char *)siginfo, sizeof(siginfo)); | ||
# | ||
# After some investigation, it seems that this Warning is not a false positive. | ||
# Because defined(__NR_signalfd) is false, signalfd_siginfo is an empty structure, which means | ||
# that siginfo is actually an array of elements that have 0 bytes in size. | ||
# It seems that on arm64, there's only __NR_signalfd4, not __NR_signalfd. | ||
# Interestingly, this does not occur on ubuntu 22.04. | ||
# xref: https://www.spinics.net/lists/linux-stgt/msg04783.html | ||
# | ||
# This patch is a cherry-pick of the following commit (+ resolved conflicts), which solves this issue: | ||
# https://github.com/fujita/tgt/commit/7ea559753e647e6a5fa5a0ca3c29ba417d9744b7 | ||
git apply -v $CRAFT_PROJECT_DIR/fix-arm64-compile-breakage.patch | ||
make | ||
make install | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ base: [email protected] | |
build-base: [email protected] | ||
platforms: | ||
amd64: | ||
arm64: | ||
|
||
services: | ||
longhorn-manager: | ||
|
@@ -97,5 +98,15 @@ parts: | |
- zip | ||
- unzip | ||
- kmod | ||
stage-snaps: | ||
- iputils | ||
# Original Dockerfile is installing iputils. The iputils snap does not have an arm64 target, | ||
# so we can't use that for arm64. | ||
# The iputils rpm from suse contains the following binaries: arping, clockdiff, ping, tracepath. | ||
# It also contains symlinks for ping6 and tracepath6. | ||
- iputils-arping | ||
- iputils-clockdiff | ||
- iputils-ping | ||
- iputils-tracepath | ||
override-build: | | ||
# iputils-ping already contains a symlink for ping6. | ||
mkdir -p $CRAFT_PART_INSTALL/usr/bin | ||
ln -s tracepath $CRAFT_PART_INSTALL/usr/bin/tracepath6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ base: [email protected] | |
build-base: [email protected] | ||
platforms: | ||
amd64: | ||
arm64: | ||
|
||
services: | ||
longhorn-share-manager: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ build-base: [email protected] | |
|
||
platforms: | ||
amd64: | ||
arm64: | ||
|
||
environment: | ||
APP_VERSION: v1.7.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ run-user: _daemon_ | |
|
||
platforms: | ||
amd64: | ||
arm64: | ||
|
||
environment: | ||
APP_VERSION: v0.0.41 | ||
|