Re: libgo patch committed: Update to final Go 1.12 release

2019-03-06 Thread Ian Lance Taylor
On Wed, Mar 6, 2019 at 6:08 AM Uros Bizjak  wrote:
>
> On Wed, Mar 6, 2019 at 2:49 PM Ian Lance Taylor  wrote:
> >
> > On Wed, Mar 6, 2019 at 5:39 AM Uros Bizjak  wrote:
> > >
> > > On Tue, Mar 5, 2019 at 9:50 PM Ian Lance Taylor  wrote:
> > > >
> > > > On Tue, Mar 5, 2019 at 1:02 AM Uros Bizjak  wrote:
> > > > >
> > > > > > I've committed this patch to update to the final Go 1.12 release.
> > > > > > Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.  Committed
> > > > > > to mainline.
> > > > >
> > > > > This patch introduced following failure in CentOS 5.11:
> > > > >
> > > > > syscall_linux_test.go:381:11: error: reference to undefined field or
> > > > > method 'Flags'
> > > > >   381 |  return st.Flags_NOSUID != 0
> > > > >   |   ^
> > > > > FAIL: syscall
> > > >
> > > > Thanks.  Should be fixed by this patch, tested on x86_64-pc-linux-gnu,
> > > > committed to mainline.
> > >
> > > Attached patchlet is also needed to create correct sysinfo.go.
> > >
> > > Tested on CentOS 5.11.
> >
> > Bother, I don't know what I was thinking.  I think this patch is a bit
> > better.  Could you test whether it works for you?  Thanks.
>
> Yes, this patch works for me on CentOS 5.11.

Thanks.  Committed to mainline.

Ian


Re: libgo patch committed: Update to final Go 1.12 release

2019-03-06 Thread Uros Bizjak
On Wed, Mar 6, 2019 at 2:49 PM Ian Lance Taylor  wrote:
>
> On Wed, Mar 6, 2019 at 5:39 AM Uros Bizjak  wrote:
> >
> > On Tue, Mar 5, 2019 at 9:50 PM Ian Lance Taylor  wrote:
> > >
> > > On Tue, Mar 5, 2019 at 1:02 AM Uros Bizjak  wrote:
> > > >
> > > > > I've committed this patch to update to the final Go 1.12 release.
> > > > > Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.  Committed
> > > > > to mainline.
> > > >
> > > > This patch introduced following failure in CentOS 5.11:
> > > >
> > > > syscall_linux_test.go:381:11: error: reference to undefined field or
> > > > method 'Flags'
> > > >   381 |  return st.Flags_NOSUID != 0
> > > >   |   ^
> > > > FAIL: syscall
> > >
> > > Thanks.  Should be fixed by this patch, tested on x86_64-pc-linux-gnu,
> > > committed to mainline.
> >
> > Attached patchlet is also needed to create correct sysinfo.go.
> >
> > Tested on CentOS 5.11.
>
> Bother, I don't know what I was thinking.  I think this patch is a bit
> better.  Could you test whether it works for you?  Thanks.

Yes, this patch works for me on CentOS 5.11.

Thanks,
Uros.


Re: libgo patch committed: Update to final Go 1.12 release

2019-03-06 Thread Ian Lance Taylor
On Wed, Mar 6, 2019 at 5:39 AM Uros Bizjak  wrote:
>
> On Tue, Mar 5, 2019 at 9:50 PM Ian Lance Taylor  wrote:
> >
> > On Tue, Mar 5, 2019 at 1:02 AM Uros Bizjak  wrote:
> > >
> > > > I've committed this patch to update to the final Go 1.12 release.
> > > > Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.  Committed
> > > > to mainline.
> > >
> > > This patch introduced following failure in CentOS 5.11:
> > >
> > > syscall_linux_test.go:381:11: error: reference to undefined field or
> > > method 'Flags'
> > >   381 |  return st.Flags_NOSUID != 0
> > >   |   ^
> > > FAIL: syscall
> >
> > Thanks.  Should be fixed by this patch, tested on x86_64-pc-linux-gnu,
> > committed to mainline.
>
> Attached patchlet is also needed to create correct sysinfo.go.
>
> Tested on CentOS 5.11.

Bother, I don't know what I was thinking.  I think this patch is a bit
better.  Could you test whether it works for you?  Thanks.

Ian
diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh
index e0ae30f6..418ba2cf 100755
--- a/libgo/mksysinfo.sh
+++ b/libgo/mksysinfo.sh
@@ -1115,14 +1115,13 @@ grep '^const _FALLOC_' gen-sysinfo.go |
 # Prefer largefile variant if available.
 # CentOS 5 does not have f_flags, so pull from f_spare.
 statfs=`grep '^type _statfs64 ' gen-sysinfo.go || true`
+if test "$statfs" == ""; then
+  statfs=`grep '^type _statfs ' gen-sysinfo.go || true`
+fi
 if ! echo "$statfs" | grep f_flags; then
   statfs=`echo "$statfs" | sed -e 's/f_spare \[4+1\]\([^ ;]*\)/f_flags \1; 
f_spare [3+1]\1/'`
 fi
-if test "$statfs" != ""; then
-  grep '^type _statfs64 ' gen-sysinfo.go
-else
-  grep '^type _statfs ' gen-sysinfo.go
-fi | sed -e 's/type _statfs64/type Statfs_t/' \
+echo "$statfs" | sed -e 's/type _statfs64/type Statfs_t/' \
 -e 's/type _statfs/type Statfs_t/' \
 -e 's/f_type/Type/' \
 -e 's/f_bsize/Bsize/' \


Re: libgo patch committed: Update to final Go 1.12 release

2019-03-06 Thread Uros Bizjak
On Tue, Mar 5, 2019 at 9:50 PM Ian Lance Taylor  wrote:
>
> On Tue, Mar 5, 2019 at 1:02 AM Uros Bizjak  wrote:
> >
> > > I've committed this patch to update to the final Go 1.12 release.
> > > Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.  Committed
> > > to mainline.
> >
> > This patch introduced following failure in CentOS 5.11:
> >
> > syscall_linux_test.go:381:11: error: reference to undefined field or
> > method 'Flags'
> >   381 |  return st.Flags_NOSUID != 0
> >   |   ^
> > FAIL: syscall
>
> Thanks.  Should be fixed by this patch, tested on x86_64-pc-linux-gnu,
> committed to mainline.

Attached patchlet is also needed to create correct sysinfo.go.

Tested on CentOS 5.11.

Uros.
diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh
index e0ae30f..56a6546 100755
--- a/libgo/mksysinfo.sh
+++ b/libgo/mksysinfo.sh
@@ -1119,7 +1119,7 @@ if ! echo "$statfs" | grep f_flags; then
   statfs=`echo "$statfs" | sed -e 's/f_spare \[4+1\]\([^ ;]*\)/f_flags \1; 
f_spare [3+1]\1/'`
 fi
 if test "$statfs" != ""; then
-  grep '^type _statfs64 ' gen-sysinfo.go
+  echo $statfs
 else
   grep '^type _statfs ' gen-sysinfo.go
 fi | sed -e 's/type _statfs64/type Statfs_t/' \


Re: libgo patch committed: Update to final Go 1.12 release

2019-03-05 Thread Ian Lance Taylor
On Tue, Mar 5, 2019 at 1:02 AM Uros Bizjak  wrote:
>
> > I've committed this patch to update to the final Go 1.12 release.
> > Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.  Committed
> > to mainline.
>
> This patch introduced following failure in CentOS 5.11:
>
> syscall_linux_test.go:381:11: error: reference to undefined field or
> method 'Flags'
>   381 |  return st.Flags_NOSUID != 0
>   |   ^
> FAIL: syscall

Thanks.  Should be fixed by this patch, tested on x86_64-pc-linux-gnu,
committed to mainline.

Ian
Index: gcc/go/gofrontend/MERGE
===
--- gcc/go/gofrontend/MERGE (revision 269399)
+++ gcc/go/gofrontend/MERGE (working copy)
@@ -1,4 +1,4 @@
-689d5bda159300dc12f559de2d47b8c1c762fcb9
+3ae3024cae07fe7e85968ad2583add350616b296
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: libgo/mksysinfo.sh
===
--- libgo/mksysinfo.sh  (revision 269196)
+++ libgo/mksysinfo.sh  (working copy)
@@ -1113,7 +1113,11 @@ grep '^const _FALLOC_' gen-sysinfo.go |
 
 # The statfs struct.
 # Prefer largefile variant if available.
+# CentOS 5 does not have f_flags, so pull from f_spare.
 statfs=`grep '^type _statfs64 ' gen-sysinfo.go || true`
+if ! echo "$statfs" | grep f_flags; then
+  statfs=`echo "$statfs" | sed -e 's/f_spare \[4+1\]\([^ ;]*\)/f_flags \1; 
f_spare [3+1]\1/'`
+fi
 if test "$statfs" != ""; then
   grep '^type _statfs64 ' gen-sysinfo.go
 else


Re: libgo patch committed: Update to final Go 1.12 release

2019-03-05 Thread Uros Bizjak
Hello!

> I've committed this patch to update to the final Go 1.12 release.
> Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.  Committed
> to mainline.

This patch introduced following failure in CentOS 5.11:

syscall_linux_test.go:381:11: error: reference to undefined field or
method 'Flags'
  381 |  return st.Flags_NOSUID != 0
  |   ^
FAIL: syscall

According to man statfs, flags were introduced in linux 2.6.36:

   struct statfs {
   __fsword_t f_type;/* Type of filesystem (see below) */
   __fsword_t f_bsize;   /* Optimal transfer block size */
   fsblkcnt_t f_blocks;  /* Total data blocks in filesystem */
   fsblkcnt_t f_bfree;   /* Free blocks in filesystem */
   fsblkcnt_t f_bavail;  /* Free blocks available to
unprivileged user */
   fsfilcnt_t f_files;   /* Total file nodes in filesystem */
   fsfilcnt_t f_ffree;   /* Free file nodes in filesystem */
   fsid_t f_fsid;/* Filesystem ID */
   __fsword_t f_namelen; /* Maximum length of filenames */
   __fsword_t f_frsize;  /* Fragment size (since Linux 2.6) */
   __fsword_t f_flags;   /* Mount flags of filesystem
(since Linux 2.6.36) */
   __fsword_t f_spare[xxx];
   /* Padding bytes reserved for future use */
   };

CentOS 5.11 defines struct statfs as:

struct statfs
  {
__SWORD_TYPE f_type;
__SWORD_TYPE f_bsize;
#ifndef __USE_FILE_OFFSET64
__fsblkcnt_t f_blocks;
__fsblkcnt_t f_bfree;
__fsblkcnt_t f_bavail;
__fsfilcnt_t f_files;
__fsfilcnt_t f_ffree;
#else
__fsblkcnt64_t f_blocks;
__fsblkcnt64_t f_bfree;
__fsblkcnt64_t f_bavail;
__fsfilcnt64_t f_files;
__fsfilcnt64_t f_ffree;
#endif
__fsid_t f_fsid;
__SWORD_TYPE f_namelen;
__SWORD_TYPE f_frsize;
__SWORD_TYPE f_spare[5];
  };

so, Statfs_t in sysinfo.go corresponds to:

sysinfo.go:type Statfs_t struct { Type int64; Bsize int64; Blocks
uint64; Bfree uint64; Bavail uint64; Files uint64; Ffree uint64; Fsid
___fsid_t; Namelen int64; Frsize int64; Spare [4+1]int64; }

Uros.


libgo patch committed: Update to final Go 1.12 release

2019-02-26 Thread Ian Lance Taylor
I've committed this patch to update to the final Go 1.12 release.
Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.  Committed
to mainline.

Ian
Index: gcc/go/gofrontend/MERGE
===
--- gcc/go/gofrontend/MERGE (revision 269214)
+++ gcc/go/gofrontend/MERGE (working copy)
@@ -1,4 +1,4 @@
-e330eea4464f1513808ccd95011edb4ccbe946b5
+558fcb7bf2a6b78bdba87f20a8a4a95d27125d74
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: libgo/MERGE
===
--- libgo/MERGE (revision 269202)
+++ libgo/MERGE (working copy)
@@ -1,4 +1,4 @@
-1af509d46e31a14e7ff17e23b1fd84250976b405
+05e77d41914d247a1e7caf37d7125ccaa5a53505
 
 The first line of this file holds the git revision number of the
 last merge done from the master library sources.
Index: libgo/VERSION
===
--- libgo/VERSION   (revision 269202)
+++ libgo/VERSION   (working copy)
@@ -1 +1 @@
-go1.12rc1
+go1.12
Index: libgo/go/cmd/go/internal/work/exec.go
===
--- libgo/go/cmd/go/internal/work/exec.go   (revision 269196)
+++ libgo/go/cmd/go/internal/work/exec.go   (working copy)
@@ -657,7 +657,7 @@ func (b *Builder) build(a *Action) (err
if len(out) > 0 {
output := b.processOutput(out)
if p.Module != nil && !allowedVersion(p.Module.GoVersion) {
-   output += "note: module requires Go " + 
p.Module.GoVersion
+   output += "note: module requires Go " + 
p.Module.GoVersion + "\n"
}
b.showOutput(a, a.Package.Dir, a.Package.Desc(), output)
if err != nil {
Index: libgo/go/crypto/rc4/rc4.go
===
--- libgo/go/crypto/rc4/rc4.go  (revision 269196)
+++ libgo/go/crypto/rc4/rc4.go  (working copy)
@@ -45,8 +45,10 @@ func NewCipher(key []byte) (*Cipher, err
return , nil
 }
 
-// Reset zeros the key data so that it will no longer appear in the
-// process's memory.
+// Reset zeros the key data and makes the Cipher unusable.
+//
+// Deprecated: Reset can't guarantee that the key will be entirely removed from
+// the process's memory.
 func (c *Cipher) Reset() {
for i := range c.s {
c.s[i] = 0
Index: libgo/go/crypto/tls/handshake_client.go
===
--- libgo/go/crypto/tls/handshake_client.go (revision 269196)
+++ libgo/go/crypto/tls/handshake_client.go (working copy)
@@ -573,7 +573,7 @@ func (hs *clientHandshakeState) doFullHa
return fmt.Errorf("tls: client certificate private key 
of type %T does not implement crypto.Signer", chainToSend.PrivateKey)
}
 
-   signatureAlgorithm, sigType, hashFunc, err := 
pickSignatureAlgorithm(key.Public(), certReq.supportedSignatureAlgorithms, 
hs.hello.supportedSignatureAlgorithms, c.vers)
+   signatureAlgorithm, sigType, hashFunc, err := 
pickSignatureAlgorithm(key.Public(), certReq.supportedSignatureAlgorithms, 
supportedSignatureAlgorithmsTLS12, c.vers)
if err != nil {
c.sendAlert(alertInternalError)
return err
Index: libgo/go/crypto/tls/handshake_client_test.go
===
--- libgo/go/crypto/tls/handshake_client_test.go(revision 269202)
+++ libgo/go/crypto/tls/handshake_client_test.go(working copy)
@@ -873,10 +873,41 @@ func TestHandshakeClientCertPSSDisabled(
supportedSignatureAlgorithmsTLS12 = 
savedSupportedSignatureAlgorithmsTLS12
 
// Use t.Run to ensure the defer runs after all parallel tests end.
-   t.Run("", func(t *testing.T) {
+   t.Run("1024", func(t *testing.T) {
runClientTestTLS12(t, test)
runClientTestTLS13(t, test)
})
+
+   // Use a 512-bit key to check that the TLS 1.2 handshake is actually 
using
+   // PKCS#1 v1.5. PSS would be failing here.
+   cert, err := X509KeyPair([]byte(`-BEGIN CERTIFICATE-
+MIIBcTCCARugAwIBAgIQGjQnkCFlUqaFlt6ixyz/tDANBgkqhkiG9w0BAQsFADAS
+MRAwDgYDVQQKEwdBY21lIENvMB4XDTE5MDExODIzMjMyOFoXDTIwMDExODIzMjMy
+OFowEjEQMA4GA1UEChMHQWNtZSBDbzBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDd
+ez1rFUDwax2HTxbcnFUP9AhcgEGMHVV2nn4VVEWFJB6I8C/Nkx0XyyQlrmFYBzEQ
+nIPhKls4T0hFoLvjJnXpAgMBAAGjTTBLMA4GA1UdDwEB/wQEAwIFoDATBgNVHSUE
+DDAKBggrBgEFBQcDATAMBgNVHRMBAf8EAjAAMBYGA1UdEQQPMA2CC2V4YW1wbGUu
+Y29tMA0GCSqGSIb3DQEBCwUAA0EAxDuUS+BrrS3c+h+k+fQPOmOScy6yTX9mHw0Q
+KbucGamXYEy0URIwOdO0tQ3LHPc1YGvYSPwkDjkjqECs2Vm/AA==
+-END CERTIFICATE-`), []byte(`-BEGIN RSA PRIVATE KEY-