* [PATCH] go-runtime: prevent host leakage into target objects
@ 2017-09-29 14:15 Matt Madison
2017-09-29 14:27 ` Otavio Salvador
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Matt Madison @ 2017-09-29 14:15 UTC (permalink / raw)
To: openembedded-core; +Cc: otavio
When building for a target whose architecture matches
the build host's, the second pass through make.bash
to build the shareable runtime would also overwrite
the target's static cgo library with host-compatibile
binaries.
Fix this by running the host-side build once and
target-only passes of make.bash twice, for static
and shareable. This ensures that what gets installed
is target-compatible.
[YOCTO #12136]
Signed-off-by: Matt Madison <matt@madison.systems>
---
meta/recipes-devtools/go/go-runtime.inc | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/meta/recipes-devtools/go/go-runtime.inc b/meta/recipes-devtools/go/go-runtime.inc
index 934d1aa..bd26e2e 100644
--- a/meta/recipes-devtools/go/go-runtime.inc
+++ b/meta/recipes-devtools/go/go-runtime.inc
@@ -23,9 +23,13 @@ do_compile() {
rm -rf ${GOBIN} ${B}/pkg
mkdir ${GOBIN}
cd src
- GO_FLAGS="" ./make.bash
+ ./make.bash --host-only
+ cp ${B}/pkg/tool/${BUILD_GOTUPLE}/go_bootstrap ${B}
+ rm -rf ${B}/pkg/${TARGET_GOTUPLE}
+ ./make.bash --target-only
if [ -n "${GO_DYNLINK}" ]; then
- GO_FLAGS="-buildmode=shared" GO_LDFLAGS="-extldflags \"${LDFLAGS}\"" ./make.bash
+ cp ${B}/go_bootstrap ${B}/pkg/tool/${BUILD_GOTUPLE}
+ GO_FLAGS="-buildmode=shared" GO_LDFLAGS="-extldflags \"${LDFLAGS}\"" ./make.bash --target-only
fi
cd ${B}
}
@@ -41,8 +45,9 @@ do_install() {
rm -rf ${D}${libdir}/go/pkg/obj
rm -rf ${D}${libdir}/go/pkg/bootstrap
find src -mindepth 1 -maxdepth 1 -type d | while read srcdir; do
- [ "$srcdir" = "./cmd" ] || cp --preserve=mode,timestamps -R $srcdir ${D}${libdir}/go/src/
+ cp --preserve=mode,timestamps -R $srcdir ${D}${libdir}/go/src/
done
+ rm -f ${D}${libdir}/go/src/cmd/dist/dist
}
# Remove test binaries that cannot be relocated
--
2.7.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] go-runtime: prevent host leakage into target objects
2017-09-29 14:15 [PATCH] go-runtime: prevent host leakage into target objects Matt Madison
@ 2017-09-29 14:27 ` Otavio Salvador
2017-10-03 22:02 ` Wold, Saul
2017-10-03 22:07 ` Saul Wold
2 siblings, 0 replies; 5+ messages in thread
From: Otavio Salvador @ 2017-09-29 14:27 UTC (permalink / raw)
To: Matt Madison
Cc: Otavio Salvador, Patches and discussions about the oe-core layer
On Fri, Sep 29, 2017 at 11:15 AM, Matt Madison <matt@madison.systems> wrote:
> When building for a target whose architecture matches
> the build host's, the second pass through make.bash
> to build the shareable runtime would also overwrite
> the target's static cgo library with host-compatibile
> binaries.
>
> Fix this by running the host-side build once and
> target-only passes of make.bash twice, for static
> and shareable. This ensures that what gets installed
> is target-compatible.
>
> [YOCTO #12136]
>
> Signed-off-by: Matt Madison <matt@madison.systems>
Acked-by: Otavio Salvador <otavio@ossystems.com.br>
--
Otavio Salvador O.S. Systems
http://www.ossystems.com.br http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854 Mobile: +1 (347) 903-9750
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] go-runtime: prevent host leakage into target objects
2017-09-29 14:15 [PATCH] go-runtime: prevent host leakage into target objects Matt Madison
2017-09-29 14:27 ` Otavio Salvador
@ 2017-10-03 22:02 ` Wold, Saul
2017-10-04 11:18 ` Matt Madison
2017-10-03 22:07 ` Saul Wold
2 siblings, 1 reply; 5+ messages in thread
From: Wold, Saul @ 2017-10-03 22:02 UTC (permalink / raw)
To: matt, openembedded-core; +Cc: otavio
On Fri, 2017-09-29 at 14:15 +0000, Matt Madison wrote:
> When building for a target whose architecture matches
> the build host's, the second pass through make.bash
> to build the shareable runtime would also overwrite
> the target's static cgo library with host-compatibile
> binaries.
>
> Fix this by running the host-side build once and
> target-only passes of make.bash twice, for static
> and shareable. This ensures that what gets installed
> is target-compatible.
>
> [YOCTO #12136]
>
This does not appear to actually fix the bug mentioned here, I just
found the failure again with intel-corei7-64 (from meta-intel) and then
confirmed that it fails with qemux86-64 and genericx86-64 when using
TCLIBC = "musl"
Can you please verify and test with MUSL.
Thanks
Sau!
> Signed-off-by: Matt Madison <matt@madison.systems>
> ---
> meta/recipes-devtools/go/go-runtime.inc | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/meta/recipes-devtools/go/go-runtime.inc b/meta/recipes-
> devtools/go/go-runtime.inc
> index 934d1aa..bd26e2e 100644
> --- a/meta/recipes-devtools/go/go-runtime.inc
> +++ b/meta/recipes-devtools/go/go-runtime.inc
> @@ -23,9 +23,13 @@ do_compile() {
> rm -rf ${GOBIN} ${B}/pkg
> mkdir ${GOBIN}
> cd src
> - GO_FLAGS="" ./make.bash
> + ./make.bash --host-only
> + cp ${B}/pkg/tool/${BUILD_GOTUPLE}/go_bootstrap ${B}
> + rm -rf ${B}/pkg/${TARGET_GOTUPLE}
> + ./make.bash --target-only
> if [ -n "${GO_DYNLINK}" ]; then
> - GO_FLAGS="-buildmode=shared" GO_LDFLAGS="-extldflags
> \"${LDFLAGS}\"" ./make.bash
> + cp ${B}/go_bootstrap ${B}/pkg/tool/${BUILD_GOTUPLE}
> + GO_FLAGS="-buildmode=shared" GO_LDFLAGS="-extldflags
> \"${LDFLAGS}\"" ./make.bash --target-only
> fi
> cd ${B}
> }
> @@ -41,8 +45,9 @@ do_install() {
> rm -rf ${D}${libdir}/go/pkg/obj
> rm -rf ${D}${libdir}/go/pkg/bootstrap
> find src -mindepth 1 -maxdepth 1 -type d | while read
> srcdir; do
> - [ "$srcdir" = "./cmd" ] || cp --
> preserve=mode,timestamps -R $srcdir ${D}${libdir}/go/src/
> + cp --preserve=mode,timestamps -R $srcdir
> ${D}${libdir}/go/src/
> done
> + rm -f ${D}${libdir}/go/src/cmd/dist/dist
> }
>
> # Remove test binaries that cannot be relocated
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] go-runtime: prevent host leakage into target objects
2017-09-29 14:15 [PATCH] go-runtime: prevent host leakage into target objects Matt Madison
2017-09-29 14:27 ` Otavio Salvador
2017-10-03 22:02 ` Wold, Saul
@ 2017-10-03 22:07 ` Saul Wold
2 siblings, 0 replies; 5+ messages in thread
From: Saul Wold @ 2017-10-03 22:07 UTC (permalink / raw)
To: matt, openembedded-core; +Cc: otavio
On Fri, 2017-09-29 at 14:15 +0000, Matt Madison wrote:
> When building for a target whose architecture matches
> the build host's, the second pass through make.bash
> to build the shareable runtime would also overwrite
> the target's static cgo library with host-compatibile
> binaries.
>
> Fix this by running the host-side build once and
> target-only passes of make.bash twice, for static
> and shareable. This ensures that what gets installed
> is target-compatible.
>
> [YOCTO #12136]
>
This does not appear to actually fix the bug mentioned here, I just
found the failure again with intel-corei7-64 (from meta-intel) and then
confirmed that it fails with qemux86-64 and genericx86-64 when using
TCLIBC = "musl"
Can you please verify and test with MUSL.
Thanks
Sau!
> Signed-off-by: Matt Madison <matt@madison.systems>
> ---
> meta/recipes-devtools/go/go-runtime.inc | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/meta/recipes-devtools/go/go-runtime.inc b/meta/recipes-
> devtools/go/go-runtime.inc
> index 934d1aa..bd26e2e 100644
> --- a/meta/recipes-devtools/go/go-runtime.inc
> +++ b/meta/recipes-devtools/go/go-runtime.inc
> @@ -23,9 +23,13 @@ do_compile() {
> rm -rf ${GOBIN} ${B}/pkg
> mkdir ${GOBIN}
> cd src
> - GO_FLAGS="" ./make.bash
> + ./make.bash --host-only
> + cp ${B}/pkg/tool/${BUILD_GOTUPLE}/go_bootstrap ${B}
> + rm -rf ${B}/pkg/${TARGET_GOTUPLE}
> + ./make.bash --target-only
> if [ -n "${GO_DYNLINK}" ]; then
> - GO_FLAGS="-buildmode=shared" GO_LDFLAGS="-
> extldflags
> \"${LDFLAGS}\"" ./make.bash
> + cp ${B}/go_bootstrap ${B}/pkg/tool/${BUILD_GOTUPLE}
> + GO_FLAGS="-buildmode=shared" GO_LDFLAGS="-
> extldflags
> \"${LDFLAGS}\"" ./make.bash --target-only
> fi
> cd ${B}
> }
> @@ -41,8 +45,9 @@ do_install() {
> rm -rf ${D}${libdir}/go/pkg/obj
> rm -rf ${D}${libdir}/go/pkg/bootstrap
> find src -mindepth 1 -maxdepth 1 -type d | while read
> srcdir; do
> - [ "$srcdir" = "./cmd" ] || cp --
> preserve=mode,timestamps -R $srcdir ${D}${libdir}/go/src/
> + cp --preserve=mode,timestamps -R $srcdir
> ${D}${libdir}/go/src/
> done
> + rm -f ${D}${libdir}/go/src/cmd/dist/dist
> }
>
> # Remove test binaries that cannot be relocated
> --
> 2.7.4
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] go-runtime: prevent host leakage into target objects
2017-10-03 22:02 ` Wold, Saul
@ 2017-10-04 11:18 ` Matt Madison
0 siblings, 0 replies; 5+ messages in thread
From: Matt Madison @ 2017-10-04 11:18 UTC (permalink / raw)
To: Wold, Saul; +Cc: otavio, openembedded-core
On Tue, Oct 3, 2017 at 3:02 PM, Wold, Saul <saul.wold@intel.com> wrote:
> On Fri, 2017-09-29 at 14:15 +0000, Matt Madison wrote:
>> When building for a target whose architecture matches
>> the build host's, the second pass through make.bash
>> to build the shareable runtime would also overwrite
>> the target's static cgo library with host-compatibile
>> binaries.
>>
>> Fix this by running the host-side build once and
>> target-only passes of make.bash twice, for static
>> and shareable. This ensures that what gets installed
>> is target-compatible.
>>
>> [YOCTO #12136]
>>
> This does not appear to actually fix the bug mentioned here, I just
> found the failure again with intel-corei7-64 (from meta-intel) and then
> confirmed that it fails with qemux86-64 and genericx86-64 when using
> TCLIBC = "musl"
>
> Can you please verify and test with MUSL.
Hmm. I had tested with MUSL before sending that patch, but I'll try
it again to see what I might have missed.
-Matt
>
> Thanks
> Sau!
>
>
>> Signed-off-by: Matt Madison <matt@madison.systems>
>> ---
>> meta/recipes-devtools/go/go-runtime.inc | 11 ++++++++---
>> 1 file changed, 8 insertions(+), 3 deletions(-)
>>
>> diff --git a/meta/recipes-devtools/go/go-runtime.inc b/meta/recipes-
>> devtools/go/go-runtime.inc
>> index 934d1aa..bd26e2e 100644
>> --- a/meta/recipes-devtools/go/go-runtime.inc
>> +++ b/meta/recipes-devtools/go/go-runtime.inc
>> @@ -23,9 +23,13 @@ do_compile() {
>> rm -rf ${GOBIN} ${B}/pkg
>> mkdir ${GOBIN}
>> cd src
>> - GO_FLAGS="" ./make.bash
>> + ./make.bash --host-only
>> + cp ${B}/pkg/tool/${BUILD_GOTUPLE}/go_bootstrap ${B}
>> + rm -rf ${B}/pkg/${TARGET_GOTUPLE}
>> + ./make.bash --target-only
>> if [ -n "${GO_DYNLINK}" ]; then
>> - GO_FLAGS="-buildmode=shared" GO_LDFLAGS="-extldflags
>> \"${LDFLAGS}\"" ./make.bash
>> + cp ${B}/go_bootstrap ${B}/pkg/tool/${BUILD_GOTUPLE}
>> + GO_FLAGS="-buildmode=shared" GO_LDFLAGS="-extldflags
>> \"${LDFLAGS}\"" ./make.bash --target-only
>> fi
>> cd ${B}
>> }
>> @@ -41,8 +45,9 @@ do_install() {
>> rm -rf ${D}${libdir}/go/pkg/obj
>> rm -rf ${D}${libdir}/go/pkg/bootstrap
>> find src -mindepth 1 -maxdepth 1 -type d | while read
>> srcdir; do
>> - [ "$srcdir" = "./cmd" ] || cp --
>> preserve=mode,timestamps -R $srcdir ${D}${libdir}/go/src/
>> + cp --preserve=mode,timestamps -R $srcdir
>> ${D}${libdir}/go/src/
>> done
>> + rm -f ${D}${libdir}/go/src/cmd/dist/dist
>> }
>>
>> # Remove test binaries that cannot be relocated
>> --
>> 2.7.4
>>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-10-04 11:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-29 14:15 [PATCH] go-runtime: prevent host leakage into target objects Matt Madison
2017-09-29 14:27 ` Otavio Salvador
2017-10-03 22:02 ` Wold, Saul
2017-10-04 11:18 ` Matt Madison
2017-10-03 22:07 ` Saul Wold
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.