blob: 849455ab400aaf91d6df5bb8c855983944caafdb [file] [log] [blame]
Elliott Hughes01158d72011-09-19 19:47:10 -07001/*
2 * Copyright (C) 2008 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Brian Carlstromcaabb1b2011-10-11 18:09:13 -070017#include <grp.h>
Elliott Hughes01158d72011-09-19 19:47:10 -070018#include <paths.h>
Elliott Hughesada2da92012-01-17 17:58:58 -080019#include <signal.h>
Elliott Hughes01158d72011-09-19 19:47:10 -070020#include <stdlib.h>
Brian Carlstromcaabb1b2011-10-11 18:09:13 -070021#include <sys/types.h>
22#include <sys/wait.h>
Elliott Hughes01158d72011-09-19 19:47:10 -070023#include <unistd.h>
24
Elliott Hughesb6636b82012-04-24 10:41:16 -070025#include "cutils/sched_policy.h"
Elliott Hughes4ffd3132011-10-24 12:06:42 -070026#include "debugger.h"
27#include "jni_internal.h"
Elliott Hughes4ffd3132011-10-24 12:06:42 -070028#include "JNIHelp.h"
29#include "ScopedLocalRef.h"
30#include "ScopedPrimitiveArray.h"
31#include "ScopedUtfChars.h"
Brian Carlstromcaabb1b2011-10-11 18:09:13 -070032#include "thread.h"
33
Elliott Hughesb4807ec2012-01-17 18:33:04 -080034#if defined(HAVE_PRCTL)
35#include <sys/prctl.h>
36#endif
37
Brian Carlstrom154cef62012-05-02 22:34:03 -070038#if defined(__linux__)
39#include <sys/personality.h>
40#endif
41
Elliott Hughes01158d72011-09-19 19:47:10 -070042namespace art {
43
Brian Carlstromcaabb1b2011-10-11 18:09:13 -070044static pid_t gSystemServerPid = 0;
45
Elliott Hughes0512f022012-03-15 22:10:52 -070046static void Zygote_nativeExecShell(JNIEnv* env, jclass, jstring javaCommand) {
Elliott Hughes01158d72011-09-19 19:47:10 -070047 ScopedUtfChars command(env, javaCommand);
48 if (command.c_str() == NULL) {
49 return;
50 }
Elliott Hughesc1f143d2011-12-01 17:31:10 -080051 const char* argp[] = {_PATH_BSHELL, "-c", command.c_str(), NULL};
Elliott Hughes01158d72011-09-19 19:47:10 -070052 LOG(INFO) << "Exec: " << argp[0] << ' ' << argp[1] << ' ' << argp[2];
53
Elliott Hughesba8eee12012-01-24 20:25:24 -080054 execv(_PATH_BSHELL, const_cast<char**>(argp));
Elliott Hughes01158d72011-09-19 19:47:10 -070055 exit(127);
56}
57
Brian Carlstromcaabb1b2011-10-11 18:09:13 -070058// This signal handler is for zygote mode, since the zygote must reap its children
Elliott Hughes1bac54f2012-03-16 12:48:31 -070059static void SigChldHandler(int /*signal_number*/) {
Brian Carlstromcaabb1b2011-10-11 18:09:13 -070060 pid_t pid;
61 int status;
62
63 while ((pid = waitpid(-1, &status, WNOHANG)) > 0) {
64 // Log process-death status that we care about. In general it is
65 // not safe to call LOG(...) from a signal handler because of
66 // possible reentrancy. However, we know a priori that the
67 // current implementation of LOG() is safe to call from a SIGCHLD
68 // handler in the zygote process. If the LOG() implementation
69 // changes its locking strategy or its use of syscalls within the
70 // lazy-init critical section, its use here may become unsafe.
71 if (WIFEXITED(status)) {
72 if (WEXITSTATUS(status)) {
73 LOG(INFO) << "Process " << pid << " exited cleanly (" << WEXITSTATUS(status) << ")";
74 } else if (false) {
75 LOG(INFO) << "Process " << pid << " exited cleanly (" << WEXITSTATUS(status) << ")";
76 }
77 } else if (WIFSIGNALED(status)) {
78 if (WTERMSIG(status) != SIGKILL) {
79 LOG(INFO) << "Process " << pid << " terminated by signal (" << WTERMSIG(status) << ")";
80 } else if (false) {
81 LOG(INFO) << "Process " << pid << " terminated by signal (" << WTERMSIG(status) << ")";
82 }
83#ifdef WCOREDUMP
84 if (WCOREDUMP(status)) {
85 LOG(INFO) << "Process " << pid << " dumped core";
86 }
87#endif /* ifdef WCOREDUMP */
88 }
89
90 // If the just-crashed process is the system_server, bring down zygote
91 // so that it is restarted by init and system server will be restarted
92 // from there.
93 if (pid == gSystemServerPid) {
Brian Carlstrom6a4be3a2011-10-20 16:34:03 -070094 LOG(ERROR) << "Exit zygote because system server (" << pid << ") has terminated";
95 kill(getpid(), SIGKILL);
Brian Carlstromcaabb1b2011-10-11 18:09:13 -070096 }
97 }
98
99 if (pid < 0) {
100 PLOG(WARNING) << "Zygote SIGCHLD error in waitpid";
101 }
102}
103
Elliott Hughes0512f022012-03-15 22:10:52 -0700104// Configures the SIGCHLD handler for the zygote process. This is configured
Brian Carlstromcaabb1b2011-10-11 18:09:13 -0700105// very late, because earlier in the runtime we may fork() and exec()
106// other processes, and we want to waitpid() for those rather than
107// have them be harvested immediately.
108//
109// This ends up being called repeatedly before each fork(), but there's
110// no real harm in that.
Elliott Hughes0512f022012-03-15 22:10:52 -0700111static void SetSigChldHandler() {
Brian Carlstromcaabb1b2011-10-11 18:09:13 -0700112 struct sigaction sa;
113 memset(&sa, 0, sizeof(sa));
Elliott Hughes4ffd3132011-10-24 12:06:42 -0700114 sa.sa_handler = SigChldHandler;
Brian Carlstromcaabb1b2011-10-11 18:09:13 -0700115
Elliott Hughes362f9bc2011-10-17 18:56:41 -0700116 int err = sigaction(SIGCHLD, &sa, NULL);
Brian Carlstromcaabb1b2011-10-11 18:09:13 -0700117 if (err < 0) {
118 PLOG(WARNING) << "Error setting SIGCHLD handler";
119 }
120}
121
Elliott Hughes0512f022012-03-15 22:10:52 -0700122// Sets the SIGCHLD handler back to default behavior in zygote children.
123static void UnsetSigChldHandler() {
Brian Carlstromcaabb1b2011-10-11 18:09:13 -0700124 struct sigaction sa;
125 memset(&sa, 0, sizeof(sa));
126 sa.sa_handler = SIG_DFL;
127
Elliott Hughes362f9bc2011-10-17 18:56:41 -0700128 int err = sigaction(SIGCHLD, &sa, NULL);
Brian Carlstromcaabb1b2011-10-11 18:09:13 -0700129 if (err < 0) {
130 PLOG(WARNING) << "Error unsetting SIGCHLD handler";
131 }
132}
133
134// Calls POSIX setgroups() using the int[] object as an argument.
135// A NULL argument is tolerated.
Elliott Hughes2abeb9b2012-05-11 23:42:02 -0700136static void SetGids(JNIEnv* env, jintArray javaGids) {
Brian Carlstromcaabb1b2011-10-11 18:09:13 -0700137 if (javaGids == NULL) {
Elliott Hughes2abeb9b2012-05-11 23:42:02 -0700138 return;
Brian Carlstromcaabb1b2011-10-11 18:09:13 -0700139 }
140
141 COMPILE_ASSERT(sizeof(gid_t) == sizeof(jint), sizeof_gid_and_jint_are_differerent);
142 ScopedIntArrayRO gids(env, javaGids);
Elliott Hughes2abeb9b2012-05-11 23:42:02 -0700143 CHECK(gids.get() != NULL);
144 int rc = setgroups(gids.size(), reinterpret_cast<const gid_t*>(&gids[0]));
145 if (rc == -1) {
146 PLOG(FATAL) << "setgroups failed";
Brian Carlstromcaabb1b2011-10-11 18:09:13 -0700147 }
Brian Carlstromcaabb1b2011-10-11 18:09:13 -0700148}
149
150// Sets the resource limits via setrlimit(2) for the values in the
151// two-dimensional array of integers that's passed in. The second dimension
152// contains a tuple of length 3: (resource, rlim_cur, rlim_max). NULL is
153// treated as an empty array.
Elliott Hughes2abeb9b2012-05-11 23:42:02 -0700154static void SetRLimits(JNIEnv* env, jobjectArray javaRlimits) {
Brian Carlstromcaabb1b2011-10-11 18:09:13 -0700155 if (javaRlimits == NULL) {
Elliott Hughes2abeb9b2012-05-11 23:42:02 -0700156 return;
Brian Carlstromcaabb1b2011-10-11 18:09:13 -0700157 }
158
Elliott Hughes7b9d9962012-04-20 18:48:18 -0700159 rlimit rlim;
Brian Carlstromcaabb1b2011-10-11 18:09:13 -0700160 memset(&rlim, 0, sizeof(rlim));
161
Elliott Hughes2abeb9b2012-05-11 23:42:02 -0700162 for (int i = 0; i < env->GetArrayLength(javaRlimits); ++i) {
Brian Carlstromcaabb1b2011-10-11 18:09:13 -0700163 ScopedLocalRef<jobject> javaRlimitObject(env, env->GetObjectArrayElement(javaRlimits, i));
164 ScopedIntArrayRO javaRlimit(env, reinterpret_cast<jintArray>(javaRlimitObject.get()));
165 if (javaRlimit.size() != 3) {
Elliott Hughes2abeb9b2012-05-11 23:42:02 -0700166 LOG(FATAL) << "rlimits array must have a second dimension of size 3";
Brian Carlstromcaabb1b2011-10-11 18:09:13 -0700167 }
168
169 rlim.rlim_cur = javaRlimit[1];
170 rlim.rlim_max = javaRlimit[2];
171
Elliott Hughes2abeb9b2012-05-11 23:42:02 -0700172 int rc = setrlimit(javaRlimit[0], &rlim);
173 if (rc == -1) {
174 PLOG(FATAL) << "setrlimit(" << javaRlimit[0] << ", "
175 << "{" << rlim.rlim_cur << ", " << rlim.rlim_max << "}) failed";
Brian Carlstromcaabb1b2011-10-11 18:09:13 -0700176 }
177 }
Brian Carlstromcaabb1b2011-10-11 18:09:13 -0700178}
179
Elliott Hughes76e36942012-03-16 13:44:56 -0700180#if defined(HAVE_ANDROID_OS)
Elliott Hughes2abeb9b2012-05-11 23:42:02 -0700181
182// The debug malloc library needs to know whether it's the zygote or a child.
183extern "C" int gMallocLeakZygoteChild;
184
185static void EnableDebugger() {
186 // To let a non-privileged gdbserver attach to this
187 // process, we must set our dumpable flag.
188 if (prctl(PR_SET_DUMPABLE, 1, 0, 0, 0) == -1) {
189 PLOG(ERROR) << "prctl(PR_SET_DUMPABLE) failed for pid " << getpid();
190 }
191 // We don't want core dumps, though, so set the core dump size to 0.
192 rlimit rl;
193 rl.rlim_cur = 0;
194 rl.rlim_max = RLIM_INFINITY;
195 if (setrlimit(RLIMIT_CORE, &rl) == -1) {
196 PLOG(ERROR) << "setrlimit(RLIMIT_CORE) failed for pid " << getpid();
197 }
198}
199
200static void EnableKeepCapabilities() {
201 int rc = prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0);
202 if (rc == -1) {
203 PLOG(FATAL) << "prctl(PR_SET_KEEPCAPS) failed";
204 }
205}
206
Elliott Hughes76e36942012-03-16 13:44:56 -0700207static void SetCapabilities(int64_t permitted, int64_t effective) {
Elliott Hughes7b9d9962012-04-20 18:48:18 -0700208 __user_cap_header_struct capheader;
209 __user_cap_data_struct capdata;
Brian Carlstromcaabb1b2011-10-11 18:09:13 -0700210
211 memset(&capheader, 0, sizeof(capheader));
212 memset(&capdata, 0, sizeof(capdata));
213
214 capheader.version = _LINUX_CAPABILITY_VERSION;
215 capheader.pid = 0;
216
217 capdata.effective = effective;
218 capdata.permitted = permitted;
219
220 if (capset(&capheader, &capdata) != 0) {
Elliott Hughes3d30d9b2011-12-07 17:35:48 -0800221 PLOG(FATAL) << "capset(" << permitted << ", " << effective << ") failed";
Brian Carlstromcaabb1b2011-10-11 18:09:13 -0700222 }
Brian Carlstromcaabb1b2011-10-11 18:09:13 -0700223}
Elliott Hughes2abeb9b2012-05-11 23:42:02 -0700224
225static void SetSchedulerPolicy() {
226 errno = -set_sched_policy(0, SP_DEFAULT);
227 if (errno != 0) {
228 PLOG(FATAL) << "set_sched_policy(0, SP_DEFAULT) failed";
229 }
230}
231
Elliott Hughes76e36942012-03-16 13:44:56 -0700232#else
Elliott Hughes2abeb9b2012-05-11 23:42:02 -0700233
234static int gMallocLeakZygoteChild = 0;
235
236static void EnableDebugger() {}
237static void EnableKeepCapabilities() {}
Elliott Hughes76e36942012-03-16 13:44:56 -0700238static void SetCapabilities(int64_t, int64_t) {}
Elliott Hughes2abeb9b2012-05-11 23:42:02 -0700239static void SetSchedulerPolicy() {}
240
Elliott Hughes76e36942012-03-16 13:44:56 -0700241#endif
Brian Carlstromcaabb1b2011-10-11 18:09:13 -0700242
Elliott Hughes0512f022012-03-15 22:10:52 -0700243static void EnableDebugFeatures(uint32_t debug_flags) {
Elliott Hughes4ffd3132011-10-24 12:06:42 -0700244 // Must match values in dalvik.system.Zygote.
245 enum {
246 DEBUG_ENABLE_DEBUGGER = 1,
247 DEBUG_ENABLE_CHECKJNI = 1 << 1,
248 DEBUG_ENABLE_ASSERT = 1 << 2,
249 DEBUG_ENABLE_SAFEMODE = 1 << 3,
250 DEBUG_ENABLE_JNI_LOGGING = 1 << 4,
251 };
252
253 if ((debug_flags & DEBUG_ENABLE_CHECKJNI) != 0) {
254 Runtime* runtime = Runtime::Current();
255 JavaVMExt* vm = runtime->GetJavaVM();
256 if (!vm->check_jni) {
257 LOG(DEBUG) << "Late-enabling -Xcheck:jni";
Elliott Hughes88c5c352012-03-15 18:49:48 -0700258 vm->SetCheckJniEnabled(true);
Elliott Hughes4ffd3132011-10-24 12:06:42 -0700259 // There's only one thread running at this point, so only one JNIEnv to fix up.
Elliott Hughes88c5c352012-03-15 18:49:48 -0700260 Thread::Current()->GetJniEnv()->SetCheckJniEnabled(true);
Elliott Hughes4ffd3132011-10-24 12:06:42 -0700261 } else {
262 LOG(DEBUG) << "Not late-enabling -Xcheck:jni (already on)";
263 }
264 debug_flags &= ~DEBUG_ENABLE_CHECKJNI;
265 }
266
267 if ((debug_flags & DEBUG_ENABLE_JNI_LOGGING) != 0) {
Elliott Hughes4dd9b4d2011-12-12 18:29:24 -0800268 gLogVerbosity.third_party_jni = true;
Elliott Hughes4ffd3132011-10-24 12:06:42 -0700269 debug_flags &= ~DEBUG_ENABLE_JNI_LOGGING;
270 }
271
272 Dbg::SetJdwpAllowed((debug_flags & DEBUG_ENABLE_DEBUGGER) != 0);
Elliott Hughes4ffd3132011-10-24 12:06:42 -0700273 if ((debug_flags & DEBUG_ENABLE_DEBUGGER) != 0) {
Elliott Hughes2abeb9b2012-05-11 23:42:02 -0700274 EnableDebugger();
Elliott Hughes4ffd3132011-10-24 12:06:42 -0700275 }
Elliott Hughes4ffd3132011-10-24 12:06:42 -0700276 debug_flags &= ~DEBUG_ENABLE_DEBUGGER;
277
278 // These two are for backwards compatibility with Dalvik.
279 debug_flags &= ~DEBUG_ENABLE_ASSERT;
280 debug_flags &= ~DEBUG_ENABLE_SAFEMODE;
281
282 if (debug_flags != 0) {
283 LOG(ERROR) << StringPrintf("Unknown bits set in debug_flags: %#x", debug_flags);
284 }
285}
286
Brian Carlstromcaabb1b2011-10-11 18:09:13 -0700287// Utility routine to fork zygote and specialize the child process.
Elliott Hughes0512f022012-03-15 22:10:52 -0700288static pid_t ForkAndSpecializeCommon(JNIEnv* env, uid_t uid, gid_t gid, jintArray javaGids,
289 jint debug_flags, jobjectArray javaRlimits,
290 jlong permittedCapabilities, jlong effectiveCapabilities) {
Brian Carlstromcaabb1b2011-10-11 18:09:13 -0700291 Runtime* runtime = Runtime::Current();
292 CHECK(runtime->IsZygote()) << "runtime instance not started with -Xzygote";
293 if (false) { // TODO: do we need do anything special like !dvmGcPreZygoteFork()?
294 LOG(FATAL) << "pre-fork heap failed";
295 }
296
Elliott Hughes4ffd3132011-10-24 12:06:42 -0700297 SetSigChldHandler();
Brian Carlstromcaabb1b2011-10-11 18:09:13 -0700298
299 // Grab thread before fork potentially makes Thread::pthread_key_self_ unusable.
300 Thread* self = Thread::Current();
301
302 // dvmDumpLoaderStats("zygote"); // TODO: ?
303 pid_t pid = fork();
304
305 if (pid == 0) {
Elliott Hughes2abeb9b2012-05-11 23:42:02 -0700306 // The child process.
Brian Carlstromcaabb1b2011-10-11 18:09:13 -0700307 gMallocLeakZygoteChild = 1;
308
Elliott Hughes2abeb9b2012-05-11 23:42:02 -0700309 // Keep capabilities across UID change, unless we're staying root.
Brian Carlstromcaabb1b2011-10-11 18:09:13 -0700310 if (uid != 0) {
Elliott Hughes2abeb9b2012-05-11 23:42:02 -0700311 EnableKeepCapabilities();
Brian Carlstromcaabb1b2011-10-11 18:09:13 -0700312 }
313
Elliott Hughes2abeb9b2012-05-11 23:42:02 -0700314 SetGids(env, javaGids);
Brian Carlstromcaabb1b2011-10-11 18:09:13 -0700315
Elliott Hughes2abeb9b2012-05-11 23:42:02 -0700316 SetRLimits(env, javaRlimits);
317
318 int rc = setgid(gid);
319 if (rc == -1) {
Elliott Hughes3d30d9b2011-12-07 17:35:48 -0800320 PLOG(FATAL) << "setgid(" << gid << ") failed";
Brian Carlstromcaabb1b2011-10-11 18:09:13 -0700321 }
322
Elliott Hughes2abeb9b2012-05-11 23:42:02 -0700323 rc = setuid(uid);
324 if (rc == -1) {
Elliott Hughes3d30d9b2011-12-07 17:35:48 -0800325 PLOG(FATAL) << "setuid(" << uid << ") failed";
Brian Carlstromcaabb1b2011-10-11 18:09:13 -0700326 }
327
Brian Carlstrom154cef62012-05-02 22:34:03 -0700328#if defined(__linux__)
Elliott Hughes51e53862012-05-02 17:17:28 -0700329 // Work around ARM kernel ASLR lossage (http://b/5817320).
330 int old_personality = personality(0xffffffff);
331 int new_personality = personality(old_personality | ADDR_NO_RANDOMIZE);
332 if (new_personality == -1) {
333 PLOG(WARNING) << "personality(" << new_personality << ") failed";
334 }
Brian Carlstrom154cef62012-05-02 22:34:03 -0700335#endif
Elliott Hughes51e53862012-05-02 17:17:28 -0700336
Elliott Hughes3d30d9b2011-12-07 17:35:48 -0800337 SetCapabilities(permittedCapabilities, effectiveCapabilities);
Brian Carlstromcaabb1b2011-10-11 18:09:13 -0700338
Elliott Hughes2abeb9b2012-05-11 23:42:02 -0700339 SetSchedulerPolicy();
Elliott Hughesb6636b82012-04-24 10:41:16 -0700340
Brian Carlstromcaabb1b2011-10-11 18:09:13 -0700341 // Our system thread ID, etc, has changed so reset Thread state.
342 self->InitAfterFork();
343
Elliott Hughes4ffd3132011-10-24 12:06:42 -0700344 EnableDebugFeatures(debug_flags);
Brian Carlstromcaabb1b2011-10-11 18:09:13 -0700345
Elliott Hughes4ffd3132011-10-24 12:06:42 -0700346 UnsetSigChldHandler();
Brian Carlstromcaabb1b2011-10-11 18:09:13 -0700347 runtime->DidForkFromZygote();
348 } else if (pid > 0) {
349 // the parent process
350 }
351 return pid;
352}
353
Elliott Hughes0512f022012-03-15 22:10:52 -0700354static jint Zygote_nativeForkAndSpecialize(JNIEnv* env, jclass, jint uid, jint gid, jintArray gids,
355 jint debug_flags, jobjectArray rlimits) {
Elliott Hughes4ffd3132011-10-24 12:06:42 -0700356 return ForkAndSpecializeCommon(env, uid, gid, gids, debug_flags, rlimits, 0, 0);
Brian Carlstroma9f19782011-10-13 00:14:47 -0700357}
358
Elliott Hughes0512f022012-03-15 22:10:52 -0700359static jint Zygote_nativeForkSystemServer(JNIEnv* env, jclass, uid_t uid, gid_t gid, jintArray gids,
360 jint debug_flags, jobjectArray rlimits,
361 jlong permittedCapabilities, jlong effectiveCapabilities) {
Elliott Hughes4ffd3132011-10-24 12:06:42 -0700362 pid_t pid = ForkAndSpecializeCommon(env, uid, gid, gids,
363 debug_flags, rlimits,
Brian Carlstromcaabb1b2011-10-11 18:09:13 -0700364 permittedCapabilities, effectiveCapabilities);
365 if (pid > 0) {
366 // The zygote process checks whether the child process has died or not.
367 LOG(INFO) << "System server process " << pid << " has been created";
368 gSystemServerPid = pid;
369 // There is a slight window that the system server process has crashed
370 // but it went unnoticed because we haven't published its pid yet. So
371 // we recheck here just to make sure that all is well.
372 int status;
373 if (waitpid(pid, &status, WNOHANG) == pid) {
374 LOG(FATAL) << "System server process " << pid << " has died. Restarting Zygote!";
375 }
376 }
377 return pid;
378}
379
Elliott Hughes01158d72011-09-19 19:47:10 -0700380static JNINativeMethod gMethods[] = {
381 NATIVE_METHOD(Zygote, nativeExecShell, "(Ljava/lang/String;)V"),
382 //NATIVE_METHOD(Zygote, nativeFork, "()I"),
Brian Carlstroma9f19782011-10-13 00:14:47 -0700383 NATIVE_METHOD(Zygote, nativeForkAndSpecialize, "(II[II[[I)I"),
Brian Carlstromcaabb1b2011-10-11 18:09:13 -0700384 NATIVE_METHOD(Zygote, nativeForkSystemServer, "(II[II[[IJJ)I"),
Elliott Hughes01158d72011-09-19 19:47:10 -0700385};
386
Elliott Hughes01158d72011-09-19 19:47:10 -0700387void register_dalvik_system_Zygote(JNIEnv* env) {
Elliott Hughes7756d542012-05-24 21:56:51 -0700388 REGISTER_NATIVE_METHODS("dalvik/system/Zygote");
Elliott Hughes01158d72011-09-19 19:47:10 -0700389}
390
391} // namespace art