|
7 | 7 | :EXPORT_HUGO_MENU: :menu main |
8 | 8 | :END: |
9 | 9 |
|
| 10 | +** RustSec |
| 11 | +:PROPERTIES: |
| 12 | +:EXPORT_FILE_NAME: rustsec |
| 13 | +:EXPORT_DATE: 2021-10-08 |
| 14 | +:EXPORT_HUGO_SECTION: hacking |
| 15 | +:EXPORT_DESCRIPTION: Rust and security related |
| 16 | +:EXPORT_OPTIONS: toc:2 |
| 17 | +:END: |
| 18 | + |
| 19 | + |
| 20 | +*** Solana dependencies |
| 21 | + |
| 22 | +When we worked on Solana project, we met a problem that we couldn't update |
| 23 | +crate dependencies with =cargo update=. |
| 24 | + |
| 25 | +#+begin_src shell |
| 26 | +$ cargo update -p nix |
| 27 | + Updating crates.io index |
| 28 | +#+end_src |
| 29 | + |
| 30 | +But nothing changed. We kept trying: |
| 31 | + |
| 32 | +#+begin_src shell |
| 33 | +$ cargo update -p nix --precise 0.20.2 |
| 34 | + Updating crates.io index |
| 35 | +error: failed to select a version for `memoffset`. |
| 36 | + ... required by package `nix v0.20.2` |
| 37 | + ... which is depended on by `ctrlc v3.1.9` |
| 38 | + ... which is depended on by `solana-cli v1.9.0 (/<my_path>/solana/cli)` |
| 39 | +versions that meet the requirements `^0.6.3` are: 0.6.4, 0.6.3 |
| 40 | + |
| 41 | +all possible versions conflict with previously selected packages. |
| 42 | + |
| 43 | + previously selected package `memoffset v0.6.1` |
| 44 | + ... which is depended on by `crossbeam-epoch v0.9.5` |
| 45 | + ... which is depended on by `crossbeam-deque v0.8.1` |
| 46 | + ... which is depended on by `rayon v1.5.1` |
| 47 | + ... which is depended on by `dashmap v4.0.2` |
| 48 | + ... which is depended on by `solana-core v1.9.0 (/<my_path>/solana/core)` |
| 49 | + ... which is depended on by `solana-accounts-cluster-bench v1.9.0 (/<my_path>/solana/accounts-cluster-bench)` |
| 50 | + |
| 51 | +failed to select a version for `memoffset` which could resolve this conflict |
| 52 | +#+end_src |
| 53 | + |
| 54 | +#+begin_src shell |
| 55 | +$ cargo update -p ctrlc -p nix |
| 56 | + Updating crates.io |
| 57 | + |
| 58 | +$ git status |
| 59 | +On branch master |
| 60 | +Your branch is up to date with 'origin/master'. |
| 61 | + |
| 62 | +nothing to commit, working tree clean |
| 63 | +#+end_src |
| 64 | + |
| 65 | +One more: |
| 66 | + |
| 67 | +#+begin_src shell |
| 68 | +$ cargo update -p ctrlc -p nix -p crossbeam-epoch -p crossbeam-deque -p rayon -p dashmap |
| 69 | + Updating crates.io index |
| 70 | + Updating ctrlc v3.1.9 -> v3.2.1 |
| 71 | + Updating memoffset v0.6.1 -> v0.6.4 |
| 72 | + Adding nix v0.23.0 |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | +$ git status |
| 77 | +On branch master |
| 78 | +Your branch is up to date with 'origin/master'. |
| 79 | + |
| 80 | +Changes not staged for commit: |
| 81 | + (use "git add <file>..." to update what will be committed) |
| 82 | + (use "git restore <file>..." to discard changes in working directory) |
| 83 | + modified: Cargo.lock |
| 84 | + |
| 85 | +no changes added to commit (use "git add" and/or "git commit -a") |
| 86 | +#+end_src |
| 87 | + |
| 88 | +Use =tree=: |
| 89 | + |
| 90 | +#+begin_src shell |
| 91 | +$ cargo tree -p nix |
| 92 | +error: There are multiple `nix` packages in your project, and the specification `nix` is ambiguous. |
| 93 | +Please re-run this command with `-p <spec>` where `<spec>` is one of the following: |
| 94 | + nix:0.20.0 |
| 95 | + nix:0.23.0 |
| 96 | + |
| 97 | +#+end_src |
| 98 | + |
| 99 | +#+begin_src shell |
| 100 | +$ cargo tree -p nix:0.20.0 |
| 101 | +nix v0.20.0 |
| 102 | +├── bitflags v1.3.2 |
| 103 | +├── cfg-if v1.0.0 |
| 104 | +└── libc v0.2.103 |
| 105 | + |
| 106 | + |
| 107 | +$ cargo tree -p nix:0.20.0 -i |
| 108 | +nix v0.20.0 |
| 109 | +├── solana-install v1.9.0 (/<my_path>/solana/install) |
| 110 | +├── solana-net-utils v1.9.0 (/<my_path>/solana/net-utils) |
| 111 | +│ ├── solana-accounts-cluster-bench v1.9.0 (/<my_path>/solana/accounts-cluster-bench) |
| 112 | +│ ├── solana-bench-streamer v1.9.0 (/<my_path>/solana/bench-streamer) |
| 113 | +│ ├── solana-bench-tps v1.9.0 (/<my_path>/solana/bench-tps) |
| 114 | +│ ├── solana-client v1.9.0 (/<my_path>/solana/client) |
| 115 | +│ │ ├── solana-accounts-cluster-bench v1.9.0 (/<my_path>/solana/accounts-cluster-bench) |
| 116 | +... |
| 117 | +#+end_src |
| 118 | + |
| 119 | +#+begin_src shell |
| 120 | +$ rg nix -t toml |
| 121 | +net-utils/Cargo.toml |
| 122 | +16:nix = "0.20.0" |
| 123 | + |
| 124 | +sys-tuner/Cargo.toml |
| 125 | +20:[target."cfg(unix)".dependencies] |
| 126 | +21:unix_socket2 = "0.5.4" |
| 127 | +23:nix = "0.20.0" |
| 128 | + |
| 129 | +ledger-tool/Cargo.toml |
| 130 | +43:[target."cfg(unix)".dependencies] |
| 131 | + |
| 132 | +programs/bpf/Cargo.lock |
| 133 | +1559:name = "nix" |
| 134 | +3079: "nix", |
| 135 | + |
| 136 | +streamer/Cargo.toml |
| 137 | +20:nix = "0.20.0" |
| 138 | + |
| 139 | +Cargo.lock |
| 140 | +997: "nix 0.23.0", |
| 141 | +2605:name = "nix" |
| 142 | +2617:name = "nix" |
| 143 | +4915: "nix 0.20.0", |
| 144 | +5159: "nix 0.20.0", |
| 145 | +5705: "nix 0.20.0", |
| 146 | +5720: "nix 0.20.0", |
| 147 | +5724: "unix_socket2", |
| 148 | +6853:name = "unix_socket2" |
| 149 | + |
| 150 | +validator/Cargo.toml |
| 151 | +55:[target."cfg(unix)".dependencies] |
| 152 | + |
| 153 | +install/Cargo.toml |
| 154 | +23:nix = "0.20.0" |
| 155 | +#+end_src |
| 156 | + |
| 157 | + |
| 158 | +#+begin_src shell |
| 159 | +$ cargo update -p nix:0.20.0 --precise 0.20.2 |
| 160 | + Updating crates.io index |
| 161 | +error: failed to select a version for `bitflags`. |
| 162 | + ... required by package `nix v0.20.2` |
| 163 | + ... which is depended on by `solana-install v1.9.0 (/<my_path>/solana/install)` |
| 164 | +versions that meet the requirements `>=1.1.0, <1.3.0` are: 1.2.1, 1.2.0, 1.1.0 |
| 165 | + |
| 166 | +all possible versions conflict with previously selected packages. |
| 167 | + |
| 168 | + previously selected package `bitflags v1.3.1` |
| 169 | + ... which is depended on by `nix v0.23.0` |
| 170 | + ... which is depended on by `ctrlc v3.2.1` |
| 171 | + ... which is depended on by `solana-cli v1.9.0 (/<my_path>/solana/cli)` |
| 172 | + |
| 173 | +failed to select a version for `bitflags` which could resolve this conflict |
| 174 | +#+end_src |
| 175 | + |
| 176 | +Haven't solved it yet. To be continued. |
| 177 | + |
| 178 | + |
10 | 179 | ** Syntax of method calls :rust:@hacking: |
11 | 180 | :PROPERTIES: |
12 | 181 | :EXPORT_FILE_NAME: rust-method-syntax |
|
0 commit comments